Path: blob/master/drivers/crypto/marvell/octeontx/otx_cptvf.h
26285 views
/* SPDX-License-Identifier: GPL-2.01* Marvell OcteonTX CPT driver2*3* Copyright (C) 2019 Marvell International Ltd.4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/910#ifndef __OTX_CPTVF_H11#define __OTX_CPTVF_H1213#include <linux/list.h>14#include <linux/interrupt.h>15#include <linux/device.h>16#include "otx_cpt_common.h"17#include "otx_cptvf_reqmgr.h"1819/* Flags to indicate the features supported */20#define OTX_CPT_FLAG_DEVICE_READY BIT(1)21#define otx_cpt_device_ready(cpt) ((cpt)->flags & OTX_CPT_FLAG_DEVICE_READY)22/* Default command queue length */23#define OTX_CPT_CMD_QLEN (4*2046)24#define OTX_CPT_CMD_QCHUNK_SIZE 102325#define OTX_CPT_NUM_QS_PER_VF 12627struct otx_cpt_cmd_chunk {28u8 *head;29dma_addr_t dma_addr;30u32 size; /* Chunk size, max OTX_CPT_INST_CHUNK_MAX_SIZE */31struct list_head nextchunk;32};3334struct otx_cpt_cmd_queue {35u32 idx; /* Command queue host write idx */36u32 num_chunks; /* Number of command chunks */37struct otx_cpt_cmd_chunk *qhead;/*38* Command queue head, instructions39* are inserted here40*/41struct otx_cpt_cmd_chunk *base;42struct list_head chead;43};4445struct otx_cpt_cmd_qinfo {46u32 qchunksize; /* Command queue chunk size */47struct otx_cpt_cmd_queue queue[OTX_CPT_NUM_QS_PER_VF];48};4950struct otx_cpt_pending_qinfo {51u32 num_queues; /* Number of queues supported */52struct otx_cpt_pending_queue queue[OTX_CPT_NUM_QS_PER_VF];53};5455#define for_each_pending_queue(qinfo, q, i) \56for (i = 0, q = &qinfo->queue[i]; i < qinfo->num_queues; i++, \57q = &qinfo->queue[i])5859struct otx_cptvf_wqe {60struct tasklet_struct twork;61struct otx_cptvf *cptvf;62};6364struct otx_cptvf_wqe_info {65struct otx_cptvf_wqe vq_wqe[OTX_CPT_NUM_QS_PER_VF];66};6768struct otx_cptvf {69u16 flags; /* Flags to hold device status bits */70u8 vfid; /* Device Index 0...OTX_CPT_MAX_VF_NUM */71u8 num_vfs; /* Number of enabled VFs */72u8 vftype; /* VF type of SE_TYPE(2) or AE_TYPE(1) */73u8 vfgrp; /* VF group (0 - 8) */74u8 node; /* Operating node: Bits (46:44) in BAR0 address */75u8 priority; /*76* VF priority ring: 1-High proirity round77* robin ring;0-Low priority round robin ring;78*/79struct pci_dev *pdev; /* Pci device handle */80void __iomem *reg_base; /* Register start address */81void *wqe_info; /* BH worker info */82/* MSI-X */83cpumask_var_t affinity_mask[OTX_CPT_VF_MSIX_VECTORS];84/* Command and Pending queues */85u32 qsize;86u32 num_queues;87struct otx_cpt_cmd_qinfo cqinfo; /* Command queue information */88struct otx_cpt_pending_qinfo pqinfo; /* Pending queue information */89/* VF-PF mailbox communication */90bool pf_acked;91bool pf_nacked;92};9394int otx_cptvf_send_vf_up(struct otx_cptvf *cptvf);95int otx_cptvf_send_vf_down(struct otx_cptvf *cptvf);96int otx_cptvf_send_vf_to_grp_msg(struct otx_cptvf *cptvf, int group);97int otx_cptvf_send_vf_priority_msg(struct otx_cptvf *cptvf);98int otx_cptvf_send_vq_size_msg(struct otx_cptvf *cptvf);99int otx_cptvf_check_pf_ready(struct otx_cptvf *cptvf);100void otx_cptvf_handle_mbox_intr(struct otx_cptvf *cptvf);101void otx_cptvf_write_vq_doorbell(struct otx_cptvf *cptvf, u32 val);102103#endif /* __OTX_CPTVF_H */104105106