summaryrefslogtreecommitdiff
path: root/include/crypto/mcryptd.h
blob: 4a53c0d38cd2c48e105085966bf362fa1b54d93c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * Software async multibuffer crypto daemon headers
 *
 *    Author:
 *             Tim Chen <tim.c.chen@linux.intel.com>
 *
 *    Copyright (c) 2014, Intel Corporation.
 */

#ifndef _CRYPTO_MCRYPT_H
#define _CRYPTO_MCRYPT_H

#include <linux/crypto.h>
#include <linux/kernel.h>
#include <crypto/hash.h>

struct mcryptd_ahash {
	struct crypto_ahash base;
};

static inline struct mcryptd_ahash *__mcryptd_ahash_cast(
	struct crypto_ahash *tfm)
{
	return (struct mcryptd_ahash *)tfm;
}

struct mcryptd_cpu_queue {
	struct crypto_queue queue;
	struct work_struct work;
};

struct mcryptd_queue {
	struct mcryptd_cpu_queue __percpu *cpu_queue;
};

struct mcryptd_instance_ctx {
	struct crypto_spawn spawn;
	struct mcryptd_queue *queue;
};

struct mcryptd_hash_ctx {
	struct crypto_ahash *child;
	struct mcryptd_alg_state *alg_state;
};

struct mcryptd_tag {
	/* seq number of request */
	unsigned seq_num;
	/* arrival time of request */
	unsigned long arrival;
	unsigned long expire;
	int	cpu;
};

struct mcryptd_hash_request_ctx {
	struct list_head waiter;
	crypto_completion_t complete;
	struct mcryptd_tag tag;
	struct crypto_hash_walk walk;
	u8 *out;
	int flag;
	struct ahash_request areq;
};

struct mcryptd_ahash *mcryptd_alloc_ahash(const char *alg_name,
					u32 type, u32 mask);
struct crypto_ahash *mcryptd_ahash_child(struct mcryptd_ahash *tfm);
struct ahash_request *mcryptd_ahash_desc(struct ahash_request *req);
void mcryptd_free_ahash(struct mcryptd_ahash *tfm);
void mcryptd_flusher(struct work_struct *work);

enum mcryptd_req_type {
	MCRYPTD_NONE,
	MCRYPTD_UPDATE,
	MCRYPTD_FINUP,
	MCRYPTD_DIGEST,
	MCRYPTD_FINAL
};

struct mcryptd_alg_cstate {
	unsigned long next_flush;
	unsigned next_seq_num;
	bool	flusher_engaged;
	struct  delayed_work flush;
	int	cpu;
	struct  mcryptd_alg_state *alg_state;
	void	*mgr;
	spinlock_t work_lock;
	struct list_head work_list;
	struct list_head flush_list;
};

struct mcryptd_alg_state {
	struct mcryptd_alg_cstate __percpu *alg_cstate;
	unsigned long (*flusher)(struct mcryptd_alg_cstate *cstate);
};

/* return delay in jiffies from current time */
static inline unsigned long get_delay(unsigned long t)
{
	long delay;

	delay = (long) t - (long) jiffies;
	if (delay <= 0)
		return 0;
	else
		return (unsigned long) delay;
}

void mcryptd_arm_flusher(struct mcryptd_alg_cstate *cstate, unsigned long delay);

#endif
ear+0xf7/0x1c0 [drm] kfree+0x159/0x1a0 drm_atomic_state_default_clear+0xf7/0x1c0 [drm] ? drm_atomic_state_clear+0x30/0x30 [drm] intel_atomic_state_clear+0xd/0x20 [i915] drm_atomic_state_clear+0x1a/0x30 [drm] __drm_atomic_state_free+0x13/0x60 [drm] intel_atomic_helper_free_state+0x5d/0x70 [i915] process_one_work+0x260/0x4a0 worker_thread+0x2d1/0x4f0 kthread+0x127/0x130 ? process_one_work+0x4a0/0x4a0 ? kthread_stop+0x120/0x120 ret_from_fork+0x29/0x40 FIX kmalloc-128: Object at 0xffff92fb65ec2578 not freed Fixes: 3b24f7d67581 ("drm/atomic: Add struct drm_crtc_commit to track async updates") Fixes: 9626014258a5 ("drm/fence: add in-fences support") Cc: <stable@vger.kernel.org> # v4.8+ Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1485854725-27640-1-git-send-email-maarten.lankhorst@linux.intel.com
Diffstat (limited to 'include/math-emu/double.h')