habanalabs: add num_hops to hl_mmu_properties
This commit adds the number of HOPs supported by the device to the device MMU properties. Signed-off-by: Moti Haimovski <mhaimovski@habana.ai> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
This commit is contained in:
parent
d83fe66928
commit
7edf341b9e
@ -236,12 +236,15 @@ enum hl_device_hw_state {
|
||||
* @hop2_shift: shift of hop 2 mask.
|
||||
* @hop3_shift: shift of hop 3 mask.
|
||||
* @hop4_shift: shift of hop 4 mask.
|
||||
* @hop5_shift: shift of hop 5 mask.
|
||||
* @hop0_mask: mask to get the PTE address in hop 0.
|
||||
* @hop1_mask: mask to get the PTE address in hop 1.
|
||||
* @hop2_mask: mask to get the PTE address in hop 2.
|
||||
* @hop3_mask: mask to get the PTE address in hop 3.
|
||||
* @hop4_mask: mask to get the PTE address in hop 4.
|
||||
* @hop5_mask: mask to get the PTE address in hop 5.
|
||||
* @page_size: default page size used to allocate memory.
|
||||
* @num_hops: The amount of hops supported by the translation table.
|
||||
*/
|
||||
struct hl_mmu_properties {
|
||||
u64 start_addr;
|
||||
@ -251,12 +254,15 @@ struct hl_mmu_properties {
|
||||
u64 hop2_shift;
|
||||
u64 hop3_shift;
|
||||
u64 hop4_shift;
|
||||
u64 hop5_shift;
|
||||
u64 hop0_mask;
|
||||
u64 hop1_mask;
|
||||
u64 hop2_mask;
|
||||
u64 hop3_mask;
|
||||
u64 hop4_mask;
|
||||
u64 hop5_mask;
|
||||
u32 page_size;
|
||||
u32 num_hops;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -441,6 +441,7 @@ static int gaudi_get_fixed_properties(struct hl_device *hdev)
|
||||
prop->pmmu.end_addr =
|
||||
(VA_HOST_SPACE_START + VA_HOST_SPACE_SIZE / 2) - 1;
|
||||
prop->pmmu.page_size = PAGE_SIZE_4KB;
|
||||
prop->pmmu.num_hops = MMU_ARCH_5_HOPS;
|
||||
|
||||
/* PMMU and HPMMU are the same except of page size */
|
||||
memcpy(&prop->pmmu_huge, &prop->pmmu, sizeof(prop->pmmu));
|
||||
|
@ -426,12 +426,14 @@ int goya_get_fixed_properties(struct hl_device *hdev)
|
||||
prop->dmmu.start_addr = VA_DDR_SPACE_START;
|
||||
prop->dmmu.end_addr = VA_DDR_SPACE_END;
|
||||
prop->dmmu.page_size = PAGE_SIZE_2MB;
|
||||
prop->dmmu.num_hops = MMU_ARCH_5_HOPS;
|
||||
|
||||
/* shifts and masks are the same in PMMU and DMMU */
|
||||
memcpy(&prop->pmmu, &prop->dmmu, sizeof(prop->dmmu));
|
||||
prop->pmmu.start_addr = VA_HOST_SPACE_START;
|
||||
prop->pmmu.end_addr = VA_HOST_SPACE_END;
|
||||
prop->pmmu.page_size = PAGE_SIZE_4KB;
|
||||
prop->pmmu.num_hops = MMU_ARCH_5_HOPS;
|
||||
|
||||
/* PMMU and HPMMU are the same except of page size */
|
||||
memcpy(&prop->pmmu_huge, &prop->pmmu, sizeof(prop->pmmu));
|
||||
|
@ -29,6 +29,8 @@
|
||||
#define HOP3_SHIFT 21
|
||||
#define HOP4_SHIFT 12
|
||||
|
||||
#define MMU_ARCH_5_HOPS 5
|
||||
|
||||
#define HOP_PHYS_ADDR_MASK (~FLAGS_MASK)
|
||||
|
||||
#define HL_PTE_SIZE sizeof(u64)
|
||||
|
Loading…
Reference in New Issue
Block a user