Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / crypto / ccp / sev-dev.h
blobdd5c4fe82914c7341673c95b2b2800c7bf71c008
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * AMD Platform Security Processor (PSP) interface driver
5 * Copyright (C) 2017-2019 Advanced Micro Devices, Inc.
7 * Author: Brijesh Singh <brijesh.singh@amd.com>
8 */
10 #ifndef __SEV_DEV_H__
11 #define __SEV_DEV_H__
13 #include <linux/device.h>
14 #include <linux/spinlock.h>
15 #include <linux/mutex.h>
16 #include <linux/list.h>
17 #include <linux/wait.h>
18 #include <linux/dmapool.h>
19 #include <linux/hw_random.h>
20 #include <linux/bitops.h>
21 #include <linux/interrupt.h>
22 #include <linux/irqreturn.h>
23 #include <linux/dmaengine.h>
24 #include <linux/psp-sev.h>
25 #include <linux/miscdevice.h>
26 #include <linux/capability.h>
28 #define SEV_CMD_COMPLETE BIT(1)
29 #define SEV_CMDRESP_CMD_SHIFT 16
30 #define SEV_CMDRESP_IOC BIT(0)
32 struct sev_misc_dev {
33 struct kref refcount;
34 struct miscdevice misc;
37 struct sev_device {
38 struct device *dev;
39 struct psp_device *psp;
41 void __iomem *io_regs;
43 struct sev_vdata *vdata;
45 int state;
46 unsigned int int_rcvd;
47 wait_queue_head_t int_queue;
48 struct sev_misc_dev *misc;
49 struct sev_user_data_status status_cmd_buf;
50 struct sev_data_init init_cmd_buf;
52 u8 api_major;
53 u8 api_minor;
54 u8 build;
57 int sev_dev_init(struct psp_device *psp);
58 void sev_dev_destroy(struct psp_device *psp);
60 void sev_pci_init(void);
61 void sev_pci_exit(void);
63 #endif /* __SEV_DEV_H */