forked from huangbibo/kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'linux-6.6.y' into linux-6.6-y-rolling-lts-stable
- Loading branch information
Showing
372 changed files
with
191,136 additions
and
29,333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* HYGON CSV interface | ||
* | ||
* Copyright (C) 2024 Hygon Info Technologies Ltd. | ||
* | ||
* Author: Liyang Han <hanliyang@hygon.cn> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/psp.h> | ||
#include <linux/psp-hygon.h> | ||
#include <uapi/linux/psp-hygon.h> | ||
|
||
#include "psp-dev.h" | ||
|
||
int csv_cmd_buffer_len(int cmd) | ||
{ | ||
switch (cmd) { | ||
case CSV_CMD_HGSC_CERT_IMPORT: return sizeof(struct csv_data_hgsc_cert_import); | ||
default: return 0; | ||
} | ||
} | ||
|
||
static int csv_ioctl_do_hgsc_import(struct sev_issue_cmd *argp) | ||
{ | ||
struct csv_user_data_hgsc_cert_import input; | ||
struct csv_data_hgsc_cert_import *data; | ||
void *hgscsk_blob, *hgsc_blob; | ||
int ret; | ||
|
||
if (copy_from_user(&input, (void __user *)argp->data, sizeof(input))) | ||
return -EFAULT; | ||
|
||
data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
if (!data) | ||
return -ENOMEM; | ||
|
||
/* copy HGSCSK certificate blobs from userspace */ | ||
hgscsk_blob = psp_copy_user_blob(input.hgscsk_cert_address, input.hgscsk_cert_len); | ||
if (IS_ERR(hgscsk_blob)) { | ||
ret = PTR_ERR(hgscsk_blob); | ||
goto e_free; | ||
} | ||
|
||
data->hgscsk_cert_address = __psp_pa(hgscsk_blob); | ||
data->hgscsk_cert_len = input.hgscsk_cert_len; | ||
|
||
/* copy HGSC certificate blobs from userspace */ | ||
hgsc_blob = psp_copy_user_blob(input.hgsc_cert_address, input.hgsc_cert_len); | ||
if (IS_ERR(hgsc_blob)) { | ||
ret = PTR_ERR(hgsc_blob); | ||
goto e_free_hgscsk; | ||
} | ||
|
||
data->hgsc_cert_address = __psp_pa(hgsc_blob); | ||
data->hgsc_cert_len = input.hgsc_cert_len; | ||
|
||
ret = hygon_psp_hooks.__sev_do_cmd_locked(CSV_CMD_HGSC_CERT_IMPORT, | ||
data, &argp->error); | ||
|
||
kfree(hgsc_blob); | ||
e_free_hgscsk: | ||
kfree(hgscsk_blob); | ||
e_free: | ||
kfree(data); | ||
return ret; | ||
} | ||
|
||
static long csv_ioctl(struct file *file, unsigned int ioctl, unsigned long arg) | ||
{ | ||
void __user *argp = (void __user *)arg; | ||
struct sev_issue_cmd input; | ||
int ret = -EFAULT; | ||
|
||
if (!hygon_psp_hooks.sev_dev_hooks_installed) | ||
return -ENODEV; | ||
|
||
if (!psp_master || !psp_master->sev_data) | ||
return -ENODEV; | ||
|
||
if (ioctl != SEV_ISSUE_CMD) | ||
return -EINVAL; | ||
|
||
if (copy_from_user(&input, argp, sizeof(struct sev_issue_cmd))) | ||
return -EFAULT; | ||
|
||
if (input.cmd > CSV_MAX) | ||
return -EINVAL; | ||
|
||
mutex_lock(hygon_psp_hooks.sev_cmd_mutex); | ||
|
||
switch (input.cmd) { | ||
case CSV_HGSC_CERT_IMPORT: | ||
ret = csv_ioctl_do_hgsc_import(&input); | ||
break; | ||
default: | ||
/* | ||
* If the command is compatible between CSV and SEV, the | ||
* native implementation of the driver is invoked. | ||
* Release the mutex before calling the native ioctl function | ||
* because it will acquires the mutex. | ||
*/ | ||
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex); | ||
return hygon_psp_hooks.sev_ioctl(file, ioctl, arg); | ||
} | ||
|
||
if (copy_to_user(argp, &input, sizeof(struct sev_issue_cmd))) | ||
ret = -EFAULT; | ||
|
||
mutex_unlock(hygon_psp_hooks.sev_cmd_mutex); | ||
|
||
return ret; | ||
} | ||
|
||
const struct file_operations csv_fops = { | ||
.owner = THIS_MODULE, | ||
.unlocked_ioctl = csv_ioctl, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* HYGON CSV driver interface | ||
* | ||
* Copyright (C) 2024 Hygon Info Technologies Ltd. | ||
* | ||
* Author: Liyang Han <hanliyang@hygon.cn> | ||
*/ | ||
|
||
#ifndef __CCP_HYGON_CSV_DEV_H__ | ||
#define __CCP_HYGON_CSV_DEV_H__ | ||
|
||
#include <linux/fs.h> | ||
|
||
extern const struct file_operations csv_fops; | ||
|
||
int csv_cmd_buffer_len(int cmd); | ||
|
||
#endif /* __CCP_HYGON_CSV_DEV_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
config DRM_ARISE | ||
tristate "Arise DRM" | ||
default m | ||
depends on DRM | ||
select DRM_KMS_HELPER | ||
help | ||
Choose this option if you have an Glenfly Arise GPU. If M is selected | ||
the module will be called arise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
CHIP?=E3k | ||
DRIVER_NAME?=arise | ||
PRO_DRIVER_NAME=$(DRIVER_NAME) | ||
TARGET_ARCH?=x86_64 | ||
DEBUG?=0 | ||
VIDEO_ONLY_FPGA?=0 | ||
RUN_HW_NULL?=0 | ||
HW_NULL?=0 | ||
CONFIG-GFGPU=m | ||
ifeq ("$(M)", "") | ||
CHECK_GCC_VERSION?=0 | ||
else | ||
CHECK_GCC_VERSION?=1 | ||
endif | ||
|
||
ccflags-y := -D__LINUX__ -DKERNEL_BUILD | ||
ccflags-y += -Wno-undef -Wno-unused -Wno-missing-braces -Wno-missing-attributes -Wno-overflow -Wno-missing-prototypes -Wno-missing-declarations | ||
|
||
ifeq ($(CHECK_GCC_VERSION), 1) | ||
|
||
KERNEL_UNAME?=$(shell uname -r) | ||
KERNEL_MODLIB:=/lib/modules/$(KERNEL_UNAME) | ||
KERNEL_SOURCES:=$(shell test -d $(KERNEL_MODLIB)/source && echo $(KERNEL_MODLIB)/source || echo $(KERNEL_MODLIB)/build) | ||
KERNEL_COMPILE_H=$(KERNEL_SOURCES)/include/generated/compile.h | ||
KERNEL_COMPILE_H_EXIT=$(shell if [ -f $(KERNEL_COMPILE_H) ]; then echo 1; else echo 0; fi) | ||
|
||
ifeq ($(KERNEL_COMPILE_H_EXIT), 1) | ||
|
||
KERNEL_BUILT_GCC_STRING=$(shell cat ${KERNEL_COMPILE_H} | grep LINUX_COMPILER | cut -f 2 -d '"') | ||
KERNEL_BUILT_GCC_VERSION=$(shell echo "${KERNEL_BUILT_GCC_STRING}" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n 1) | ||
ifeq ("$(KERNEL_BUILT_GCC_VERSION)", "") | ||
KERNEL_BUILT_GCC_VERSION=$(shell echo "${KERNEL_BUILT_GCC_STRING}" | grep -o '[0-9]\+\.[0-9]\+' | head -n 1) | ||
endif | ||
|
||
SYSTEM_GCC_VERSION=$(shell $(CC) -v 2>&1 | awk 'END{print}' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n 1) | ||
ifeq ("$(SYSTEM_GCC_VERSION)", "") | ||
SYSTEM_GCC_VERSION=$(shell $(CC) -v 2>&1 | awk 'END{print}' | grep -o '[0-9]\+\.[0-9]\+' | head -n 1) | ||
endif | ||
|
||
ifneq ("$(KERNEL_BUILT_GCC_VERSION)", "$(SYSTEM_GCC_VERSION)") | ||
$(warning "Kernel Built GCC Version ($(KERNEL_BUILT_GCC_VERSION)) Are Differ From System GCC Version($(SYSTEM_GCC_VERSION))!!") | ||
$(warning "System GCC Version Must Match To Kernel Built GCC Version!!") | ||
$(warning "Please Check GCC Version!!") | ||
endif | ||
|
||
else | ||
$(warning "$(KERNEL_COMPILE_H) not exist,can not do gcc version check,skip") | ||
endif | ||
|
||
endif | ||
|
||
ifeq ($(DEBUG), 1) | ||
ccflags-y += -ggdb3 -O2 -D_DEBUG_ -DGF_TRACE_EVENT=1 | ||
else | ||
ccflags-y += -O2 -fno-strict-aliasing -fno-stack-protector -DGF_TRACE_EVENT=1 | ||
endif | ||
|
||
ifeq ($(VIDEO_ONLY_FPGA), 1) | ||
ccflags-y += -DVIDEO_ONLY_FPGA | ||
endif | ||
|
||
ifeq ($(RUN_HW_NULL), 1) | ||
ccflags-y += -DGF_HW_NULL | ||
else | ||
ccflags-y += -DGF_PCIE_BUS | ||
endif | ||
|
||
ccflags-y += -I$(src) | ||
|
||
ifeq ("$(M)", "") | ||
ifeq ("$(O)", "") | ||
GFGPU_FULL_PATH=$(src) | ||
else | ||
GFGPU_FULL_PATH=$(srctree)/$(src) | ||
endif | ||
else | ||
GFGPU_FULL_PATH=$(src) | ||
endif | ||
|
||
include $(GFGPU_FULL_PATH)/core/Makefile | ||
include $(GFGPU_FULL_PATH)/cbios/cbios.mk | ||
include $(GFGPU_FULL_PATH)/linux/Makefile | ||
obj-$(CONFIG_DRM_ARISE) := $(PRO_DRIVER_NAME).o |
Oops, something went wrong.