habanalabs: stop using the acronym KMD
PATCH 1/2 habanalabs: stop using the acronym KMD
We want to stop using the acronym KMD. Therefore, replace all locations (except for register names we can't modify) where KMD is written to other terms such as "Linux kernel driver" or "Host kernel driver", etc.
--- drivers/misc/habanalabs/asid.c | 2 +- drivers/misc/habanalabs/command_buffer.c | 3 +- drivers/misc/habanalabs/command_submission.c | 5 +- drivers/misc/habanalabs/context.c | 2 +- drivers/misc/habanalabs/goya/goya.c | 22 +++--- drivers/misc/habanalabs/goya/goyaP.h | 14 ++-- drivers/misc/habanalabs/habanalabs.h | 32 ++++----- drivers/misc/habanalabs/include/armcp_if.h | 70 ++++++++++---------- include/uapi/misc/habanalabs.h | 22 +++--- 9 files changed, 88 insertions(+), 84 deletions(-)
drivers/misc/habanalabs/asid.c +1 -1
@@ -18,7 +18,7 @@ int hl_asid_init(struct hl_device *hdev)mutex_init (&hdev->asid_mutex); -/* ASID 0 is reserved for KMD and device CPU */ +/* ASID 0 is reserved for the kernel driver and device CPU */ set_bit (0 , hdev->asid_bitmap);return 0 ;
drivers/misc/habanalabs/command_buffer.c +2 -1
@@ -397,7 +397,8 @@ struct hl_cb *hl_cb_kernel_create(struct hl_device *hdev, u32 cb_size) rc =hl_cb_create (hdev, &hdev->kernel_cb_mgr, cb_size, &cb_handle,HL_KERNEL_ASID_ID );if (rc) { -dev_err (hdev->dev,"Failed to allocate CB for KMD %d\n" , rc); +dev_err (hdev->dev, +"Failed to allocate CB for the kernel driver %d\n" , rc);return NULL ; }
drivers/misc/habanalabs/command_submission.c +3 -2
@@ -409,8 +409,9 @@ static struct hl_cb *validate_queue_index(struct hl_device *hdev,return NULL ; } -if (hw_queue_prop->kmd_only) { -dev_err (hdev->dev,"Queue index %d is restricted for KMD\n" , +if (hw_queue_prop->driver_only) { +dev_err (hdev->dev, +"Queue index %d is restricted for the kernel driver\n" , chunk->queue_index);return NULL ; }else if (hw_queue_prop->type ==QUEUE_TYPE_INT ) {
drivers/misc/habanalabs/context.c +1 -1
@@ -128,7 +128,7 @@ int hl_ctx_init(struct hl_device *hdev, struct hl_ctx *ctx, bool is_kernel_ctx) ctx->thread_ctx_switch_wait_token =0 ;if (is_kernel_ctx) { - ctx->asid =HL_KERNEL_ASID_ID ;/* KMD gets ASID 0 */ + ctx->asid =HL_KERNEL_ASID_ID ;/* Kernel driver gets ASID 0 */ rc =hl_mmu_ctx_init (ctx);if (rc) {dev_err (hdev->dev,"Failed to init mmu ctx module\n" );
drivers/misc/habanalabs/goya/goya.c +11 -11
@@ -42,8 +42,8 @@* PQ, CQ and CP are not secured. * PQ, CB and the data are on the SRAM/DRAM. * -* Since QMAN DMA is secured, KMD is parsing the DMA CB: -* - KMD checks DMA pointer +* Since QMAN DMA is secured, the driver is parsing the DMA CB: +* - checks DMA pointer * - WREG, MSG_PROT are not allowed. * - MSG_LONG/SHORT are allowed. *
@@ -56,15 +56,15 @@* QMAN DMA: PQ, CQ and CP are secured. * MMU is set to bypass on the Secure props register of the QMAN. * The reasons we don't enable MMU for PQ, CQ and CP are: -* - PQ entry is in kernel address space and KMD doesn't map it. +* - PQ entry is in kernel address space and the driver doesn't map it. * - CP writes to MSIX register and to kernel address space (completion * queue). * -* DMA is not secured but because CP is secured, KMD still needs to parse the -* CB, but doesn't need to check the DMA addresses. +* DMA is not secured but because CP is secured, the driver still needs to parse +* the CB, but doesn't need to check the DMA addresses. * -* For QMAN DMA 0, DMA is also secured because only KMD uses this DMA and KMD -* doesn't map memory in MMU. +* For QMAN DMA 0, DMA is also secured because only the driver uses this DMA and +* the driver doesn't map memory in MMU. * * QMAN TPC/MME: PQ, CQ and CP aren't secured (no change from MMU disabled mode) *
@@ -336,18 +336,18 @@ void goya_get_fixed_properties(struct hl_device *hdev)for (i =0 ; i <NUMBER_OF_EXT_HW_QUEUES ; i++) { prop->hw_queues_props[i].type =QUEUE_TYPE_EXT ; - prop->hw_queues_props[i].kmd_only =0 ; + prop->hw_queues_props[i].driver_only =0 ; }for (; i <NUMBER_OF_EXT_HW_QUEUES +NUMBER_OF_CPU_HW_QUEUES ; i++) { prop->hw_queues_props[i].type =QUEUE_TYPE_CPU ; - prop->hw_queues_props[i].kmd_only =1 ; + prop->hw_queues_props[i].driver_only =1 ; }for (; i <NUMBER_OF_EXT_HW_QUEUES +NUMBER_OF_CPU_HW_QUEUES +NUMBER_OF_INT_HW_QUEUES ; i++) { prop->hw_queues_props[i].type =QUEUE_TYPE_INT ; - prop->hw_queues_props[i].kmd_only =0 ; + prop->hw_queues_props[i].driver_only =0 ; }for (; i <HL_MAX_QUEUES ; i++)
@@ -2853,7 +2853,7 @@ static int goya_send_job_on_qman0(struct hl_device *hdev, struct hl_cs_job *job)if (!hdev->asic_funcs->is_device_idle (hdev,NULL ,NULL )) {dev_err_ratelimited (hdev->dev, -"Can't send KMD job on QMAN0 because the device is not idle\n" ); +"Can't send driver job on QMAN0 because the device is not idle\n" );return -EBUSY ; }
drivers/misc/habanalabs/goya/goyaP.h +7 -7
@@ -70,19 +70,19 @@ MMU_PAGE_TABLES_SIZE)#define MMU_CACHE_MNG_ADDR (MMU_DRAM_DEFAULT_PAGE_ADDR + \ MMU_DRAM_DEFAULT_PAGE_SIZE) -#define DRAM_KMD_END_ADDR (MMU_CACHE_MNG_ADDR + \ +#define DRAM_DRIVER_END_ADDR (MMU_CACHE_MNG_ADDR + \ MMU_CACHE_MNG_SIZE)#define DRAM_BASE_ADDR_USER 0x20000000 -#if (DRAM_KMD_END_ADDR >DRAM_BASE_ADDR_USER ) -#error "KMD must reserve no more than 512MB" +#if (DRAM_DRIVER_END_ADDR >DRAM_BASE_ADDR_USER ) +#error "Driver must reserve no more than 512MB"#endif /* -* SRAM Memory Map for KMD +* SRAM Memory Map for Driver * -* KMD occupies KMD_SRAM_SIZE bytes from the start of SRAM. It is used for +* Driver occupies DRIVER_SRAM_SIZE bytes from the start of SRAM. It is used for * MME/TPC QMANs * */
@@ -108,10 +108,10 @@#define TPC7_QMAN_BASE_OFFSET (TPC6_QMAN_BASE_OFFSET + \ (TPC_QMAN_LENGTH * QMAN_PQ_ENTRY_SIZE)) -#define SRAM_KMD_RES_OFFSET (TPC7_QMAN_BASE_OFFSET + \ +#define SRAM_DRIVER_RES_OFFSET (TPC7_QMAN_BASE_OFFSET + \ (TPC_QMAN_LENGTH * QMAN_PQ_ENTRY_SIZE)) -#if (SRAM_KMD_RES_OFFSET >=GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START ) +#if (SRAM_DRIVER_RES_OFFSET >=GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START )#error "MME/TPC QMANs SRAM space exceeds limit"#endif
drivers/misc/habanalabs/habanalabs.h +16 -16
@@ -96,12 +96,12 @@ enum hl_queue_type {/** * struct hw_queue_properties - queue information. * @type: queue type. -* @kmd_only: true if only KMD is allowed to send a job to this queue, false -* otherwise. +* @driver_only: true if only the driver is allowed to send a job to this queue, +* false otherwise. */ struct hw_queue_properties {enum hl_queue_type type; -u8 kmd_only; +u8 driver_only; };/**
@@ -324,7 +324,7 @@ struct hl_cs_job;#define HL_EQ_LENGTH 64#define HL_EQ_SIZE_IN_BYTES (HL_EQ_LENGTH * HL_EQ_ENTRY_SIZE) -/* KMD <-> ArmCP shared memory size */ +/* Host <-> ArmCP shared memory size */ #define HL_CPU_ACCESSIBLE_MEM_SIZE SZ_2M/**
@@ -405,7 +405,7 @@ struct hl_cs_parser;/** * enum hl_pm_mng_profile - power management profile. -* @PM_AUTO: internal clock is set by KMD. +* @PM_AUTO: internal clock is set by the Linux driver. * @PM_MANUAL: internal clock is set by the user. * @PM_LAST: last power management type. */
@@ -613,7 +613,7 @@ struct hl_va_range {* descriptor (hl_vm_phys_pg_list or hl_userptr). * @mmu_phys_hash: holds a mapping from physical address to pgt_info structure. * @mmu_shadow_hash: holds a mapping from shadow address to pgt_info structure. -* @hpriv: pointer to the private (KMD) data of the process (fd). +* @hpriv: pointer to the private (Kernel Driver) data of the process (fd). * @hdev: pointer to the device structure. * @refcount: reference counter for the context. Context is released only when * this hits 0l. It is incremented on CS and CS_WAIT.
@@ -1185,19 +1185,19 @@ struct hl_device_idle_busy_ts {* @completion_queue: array of hl_cq. * @cq_wq: work queue of completion queues for executing work in process context * @eq_wq: work queue of event queue for executing work in process context. -* @kernel_ctx: KMD context structure. +* @kernel_ctx: Kernel driver context structure. * @kernel_queues: array of hl_hw_queue. * @hw_queues_mirror_list: CS mirror list for TDR. * @hw_queues_mirror_lock: protects hw_queues_mirror_list. * @kernel_cb_mgr: command buffer manager for creating/destroying/handling CGs. * @event_queue: event queue for IRQ from ArmCP. * @dma_pool: DMA pool for small allocations. -* @cpu_accessible_dma_mem: KMD <-> ArmCP shared memory CPU address. -* @cpu_accessible_dma_address: KMD <-> ArmCP shared memory DMA address. -* @cpu_accessible_dma_pool: KMD <-> ArmCP shared memory pool. +* @cpu_accessible_dma_mem: Host <-> ArmCP shared memory CPU address. +* @cpu_accessible_dma_address: Host <-> ArmCP shared memory DMA address. +* @cpu_accessible_dma_pool: Host <-> ArmCP shared memory pool. * @asid_bitmap: holds used/available ASIDs. * @asid_mutex: protects asid_bitmap. -* @send_cpu_message_lock: enforces only one message in KMD <-> ArmCP queue. +* @send_cpu_message_lock: enforces only one message in Host <-> ArmCP queue. * @debug_lock: protects critical section of setting debug mode for device * @asic_prop: ASIC specific immutable properties. * @asic_funcs: ASIC specific functions.
@@ -1221,16 +1221,16 @@ struct hl_device_idle_busy_ts {* @dram_used_mem: current DRAM memory consumption. * @timeout_jiffies: device CS timeout value. * @max_power: the max power of the device, as configured by the sysadmin. This -* value is saved so in case of hard-reset, KMD will restore this -* value and update the F/W after the re-initialization +* value is saved so in case of hard-reset, the driver will restore +* this value and update the F/W after the re-initialization * @in_reset: is device in reset flow. * @curr_pll_profile: current PLL profile. * @cs_active_cnt: number of active command submissions on this device (active * means already in H/W queues) -* @major: habanalabs KMD major. +* @major: habanalabs kernel driver major. * @high_pll: high PLL profile frequency. -* @soft_reset_cnt: number of soft reset since KMD loading. -* @hard_reset_cnt: number of hard reset since KMD loading. +* @soft_reset_cnt: number of soft reset since the driver was loaded. +* @hard_reset_cnt: number of hard reset since the driver was loaded. * @idle_busy_ts_idx: index of current entry in idle_busy_ts_arr * @id: device minor. * @id_control: minor of the control device
drivers/misc/habanalabs/include/armcp_if.h +36 -34
113 lines not on this page · raw message
include/uapi/misc/habanalabs.h +11 -11
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note * -* Copyright 2016-2018 HabanaLabs, Ltd. +* Copyright 2016-2019 HabanaLabs, Ltd. * All Rights Reserved. * */
@@ -329,12 +329,12 @@ struct hl_mem_in {struct {/* * Requested virtual address of mapped memory. -* KMD will try to map the requested region to this -* hint address, as long as the address is valid and -* not already mapped. The user should check the +* The driver will try to map the requested region to +* this hint address, as long as the address is valid +* and not already mapped. The user should check the * returned address of the IOCTL to make sure he got -* the hint address. Passing 0 here means that KMD -* will choose the address itself. +* the hint address. Passing 0 here means that the +* driver will choose the address itself. */ __u64 hint_addr;/* Handle returned from HL_MEM_OP_ALLOC */
@@ -347,12 +347,12 @@ struct hl_mem_in {__u64 host_virt_addr;/* * Requested virtual address of mapped memory. -* KMD will try to map the requested region to this -* hint address, as long as the address is valid and -* not already mapped. The user should check the +* The driver will try to map the requested region to +* this hint address, as long as the address is valid +* and not already mapped. The user should check the * returned address of the IOCTL to make sure he got -* the hint address. Passing 0 here means that KMD -* will choose the address itself. +* the hint address. Passing 0 here means that the +* driver will choose the address itself. */ __u64 hint_addr;/* Size of allocated host memory */
Signature · 1 line
2.17.1
PATCH 2/2 habanalabs: show correct id in error print
If the initialization of a device failed, the driver prints an error message with the id of the device. The device index on the file system is that id divided by 2.
--- drivers/misc/habanalabs/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/device.c +2 -2
@@ -1290,10 +1290,10 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)if (hdev->pdev)dev_err (&hdev->pdev->dev,"Failed to initialize hl%d. Device is NOT usable !\n" , - hdev->id); + hdev->id /2 );else pr_err ("Failed to initialize hl%d. Device is NOT usable !\n" , - hdev->id); + hdev->id /2 );return rc; }
Signature · 1 line
2.17.1
RE: [PATCH 2/2] habanalabs: show correct id in error print
From: Oded Gabbay <[email protected]>
Sent: Monday, 2 September 2019 10:50
Quoted 5 lines
If the initialization of a device failed, the driver prints an error message with the id of the device. The device index on the file system is that id divided by 2.
Signed-off-by Oded Gabbay <[email protected]>
From: Oded Gabbay <[email protected]>
Sent: Monday, 2 September 2019 10:50
Quoted 5 lines
We want to stop using the acronym KMD. Therefore, replace all locations (except for register names we can't modify) where KMD is written to other terms such as "Linux kernel driver" or "Host kernel driver", etc.
Signed-off-by Oded Gabbay <[email protected]>