Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/drivers/accel/rocket/rocket_core.h
29278 views
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
/* Copyright 2024-2025 Tomeu Vizoso <[email protected]> */
3
4
#ifndef __ROCKET_CORE_H__
5
#define __ROCKET_CORE_H__
6
7
#include <drm/gpu_scheduler.h>
8
#include <linux/clk.h>
9
#include <linux/io.h>
10
#include <linux/mutex_types.h>
11
#include <linux/reset.h>
12
13
#include "rocket_registers.h"
14
15
#define rocket_pc_readl(core, reg) \
16
readl((core)->pc_iomem + (REG_PC_##reg))
17
#define rocket_pc_writel(core, reg, value) \
18
writel(value, (core)->pc_iomem + (REG_PC_##reg))
19
20
#define rocket_cna_readl(core, reg) \
21
readl((core)->cna_iomem + (REG_CNA_##reg) - REG_CNA_S_STATUS)
22
#define rocket_cna_writel(core, reg, value) \
23
writel(value, (core)->cna_iomem + (REG_CNA_##reg) - REG_CNA_S_STATUS)
24
25
#define rocket_core_readl(core, reg) \
26
readl((core)->core_iomem + (REG_CORE_##reg) - REG_CORE_S_STATUS)
27
#define rocket_core_writel(core, reg, value) \
28
writel(value, (core)->core_iomem + (REG_CORE_##reg) - REG_CORE_S_STATUS)
29
30
struct rocket_core {
31
struct device *dev;
32
struct rocket_device *rdev;
33
unsigned int index;
34
35
int irq;
36
void __iomem *pc_iomem;
37
void __iomem *cna_iomem;
38
void __iomem *core_iomem;
39
struct clk_bulk_data clks[4];
40
struct reset_control_bulk_data resets[2];
41
42
struct iommu_group *iommu_group;
43
44
struct mutex job_lock;
45
struct rocket_job *in_flight_job;
46
47
spinlock_t fence_lock;
48
49
struct {
50
struct workqueue_struct *wq;
51
struct work_struct work;
52
atomic_t pending;
53
} reset;
54
55
struct drm_gpu_scheduler sched;
56
u64 fence_context;
57
u64 emit_seqno;
58
};
59
60
int rocket_core_init(struct rocket_core *core);
61
void rocket_core_fini(struct rocket_core *core);
62
void rocket_core_reset(struct rocket_core *core);
63
64
#endif
65
66