Skip to content

Commit 4c172bb

Browse files
committed
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. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Reviewed-by: Omer Shpigelman <oshpigelman@habana.ai>
1 parent 0996bd1 commit 4c172bb

9 files changed

Lines changed: 88 additions & 84 deletions

File tree

‎drivers/misc/habanalabs/asid.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int hl_asid_init(struct hl_device *hdev)
1818

1919
mutex_init(&hdev->asid_mutex);
2020

21-
/* ASID 0 is reserved for KMD and device CPU */
21+
/* ASID 0 is reserved for the kernel driver and device CPU */
2222
set_bit(0, hdev->asid_bitmap);
2323

2424
return 0;

‎drivers/misc/habanalabs/command_buffer.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ struct hl_cb *hl_cb_kernel_create(struct hl_device *hdev, u32 cb_size)
397397
rc = hl_cb_create(hdev, &hdev->kernel_cb_mgr, cb_size, &cb_handle,
398398
HL_KERNEL_ASID_ID);
399399
if (rc) {
400-
dev_err(hdev->dev, "Failed to allocate CB for KMD %d\n", rc);
400+
dev_err(hdev->dev,
401+
"Failed to allocate CB for the kernel driver %d\n", rc);
401402
return NULL;
402403
}
403404

‎drivers/misc/habanalabs/command_submission.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ static struct hl_cb *validate_queue_index(struct hl_device *hdev,
409409
return NULL;
410410
}
411411

412-
if (hw_queue_prop->kmd_only) {
413-
dev_err(hdev->dev, "Queue index %d is restricted for KMD\n",
412+
if (hw_queue_prop->driver_only) {
413+
dev_err(hdev->dev,
414+
"Queue index %d is restricted for the kernel driver\n",
414415
chunk->queue_index);
415416
return NULL;
416417
} else if (hw_queue_prop->type == QUEUE_TYPE_INT) {

‎drivers/misc/habanalabs/context.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ int hl_ctx_init(struct hl_device *hdev, struct hl_ctx *ctx, bool is_kernel_ctx)
128128
ctx->thread_ctx_switch_wait_token = 0;
129129

130130
if (is_kernel_ctx) {
131-
ctx->asid = HL_KERNEL_ASID_ID; /* KMD gets ASID 0 */
131+
ctx->asid = HL_KERNEL_ASID_ID; /* Kernel driver gets ASID 0 */
132132
rc = hl_mmu_ctx_init(ctx);
133133
if (rc) {
134134
dev_err(hdev->dev, "Failed to init mmu ctx module\n");

‎drivers/misc/habanalabs/goya/goya.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
* PQ, CQ and CP are not secured.
4343
* PQ, CB and the data are on the SRAM/DRAM.
4444
*
45-
* Since QMAN DMA is secured, KMD is parsing the DMA CB:
46-
* - KMD checks DMA pointer
45+
* Since QMAN DMA is secured, the driver is parsing the DMA CB:
46+
* - checks DMA pointer
4747
* - WREG, MSG_PROT are not allowed.
4848
* - MSG_LONG/SHORT are allowed.
4949
*
@@ -56,15 +56,15 @@
5656
* QMAN DMA: PQ, CQ and CP are secured.
5757
* MMU is set to bypass on the Secure props register of the QMAN.
5858
* The reasons we don't enable MMU for PQ, CQ and CP are:
59-
* - PQ entry is in kernel address space and KMD doesn't map it.
59+
* - PQ entry is in kernel address space and the driver doesn't map it.
6060
* - CP writes to MSIX register and to kernel address space (completion
6161
* queue).
6262
*
63-
* DMA is not secured but because CP is secured, KMD still needs to parse the
64-
* CB, but doesn't need to check the DMA addresses.
63+
* DMA is not secured but because CP is secured, the driver still needs to parse
64+
* the CB, but doesn't need to check the DMA addresses.
6565
*
66-
* For QMAN DMA 0, DMA is also secured because only KMD uses this DMA and KMD
67-
* doesn't map memory in MMU.
66+
* For QMAN DMA 0, DMA is also secured because only the driver uses this DMA and
67+
* the driver doesn't map memory in MMU.
6868
*
6969
* QMAN TPC/MME: PQ, CQ and CP aren't secured (no change from MMU disabled mode)
7070
*
@@ -336,18 +336,18 @@ void goya_get_fixed_properties(struct hl_device *hdev)
336336

337337
for (i = 0 ; i < NUMBER_OF_EXT_HW_QUEUES ; i++) {
338338
prop->hw_queues_props[i].type = QUEUE_TYPE_EXT;
339-
prop->hw_queues_props[i].kmd_only = 0;
339+
prop->hw_queues_props[i].driver_only = 0;
340340
}
341341

342342
for (; i < NUMBER_OF_EXT_HW_QUEUES + NUMBER_OF_CPU_HW_QUEUES ; i++) {
343343
prop->hw_queues_props[i].type = QUEUE_TYPE_CPU;
344-
prop->hw_queues_props[i].kmd_only = 1;
344+
prop->hw_queues_props[i].driver_only = 1;
345345
}
346346

347347
for (; i < NUMBER_OF_EXT_HW_QUEUES + NUMBER_OF_CPU_HW_QUEUES +
348348
NUMBER_OF_INT_HW_QUEUES; i++) {
349349
prop->hw_queues_props[i].type = QUEUE_TYPE_INT;
350-
prop->hw_queues_props[i].kmd_only = 0;
350+
prop->hw_queues_props[i].driver_only = 0;
351351
}
352352

353353
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)
28532853

28542854
if (!hdev->asic_funcs->is_device_idle(hdev, NULL, NULL)) {
28552855
dev_err_ratelimited(hdev->dev,
2856-
"Can't send KMD job on QMAN0 because the device is not idle\n");
2856+
"Can't send driver job on QMAN0 because the device is not idle\n");
28572857
return -EBUSY;
28582858
}
28592859

‎drivers/misc/habanalabs/goya/goyaP.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@
7070
MMU_PAGE_TABLES_SIZE)
7171
#define MMU_CACHE_MNG_ADDR (MMU_DRAM_DEFAULT_PAGE_ADDR + \
7272
MMU_DRAM_DEFAULT_PAGE_SIZE)
73-
#define DRAM_KMD_END_ADDR (MMU_CACHE_MNG_ADDR + \
73+
#define DRAM_DRIVER_END_ADDR (MMU_CACHE_MNG_ADDR + \
7474
MMU_CACHE_MNG_SIZE)
7575

7676
#define DRAM_BASE_ADDR_USER 0x20000000
7777

78-
#if (DRAM_KMD_END_ADDR > DRAM_BASE_ADDR_USER)
79-
#error "KMD must reserve no more than 512MB"
78+
#if (DRAM_DRIVER_END_ADDR > DRAM_BASE_ADDR_USER)
79+
#error "Driver must reserve no more than 512MB"
8080
#endif
8181

8282
/*
83-
* SRAM Memory Map for KMD
83+
* SRAM Memory Map for Driver
8484
*
85-
* KMD occupies KMD_SRAM_SIZE bytes from the start of SRAM. It is used for
85+
* Driver occupies DRIVER_SRAM_SIZE bytes from the start of SRAM. It is used for
8686
* MME/TPC QMANs
8787
*
8888
*/
@@ -108,10 +108,10 @@
108108
#define TPC7_QMAN_BASE_OFFSET (TPC6_QMAN_BASE_OFFSET + \
109109
(TPC_QMAN_LENGTH * QMAN_PQ_ENTRY_SIZE))
110110

111-
#define SRAM_KMD_RES_OFFSET (TPC7_QMAN_BASE_OFFSET + \
111+
#define SRAM_DRIVER_RES_OFFSET (TPC7_QMAN_BASE_OFFSET + \
112112
(TPC_QMAN_LENGTH * QMAN_PQ_ENTRY_SIZE))
113113

114-
#if (SRAM_KMD_RES_OFFSET >= GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START)
114+
#if (SRAM_DRIVER_RES_OFFSET >= GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START)
115115
#error "MME/TPC QMANs SRAM space exceeds limit"
116116
#endif
117117

‎drivers/misc/habanalabs/habanalabs.h‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ enum hl_queue_type {
9696
/**
9797
* struct hw_queue_properties - queue information.
9898
* @type: queue type.
99-
* @kmd_only: true if only KMD is allowed to send a job to this queue, false
100-
* otherwise.
99+
* @driver_only: true if only the driver is allowed to send a job to this queue,
100+
* false otherwise.
101101
*/
102102
struct hw_queue_properties {
103103
enum hl_queue_type type;
104-
u8 kmd_only;
104+
u8 driver_only;
105105
};
106106

107107
/**
@@ -324,7 +324,7 @@ struct hl_cs_job;
324324
#define HL_EQ_LENGTH 64
325325
#define HL_EQ_SIZE_IN_BYTES (HL_EQ_LENGTH * HL_EQ_ENTRY_SIZE)
326326

327-
/* KMD <-> ArmCP shared memory size */
327+
/* Host <-> ArmCP shared memory size */
328328
#define HL_CPU_ACCESSIBLE_MEM_SIZE SZ_2M
329329

330330
/**
@@ -405,7 +405,7 @@ struct hl_cs_parser;
405405

406406
/**
407407
* enum hl_pm_mng_profile - power management profile.
408-
* @PM_AUTO: internal clock is set by KMD.
408+
* @PM_AUTO: internal clock is set by the Linux driver.
409409
* @PM_MANUAL: internal clock is set by the user.
410410
* @PM_LAST: last power management type.
411411
*/
@@ -613,7 +613,7 @@ struct hl_va_range {
613613
* descriptor (hl_vm_phys_pg_list or hl_userptr).
614614
* @mmu_phys_hash: holds a mapping from physical address to pgt_info structure.
615615
* @mmu_shadow_hash: holds a mapping from shadow address to pgt_info structure.
616-
* @hpriv: pointer to the private (KMD) data of the process (fd).
616+
* @hpriv: pointer to the private (Kernel Driver) data of the process (fd).
617617
* @hdev: pointer to the device structure.
618618
* @refcount: reference counter for the context. Context is released only when
619619
* this hits 0l. It is incremented on CS and CS_WAIT.
@@ -1185,19 +1185,19 @@ struct hl_device_idle_busy_ts {
11851185
* @completion_queue: array of hl_cq.
11861186
* @cq_wq: work queue of completion queues for executing work in process context
11871187
* @eq_wq: work queue of event queue for executing work in process context.
1188-
* @kernel_ctx: KMD context structure.
1188+
* @kernel_ctx: Kernel driver context structure.
11891189
* @kernel_queues: array of hl_hw_queue.
11901190
* @hw_queues_mirror_list: CS mirror list for TDR.
11911191
* @hw_queues_mirror_lock: protects hw_queues_mirror_list.
11921192
* @kernel_cb_mgr: command buffer manager for creating/destroying/handling CGs.
11931193
* @event_queue: event queue for IRQ from ArmCP.
11941194
* @dma_pool: DMA pool for small allocations.
1195-
* @cpu_accessible_dma_mem: KMD <-> ArmCP shared memory CPU address.
1196-
* @cpu_accessible_dma_address: KMD <-> ArmCP shared memory DMA address.
1197-
* @cpu_accessible_dma_pool: KMD <-> ArmCP shared memory pool.
1195+
* @cpu_accessible_dma_mem: Host <-> ArmCP shared memory CPU address.
1196+
* @cpu_accessible_dma_address: Host <-> ArmCP shared memory DMA address.
1197+
* @cpu_accessible_dma_pool: Host <-> ArmCP shared memory pool.
11981198
* @asid_bitmap: holds used/available ASIDs.
11991199
* @asid_mutex: protects asid_bitmap.
1200-
* @send_cpu_message_lock: enforces only one message in KMD <-> ArmCP queue.
1200+
* @send_cpu_message_lock: enforces only one message in Host <-> ArmCP queue.
12011201
* @debug_lock: protects critical section of setting debug mode for device
12021202
* @asic_prop: ASIC specific immutable properties.
12031203
* @asic_funcs: ASIC specific functions.
@@ -1221,16 +1221,16 @@ struct hl_device_idle_busy_ts {
12211221
* @dram_used_mem: current DRAM memory consumption.
12221222
* @timeout_jiffies: device CS timeout value.
12231223
* @max_power: the max power of the device, as configured by the sysadmin. This
1224-
* value is saved so in case of hard-reset, KMD will restore this
1225-
* value and update the F/W after the re-initialization
1224+
* value is saved so in case of hard-reset, the driver will restore
1225+
* this value and update the F/W after the re-initialization
12261226
* @in_reset: is device in reset flow.
12271227
* @curr_pll_profile: current PLL profile.
12281228
* @cs_active_cnt: number of active command submissions on this device (active
12291229
* means already in H/W queues)
1230-
* @major: habanalabs KMD major.
1230+
* @major: habanalabs kernel driver major.
12311231
* @high_pll: high PLL profile frequency.
1232-
* @soft_reset_cnt: number of soft reset since KMD loading.
1233-
* @hard_reset_cnt: number of hard reset since KMD loading.
1232+
* @soft_reset_cnt: number of soft reset since the driver was loaded.
1233+
* @hard_reset_cnt: number of hard reset since the driver was loaded.
12341234
* @idle_busy_ts_idx: index of current entry in idle_busy_ts_arr
12351235
* @id: device minor.
12361236
* @id_control: minor of the control device

‎drivers/misc/habanalabs/include/armcp_if.h‎

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,34 @@ enum pq_init_status {
4141
/*
4242
* ArmCP Primary Queue Packets
4343
*
44-
* During normal operation, KMD needs to send various messages to ArmCP,
45-
* usually either to SET some value into a H/W periphery or to GET the current
46-
* value of some H/W periphery. For example, SET the frequency of MME/TPC and
47-
* GET the value of the thermal sensor.
48-
*
49-
* These messages can be initiated either by the User application or by KMD
50-
* itself, e.g. power management code. In either case, the communication from
51-
* KMD to ArmCP will *always* be in synchronous mode, meaning that KMD will
52-
* send a single message and poll until the message was acknowledged and the
53-
* results are ready (if results are needed).
54-
*
55-
* This means that only a single message can be sent at a time and KMD must
56-
* wait for its result before sending the next message. Having said that,
57-
* because these are control messages which are sent in a relatively low
44+
* During normal operation, the host's kernel driver needs to send various
45+
* messages to ArmCP, usually either to SET some value into a H/W periphery or
46+
* to GET the current value of some H/W periphery. For example, SET the
47+
* frequency of MME/TPC and GET the value of the thermal sensor.
48+
*
49+
* These messages can be initiated either by the User application or by the
50+
* host's driver itself, e.g. power management code. In either case, the
51+
* communication from the host's driver to ArmCP will *always* be in
52+
* synchronous mode, meaning that the host will send a single message and poll
53+
* until the message was acknowledged and the results are ready (if results are
54+
* needed).
55+
*
56+
* This means that only a single message can be sent at a time and the host's
57+
* driver must wait for its result before sending the next message. Having said
58+
* that, because these are control messages which are sent in a relatively low
5859
* frequency, this limitation seems acceptable. It's important to note that
5960
* in case of multiple devices, messages to different devices *can* be sent
6061
* at the same time.
6162
*
6263
* The message, inputs/outputs (if relevant) and fence object will be located
63-
* on the device DDR at an address that will be determined by KMD. During
64-
* device initialization phase, KMD will pass to ArmCP that address. Most of
65-
* the message types will contain inputs/outputs inside the message itself.
66-
* The common part of each message will contain the opcode of the message (its
67-
* type) and a field representing a fence object.
68-
*
69-
* When KMD wishes to send a message to ArmCP, it will write the message
70-
* contents to the device DDR, clear the fence object and then write the
64+
* on the device DDR at an address that will be determined by the host's driver.
65+
* During device initialization phase, the host will pass to ArmCP that address.
66+
* Most of the message types will contain inputs/outputs inside the message
67+
* itself. The common part of each message will contain the opcode of the
68+
* message (its type) and a field representing a fence object.
69+
*
70+
* When the host's driver wishes to send a message to ArmCP, it will write the
71+
* message contents to the device DDR, clear the fence object and then write the
7172
* value 484 to the mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR register to issue
7273
* the 484 interrupt-id to the ARM core.
7374
*
@@ -78,12 +79,13 @@ enum pq_init_status {
7879
* device DDR and then write to the fence object. If an error occurred, ArmCP
7980
* will fill the rc field with the right error code.
8081
*
81-
* In the meantime, KMD will poll on the fence object. Once KMD sees that the
82-
* fence object is signaled, it will read the results from the device DDR
83-
* (if relevant) and resume the code execution in KMD.
82+
* In the meantime, the host's driver will poll on the fence object. Once the
83+
* host sees that the fence object is signaled, it will read the results from
84+
* the device DDR (if relevant) and resume the code execution in the host's
85+
* driver.
8486
*
8587
* To use QMAN packets, the opcode must be the QMAN opcode, shifted by 8
86-
* so the value being put by the KMD matches the value read by ArmCP
88+
* so the value being put by the host's driver matches the value read by ArmCP
8789
*
8890
* Non-QMAN packets should be limited to values 1 through (2^8 - 1)
8991
*
@@ -148,9 +150,9 @@ enum pq_init_status {
148150
*
149151
* ARMCP_PACKET_INFO_GET -
150152
* Fetch information from the device as specified in the packet's
151-
* structure. KMD passes the max size it allows the ArmCP to write to
152-
* the structure, to prevent data corruption in case of mismatched
153-
* KMD/FW versions.
153+
* structure. The host's driver passes the max size it allows the ArmCP to
154+
* write to the structure, to prevent data corruption in case of
155+
* mismatched driver/FW versions.
154156
*
155157
* ARMCP_PACKET_FLASH_PROGRAM_REMOVED - this packet was removed
156158
*
@@ -183,9 +185,9 @@ enum pq_init_status {
183185
* ARMCP_PACKET_EEPROM_DATA_GET -
184186
* Get EEPROM data from the ArmCP kernel. The buffer is specified in the
185187
* addr field. The CPU will put the returned data size in the result
186-
* field. In addition, KMD passes the max size it allows the ArmCP to
187-
* write to the structure, to prevent data corruption in case of
188-
* mismatched KMD/FW versions.
188+
* field. In addition, the host's driver passes the max size it allows the
189+
* ArmCP to write to the structure, to prevent data corruption in case of
190+
* mismatched driver/FW versions.
189191
*
190192
*/
191193

@@ -231,7 +233,7 @@ struct armcp_packet {
231233

232234
__le32 ctl;
233235

234-
__le32 fence; /* Signal to KMD that message is completed */
236+
__le32 fence; /* Signal to host that message is completed */
235237

236238
union {
237239
struct {/* For temperature/current/voltage/fan/pwm get/set */
@@ -320,7 +322,7 @@ struct armcp_sensor {
320322
};
321323

322324
/**
323-
* struct armcp_info - host driver's necessary info from ArmCP.
325+
* struct armcp_info - Info from ArmCP that is necessary to the host's driver
324326
* @sensors: available sensors description.
325327
* @kernel_version: ArmCP linux kernel version.
326328
* @reserved: reserved field.

‎include/uapi/misc/habanalabs.h‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
22
*
3-
* Copyright 2016-2018 HabanaLabs, Ltd.
3+
* Copyright 2016-2019 HabanaLabs, Ltd.
44
* All Rights Reserved.
55
*
66
*/
@@ -329,12 +329,12 @@ struct hl_mem_in {
329329
struct {
330330
/*
331331
* Requested virtual address of mapped memory.
332-
* KMD will try to map the requested region to this
333-
* hint address, as long as the address is valid and
334-
* not already mapped. The user should check the
332+
* The driver will try to map the requested region to
333+
* this hint address, as long as the address is valid
334+
* and not already mapped. The user should check the
335335
* returned address of the IOCTL to make sure he got
336-
* the hint address. Passing 0 here means that KMD
337-
* will choose the address itself.
336+
* the hint address. Passing 0 here means that the
337+
* driver will choose the address itself.
338338
*/
339339
__u64 hint_addr;
340340
/* Handle returned from HL_MEM_OP_ALLOC */
@@ -347,12 +347,12 @@ struct hl_mem_in {
347347
__u64 host_virt_addr;
348348
/*
349349
* Requested virtual address of mapped memory.
350-
* KMD will try to map the requested region to this
351-
* hint address, as long as the address is valid and
352-
* not already mapped. The user should check the
350+
* The driver will try to map the requested region to
351+
* this hint address, as long as the address is valid
352+
* and not already mapped. The user should check the
353353
* returned address of the IOCTL to make sure he got
354-
* the hint address. Passing 0 here means that KMD
355-
* will choose the address itself.
354+
* the hint address. Passing 0 here means that the
355+
* driver will choose the address itself.
356356
*/
357357
__u64 hint_addr;
358358
/* Size of allocated host memory */

0 commit comments

Comments
 (0)