6eb0cc72bc
PSP can support both SEV and TEE interface. Therefore, move SEV specific registers to a dedicated data structure. TEE interface specific registers will be added in a later patch. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Jens Wiklander <jens.wiklander@linaro.org> Co-developed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com> Signed-off-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com> Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com> Acked-by: Gary R Hook <gary.hook@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* AMD Platform Security Processor (PSP) interface driver
|
|
*
|
|
* Copyright (C) 2017-2019 Advanced Micro Devices, Inc.
|
|
*
|
|
* Author: Brijesh Singh <brijesh.singh@amd.com>
|
|
*/
|
|
|
|
#ifndef __SEV_DEV_H__
|
|
#define __SEV_DEV_H__
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/list.h>
|
|
#include <linux/wait.h>
|
|
#include <linux/dmapool.h>
|
|
#include <linux/hw_random.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/irqreturn.h>
|
|
#include <linux/dmaengine.h>
|
|
#include <linux/psp-sev.h>
|
|
#include <linux/miscdevice.h>
|
|
#include <linux/capability.h>
|
|
|
|
#define SEV_CMD_COMPLETE BIT(1)
|
|
#define SEV_CMDRESP_CMD_SHIFT 16
|
|
#define SEV_CMDRESP_IOC BIT(0)
|
|
|
|
struct sev_misc_dev {
|
|
struct kref refcount;
|
|
struct miscdevice misc;
|
|
};
|
|
|
|
struct sev_device {
|
|
struct device *dev;
|
|
struct psp_device *psp;
|
|
|
|
void __iomem *io_regs;
|
|
|
|
struct sev_vdata *vdata;
|
|
|
|
int state;
|
|
unsigned int int_rcvd;
|
|
wait_queue_head_t int_queue;
|
|
struct sev_misc_dev *misc;
|
|
struct sev_user_data_status status_cmd_buf;
|
|
struct sev_data_init init_cmd_buf;
|
|
|
|
u8 api_major;
|
|
u8 api_minor;
|
|
u8 build;
|
|
};
|
|
|
|
int sev_dev_init(struct psp_device *psp);
|
|
void sev_dev_destroy(struct psp_device *psp);
|
|
|
|
void sev_pci_init(void);
|
|
void sev_pci_exit(void);
|
|
|
|
#endif /* __SEV_DEV_H */
|