2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-25 13:43:55 +08:00
linux-next/drivers/misc/habanalabs/include/qman_if.h
Oded Gabbay 9494a8dd8d habanalabs: add h/w queues module
This patch adds the H/W queues module and the code to initialize Goya's
various compute and DMA engines and their queues.

Goya has 5 DMA channels, 8 TPC engines and a single MME engine. For each
channel/engine, there is a H/W queue logic which is used to pass commands
from the user to the H/W. That logic is called QMAN.

There are two types of QMANs: external and internal. The DMA QMANs are
considered external while the TPC and MME QMANs are considered internal.
For each external queue there is a completion queue, which is located on
the Host memory.

The differences between external and internal QMANs are:

1. The location of the queue's memory. External QMANs are located on the
   Host memory while internal QMANs are located on the on-chip memory.

2. The external QMAN write an entry to a completion queue and sends an
   MSI-X interrupt upon completion of a command buffer that was given to
   it. The internal QMAN doesn't do that.

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-18 09:46:45 +01:00

57 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0
*
* Copyright 2016-2018 HabanaLabs, Ltd.
* All Rights Reserved.
*
*/
#ifndef QMAN_IF_H
#define QMAN_IF_H
#include <linux/types.h>
/*
* PRIMARY QUEUE
*/
struct hl_bd {
__le64 ptr;
__le32 len;
__le32 ctl;
};
#define HL_BD_SIZE sizeof(struct hl_bd)
/*
* BD_CTL_REPEAT_VALID tells the CP whether the repeat field in the BD CTL is
* valid. 1 means the repeat field is valid, 0 means not-valid,
* i.e. repeat == 1
*/
#define BD_CTL_REPEAT_VALID_SHIFT 24
#define BD_CTL_REPEAT_VALID_MASK 0x01000000
#define BD_CTL_SHADOW_INDEX_SHIFT 0
#define BD_CTL_SHADOW_INDEX_MASK 0x00000FFF
/*
* COMPLETION QUEUE
*/
struct hl_cq_entry {
__le32 data;
};
#define HL_CQ_ENTRY_SIZE sizeof(struct hl_cq_entry)
#define CQ_ENTRY_READY_SHIFT 31
#define CQ_ENTRY_READY_MASK 0x80000000
#define CQ_ENTRY_SHADOW_INDEX_VALID_SHIFT 30
#define CQ_ENTRY_SHADOW_INDEX_VALID_MASK 0x40000000
#define CQ_ENTRY_SHADOW_INDEX_SHIFT BD_CTL_SHADOW_INDEX_SHIFT
#define CQ_ENTRY_SHADOW_INDEX_MASK BD_CTL_SHADOW_INDEX_MASK
#endif /* QMAN_IF_H */