sev-dev.h (9b67d08dbc1751ab15d972a63a4d9132e7e7442f) sev-dev.h (b93566f1bb54e02a1ff1e3b4782073be1886744e)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * AMD Platform Security Processor (PSP) interface driver
4 *
5 * Copyright (C) 2017-2019 Advanced Micro Devices, Inc.
6 *
7 * Author: Brijesh Singh <brijesh.singh@amd.com>
8 */

--- 11 unchanged lines hidden (view full) ---

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>
27
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * AMD Platform Security Processor (PSP) interface driver
4 *
5 * Copyright (C) 2017-2019 Advanced Micro Devices, Inc.
6 *
7 * Author: Brijesh Singh <brijesh.singh@amd.com>
8 */

--- 11 unchanged lines hidden (view full) ---

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>
27
28#include "sp-dev.h"
28#define SEV_CMD_COMPLETE BIT(1)
29#define SEV_CMDRESP_CMD_SHIFT 16
30#define SEV_CMDRESP_IOC BIT(0)
29
31
30#define PSP_CMD_COMPLETE BIT(1)
31
32#define PSP_CMDRESP_CMD_SHIFT 16
33#define PSP_CMDRESP_IOC BIT(0)
34#define PSP_CMDRESP_RESP BIT(31)
35#define PSP_CMDRESP_ERR_MASK 0xffff
36
37#define MAX_PSP_NAME_LEN 16
38
39struct sev_misc_dev {
40 struct kref refcount;
41 struct miscdevice misc;
42};
43
32struct sev_misc_dev {
33 struct kref refcount;
34 struct miscdevice misc;
35};
36
44struct psp_device {
45 struct list_head entry;
46
47 struct psp_vdata *vdata;
48 char name[MAX_PSP_NAME_LEN];
49
37struct sev_device {
50 struct device *dev;
38 struct device *dev;
51 struct sp_device *sp;
39 struct psp_device *psp;
52
53 void __iomem *io_regs;
54
40
41 void __iomem *io_regs;
42
55 int sev_state;
56 unsigned int sev_int_rcvd;
57 wait_queue_head_t sev_int_queue;
58 struct sev_misc_dev *sev_misc;
43 int state;
44 unsigned int int_rcvd;
45 wait_queue_head_t int_queue;
46 struct sev_misc_dev *misc;
59 struct sev_user_data_status status_cmd_buf;
60 struct sev_data_init init_cmd_buf;
61
62 u8 api_major;
63 u8 api_minor;
64 u8 build;
65};
66
47 struct sev_user_data_status status_cmd_buf;
48 struct sev_data_init init_cmd_buf;
49
50 u8 api_major;
51 u8 api_minor;
52 u8 build;
53};
54
55int sev_dev_init(struct psp_device *psp);
56void sev_dev_destroy(struct psp_device *psp);
57
58void sev_pci_init(void);
59void sev_pci_exit(void);
60
67#endif /* __SEV_DEV_H */
61#endif /* __SEV_DEV_H */