Skip to contentSkip to conversation

habanalabs/goya: move mmu_prepare to context init

PATCH New Oded Gabbay 1 participant 2 messages Dec 8, 2020 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 habanalabs/goya: move mmu_prepare to context init

From: Ohad Sharabi <[email protected]>

Currently mmu_prepare is located at context switch. Since we support a single context, no reason to reconfigure the MMU registers every context switch.

---
 drivers/misc/habanalabs/goya/goya.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/goya/goya.c +3 -2
index 6ae34905d34f..dc32091d9b4b 100644
@@ -4876,8 +4876,6 @@ int goya_context_switch(struct hl_device *hdev, u32 asid)
 
 	WREG32(mmTPC_PLL_CLK_RLX_0, 0x200020);
 
-	goya_mmu_prepare(hdev, asid);
-
 	goya_clear_sm_regs(hdev);
 
 	return 0;
@@ -5312,6 +5310,9 @@ static int goya_get_eeprom_data(struct hl_device *hdev, void *data,
 
 static int goya_ctx_init(struct hl_ctx *ctx)
 {
+	if (ctx->asid != HL_KERNEL_ASID_ID)
+		goya_mmu_prepare(ctx->hdev, ctx->asid);
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 habanalabs: report dram_page_size in hw_ip_info ioctl

From: Moti Haimovski <[email protected]>

Instead of having it hard-coded as a define, pass it to the user in runtime.

---
 drivers/misc/habanalabs/common/habanalabs_ioctl.c | 1 +
 include/uapi/misc/habanalabs.h                    | 2 ++
 2 files changed, 3 insertions(+)
drivers/misc/habanalabs/common/habanalabs_ioctl.c +1 -0
index a0c0d20f6f8f..3343012f4762 100644
@@ -63,6 +63,7 @@ static int hw_ip_info(struct hl_device *hdev, struct hl_info_args *args)
 	hw_ip.dram_size = prop->dram_size - dram_kmd_size;
 	if (hw_ip.dram_size > PAGE_SIZE)
 		hw_ip.dram_enabled = 1;
+	hw_ip.dram_page_size = prop->dram_page_size;
 	hw_ip.num_of_events = prop->num_of_events;
 
 	memcpy(hw_ip.cpucp_version, prop->cpucp_info.cpucp_version,
include/uapi/misc/habanalabs.h +2 -0
index 8a5e60a6dae0..b6e7ceef59af 100644
@@ -320,6 +320,8 @@ struct hl_info_hw_ip_info {
 	__u8 pad[2];
 	__u8 cpucp_version[HL_INFO_VERSION_MAX_LEN];
 	__u8 card_name[HL_INFO_CARD_NAME_MAX_LEN];
+	__u64 reserved2;
+	__u64 dram_page_size;
 };
 
 struct hl_info_dram_usage {
Signature · 1 line
2.17.1