aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/qat
diff options
context:
space:
mode:
authorTadeusz Struk <tadeusz.struk@intel.com>2014-06-05 16:44:20 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-06-20 09:26:18 -0400
commit7afa232e76ced910a191a3f6669d8f48bcb46b3e (patch)
treea006dde3c48be9190aa8e37629f39dd982b33b78 /drivers/crypto/qat
parentb3416fb8a2f5a1653e4ab72b55907794cc10bde1 (diff)
crypto: qat - Intel(R) QAT DH895xcc accelerator
This patch adds DH895xCC hardware specific code. It hooks to the common infrastructure and provides acceleration for crypto algorithms. Acked-by: John Griffin <john.griffin@intel.com> Reviewed-by: Bruce W. Allan <bruce.w.allan@intel.com> Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/qat')
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/Makefile8
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_admin.c144
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c214
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h86
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_drv.c448
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_drv.h67
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_hw_arbiter.c159
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_isr.c266
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/qat_admin.c107
9 files changed, 1499 insertions, 0 deletions
diff --git a/drivers/crypto/qat/qat_dh895xcc/Makefile b/drivers/crypto/qat/qat_dh895xcc/Makefile
new file mode 100644
index 000000000000..8e4924d6a54b
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/Makefile
@@ -0,0 +1,8 @@
1ccflags-y := -I$(CURDIR)/drivers/crypto/qat/qat_common
2obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCC) += qat_dh895xcc.o
3qat_dh895xcc-objs := adf_drv.o \
4 adf_isr.o \
5 adf_dh895xcc_hw_data.o \
6 adf_hw_arbiter.o \
7 qat_admin.o \
8 adf_admin.o
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_admin.c b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c
new file mode 100644
index 000000000000..978d6c56639d
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c
@@ -0,0 +1,144 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#include <linux/types.h>
48#include <linux/mutex.h>
49#include <linux/slab.h>
50#include <linux/delay.h>
51#include <linux/pci.h>
52#include <linux/dma-mapping.h>
53#include <adf_accel_devices.h>
54#include "adf_drv.h"
55#include "adf_dh895xcc_hw_data.h"
56
57#define ADF_ADMINMSG_LEN 32
58
59struct adf_admin_comms {
60 dma_addr_t phy_addr;
61 void *virt_addr;
62 void __iomem *mailbox_addr;
63 struct mutex lock; /* protects adf_admin_comms struct */
64};
65
66int adf_put_admin_msg_sync(struct adf_accel_dev *accel_dev,
67 uint32_t ae, void *in, void *out)
68{
69 struct adf_admin_comms *admin = accel_dev->admin;
70 int offset = ae * ADF_ADMINMSG_LEN * 2;
71 void __iomem *mailbox = admin->mailbox_addr;
72 int mb_offset = ae * ADF_DH895XCC_MAILBOX_STRIDE;
73 int times, received;
74
75 mutex_lock(&admin->lock);
76
77 if (ADF_CSR_RD(mailbox, mb_offset) == 1) {
78 mutex_unlock(&admin->lock);
79 return -EAGAIN;
80 }
81
82 memcpy(admin->virt_addr + offset, in, ADF_ADMINMSG_LEN);
83 ADF_CSR_WR(mailbox, mb_offset, 1);
84 received = 0;
85 for (times = 0; times < 50; times++) {
86 msleep(20);
87 if (ADF_CSR_RD(mailbox, mb_offset) == 0) {
88 received = 1;
89 break;
90 }
91 }
92 if (received)
93 memcpy(out, admin->virt_addr + offset +
94 ADF_ADMINMSG_LEN, ADF_ADMINMSG_LEN);
95 else
96 pr_err("QAT: Failed to send admin msg to accelerator\n");
97
98 mutex_unlock(&admin->lock);
99 return received ? 0 : -EFAULT;
100}
101
102int adf_init_admin_comms(struct adf_accel_dev *accel_dev)
103{
104 struct adf_admin_comms *admin;
105 struct adf_bar *pmisc = &GET_BARS(accel_dev)[ADF_DH895XCC_PMISC_BAR];
106 void __iomem *csr = pmisc->virt_addr;
107 void __iomem *mailbox = csr + ADF_DH895XCC_MAILBOX_BASE_OFFSET;
108 uint64_t reg_val;
109
110 admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL,
111 accel_dev->numa_node);
112 if (!admin)
113 return -ENOMEM;
114 admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
115 &admin->phy_addr, GFP_KERNEL);
116 if (!admin->virt_addr) {
117 dev_err(&GET_DEV(accel_dev), "Failed to allocate dma buff\n");
118 kfree(admin);
119 return -ENOMEM;
120 }
121 reg_val = (uint64_t)admin->phy_addr;
122 ADF_CSR_WR(csr, ADF_DH895XCC_ADMINMSGUR_OFFSET, reg_val >> 32);
123 ADF_CSR_WR(csr, ADF_DH895XCC_ADMINMSGLR_OFFSET, reg_val);
124 mutex_init(&admin->lock);
125 admin->mailbox_addr = mailbox;
126 accel_dev->admin = admin;
127 return 0;
128}
129
130void adf_exit_admin_comms(struct adf_accel_dev *accel_dev)
131{
132 struct adf_admin_comms *admin = accel_dev->admin;
133
134 if (!admin)
135 return;
136
137 if (admin->virt_addr)
138 dma_free_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
139 admin->virt_addr, admin->phy_addr);
140
141 mutex_destroy(&admin->lock);
142 kfree(admin);
143 accel_dev->admin = NULL;
144}
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c
new file mode 100644
index 000000000000..ef05825cc651
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c
@@ -0,0 +1,214 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#include <adf_accel_devices.h>
48#include "adf_dh895xcc_hw_data.h"
49#include "adf_drv.h"
50
51/* Worker thread to service arbiter mappings based on dev SKUs */
52static const uint32_t thrd_to_arb_map_sku4[] = {
53 0x12222AAA, 0x11666666, 0x12222AAA, 0x11666666,
54 0x12222AAA, 0x11222222, 0x12222AAA, 0x11222222,
55 0x00000000, 0x00000000, 0x00000000, 0x00000000
56};
57
58static const uint32_t thrd_to_arb_map_sku6[] = {
59 0x12222AAA, 0x11666666, 0x12222AAA, 0x11666666,
60 0x12222AAA, 0x11222222, 0x12222AAA, 0x11222222,
61 0x12222AAA, 0x11222222, 0x12222AAA, 0x11222222
62};
63
64static struct adf_hw_device_class dh895xcc_class = {
65 .name = ADF_DH895XCC_DEVICE_NAME,
66 .type = DEV_DH895XCC,
67 .instances = 0
68};
69
70static uint32_t get_accel_mask(uint32_t fuse)
71{
72 return (~fuse) >> ADF_DH895XCC_ACCELERATORS_REG_OFFSET &
73 ADF_DH895XCC_ACCELERATORS_MASK;
74}
75
76static uint32_t get_ae_mask(uint32_t fuse)
77{
78 return (~fuse) & ADF_DH895XCC_ACCELENGINES_MASK;
79}
80
81static uint32_t get_num_accels(struct adf_hw_device_data *self)
82{
83 uint32_t i, ctr = 0;
84
85 if (!self || !self->accel_mask)
86 return 0;
87
88 for (i = 0; i < ADF_DH895XCC_MAX_ACCELERATORS; i++) {
89 if (self->accel_mask & (1 << i))
90 ctr++;
91 }
92 return ctr;
93}
94
95static uint32_t get_num_aes(struct adf_hw_device_data *self)
96{
97 uint32_t i, ctr = 0;
98
99 if (!self || !self->ae_mask)
100 return 0;
101
102 for (i = 0; i < ADF_DH895XCC_MAX_ACCELENGINES; i++) {
103 if (self->ae_mask & (1 << i))
104 ctr++;
105 }
106 return ctr;
107}
108
109static uint32_t get_misc_bar_id(struct adf_hw_device_data *self)
110{
111 return ADF_DH895XCC_PMISC_BAR;
112}
113
114static uint32_t get_etr_bar_id(struct adf_hw_device_data *self)
115{
116 return ADF_DH895XCC_ETR_BAR;
117}
118
119static enum dev_sku_info get_sku(struct adf_hw_device_data *self)
120{
121 int sku = (self->fuses & ADF_DH895XCC_FUSECTL_SKU_MASK)
122 >> ADF_DH895XCC_FUSECTL_SKU_SHIFT;
123
124 switch (sku) {
125 case ADF_DH895XCC_FUSECTL_SKU_1:
126 return DEV_SKU_1;
127 case ADF_DH895XCC_FUSECTL_SKU_2:
128 return DEV_SKU_2;
129 case ADF_DH895XCC_FUSECTL_SKU_3:
130 return DEV_SKU_3;
131 case ADF_DH895XCC_FUSECTL_SKU_4:
132 return DEV_SKU_4;
133 default:
134 return DEV_SKU_UNKNOWN;
135 }
136 return DEV_SKU_UNKNOWN;
137}
138
139void adf_get_arbiter_mapping(struct adf_accel_dev *accel_dev,
140 uint32_t const **arb_map_config)
141{
142 switch (accel_dev->accel_pci_dev.sku) {
143 case DEV_SKU_1:
144 *arb_map_config = thrd_to_arb_map_sku4;
145 break;
146
147 case DEV_SKU_2:
148 case DEV_SKU_4:
149 *arb_map_config = thrd_to_arb_map_sku6;
150 break;
151 default:
152 pr_err("QAT: The configuration doesn't match any SKU");
153 *arb_map_config = NULL;
154 }
155}
156
157static void adf_enable_error_correction(struct adf_accel_dev *accel_dev)
158{
159 struct adf_hw_device_data *hw_device = accel_dev->hw_device;
160 struct adf_bar *misc_bar = &GET_BARS(accel_dev)[ADF_DH895XCC_PMISC_BAR];
161 void __iomem *csr = misc_bar->virt_addr;
162 unsigned int val, i;
163
164 /* Enable Accel Engine error detection & correction */
165 for (i = 0; i < hw_device->get_num_aes(hw_device); i++) {
166 val = ADF_CSR_RD(csr, ADF_DH895XCC_AE_CTX_ENABLES(i));
167 val |= ADF_DH895XCC_ENABLE_AE_ECC_ERR;
168 ADF_CSR_WR(csr, ADF_DH895XCC_AE_CTX_ENABLES(i), val);
169 val = ADF_CSR_RD(csr, ADF_DH895XCC_AE_MISC_CONTROL(i));
170 val |= ADF_DH895XCC_ENABLE_AE_ECC_PARITY_CORR;
171 ADF_CSR_WR(csr, ADF_DH895XCC_AE_MISC_CONTROL(i), val);
172 }
173
174 /* Enable shared memory error detection & correction */
175 for (i = 0; i < hw_device->get_num_accels(hw_device); i++) {
176 val = ADF_CSR_RD(csr, ADF_DH895XCC_UERRSSMSH(i));
177 val |= ADF_DH895XCC_ERRSSMSH_EN;
178 ADF_CSR_WR(csr, ADF_DH895XCC_UERRSSMSH(i), val);
179 val = ADF_CSR_RD(csr, ADF_DH895XCC_CERRSSMSH(i));
180 val |= ADF_DH895XCC_ERRSSMSH_EN;
181 ADF_CSR_WR(csr, ADF_DH895XCC_CERRSSMSH(i), val);
182 }
183}
184
185void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data)
186{
187 hw_data->dev_class = &dh895xcc_class;
188 hw_data->instance_id = dh895xcc_class.instances++;
189 hw_data->num_banks = ADF_DH895XCC_ETR_MAX_BANKS;
190 hw_data->num_accel = ADF_DH895XCC_MAX_ACCELERATORS;
191 hw_data->pci_dev_id = ADF_DH895XCC_PCI_DEVICE_ID;
192 hw_data->num_logical_accel = 1;
193 hw_data->num_engines = ADF_DH895XCC_MAX_ACCELENGINES;
194 hw_data->tx_rx_gap = ADF_DH895XCC_RX_RINGS_OFFSET;
195 hw_data->tx_rings_mask = ADF_DH895XCC_TX_RINGS_MASK;
196 hw_data->alloc_irq = adf_isr_resource_alloc;
197 hw_data->free_irq = adf_isr_resource_free;
198 hw_data->enable_error_correction = adf_enable_error_correction;
199 hw_data->hw_arb_ring_enable = adf_update_ring_arb_enable;
200 hw_data->hw_arb_ring_disable = adf_update_ring_arb_enable;
201 hw_data->get_accel_mask = get_accel_mask;
202 hw_data->get_ae_mask = get_ae_mask;
203 hw_data->get_num_accels = get_num_accels;
204 hw_data->get_num_aes = get_num_aes;
205 hw_data->get_etr_bar_id = get_etr_bar_id;
206 hw_data->get_misc_bar_id = get_misc_bar_id;
207 hw_data->get_sku = get_sku;
208 hw_data->fw_name = ADF_DH895XCC_FW;
209}
210
211void adf_clean_hw_data_dh895xcc(struct adf_hw_device_data *hw_data)
212{
213 hw_data->dev_class->instances--;
214}
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h
new file mode 100644
index 000000000000..c5ce236aa979
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h
@@ -0,0 +1,86 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#ifndef ADF_DH895x_HW_DATA_H_
48#define ADF_DH895x_HW_DATA_H_
49
50/* PCIe configuration space */
51#define ADF_DH895XCC_RX_RINGS_OFFSET 8
52#define ADF_DH895XCC_TX_RINGS_MASK 0xFF
53#define ADF_DH895XCC_FUSECTL_OFFSET 0x40
54#define ADF_DH895XCC_FUSECTL_SKU_MASK 0x300000
55#define ADF_DH895XCC_FUSECTL_SKU_SHIFT 20
56#define ADF_DH895XCC_FUSECTL_SKU_1 0x0
57#define ADF_DH895XCC_FUSECTL_SKU_2 0x1
58#define ADF_DH895XCC_FUSECTL_SKU_3 0x2
59#define ADF_DH895XCC_FUSECTL_SKU_4 0x3
60#define ADF_DH895XCC_MAX_ACCELERATORS 6
61#define ADF_DH895XCC_MAX_ACCELENGINES 12
62#define ADF_DH895XCC_ACCELERATORS_REG_OFFSET 18
63#define ADF_DH895XCC_ACCELERATORS_MASK 0x3F
64#define ADF_DH895XCC_ACCELENGINES_MASK 0xFFF
65#define ADF_DH895XCC_LEGFUSE_OFFSET 0x4C
66#define ADF_DH895XCC_ETR_MAX_BANKS 32
67#define ADF_DH895XCC_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28)
68#define ADF_DH895XCC_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30)
69#define ADF_DH895XCC_SMIA0_MASK 0xFFFF
70#define ADF_DH895XCC_SMIA1_MASK 0x1
71/* Error detection and correction */
72#define ADF_DH895XCC_AE_CTX_ENABLES(i) (i * 0x1000 + 0x20818)
73#define ADF_DH895XCC_AE_MISC_CONTROL(i) (i * 0x1000 + 0x20960)
74#define ADF_DH895XCC_ENABLE_AE_ECC_ERR (1 << 28)
75#define ADF_DH895XCC_ENABLE_AE_ECC_PARITY_CORR (1 << 24 | 1 << 12)
76#define ADF_DH895XCC_UERRSSMSH(i) (i * 0x4000 + 0x18)
77#define ADF_DH895XCC_CERRSSMSH(i) (i * 0x4000 + 0x10)
78#define ADF_DH895XCC_ERRSSMSH_EN (1 << 3)
79
80/* Admin Messages Registers */
81#define ADF_DH895XCC_ADMINMSGUR_OFFSET (0x3A000 + 0x574)
82#define ADF_DH895XCC_ADMINMSGLR_OFFSET (0x3A000 + 0x578)
83#define ADF_DH895XCC_MAILBOX_BASE_OFFSET 0x20970
84#define ADF_DH895XCC_MAILBOX_STRIDE 0x1000
85#define ADF_DH895XCC_FW "qat_895xcc.bin"
86#endif
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
new file mode 100644
index 000000000000..1da2f78b2058
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
@@ -0,0 +1,448 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#include <linux/kernel.h>
48#include <linux/module.h>
49#include <linux/pci.h>
50#include <linux/init.h>
51#include <linux/types.h>
52#include <linux/fs.h>
53#include <linux/slab.h>
54#include <linux/errno.h>
55#include <linux/device.h>
56#include <linux/dma-mapping.h>
57#include <linux/platform_device.h>
58#include <linux/workqueue.h>
59#include <linux/io.h>
60#include <adf_accel_devices.h>
61#include <adf_common_drv.h>
62#include <adf_cfg.h>
63#include <adf_transport_access_macros.h>
64#include "adf_dh895xcc_hw_data.h"
65#include "adf_drv.h"
66
67static const char adf_driver_name[] = ADF_DH895XCC_DEVICE_NAME;
68
69#define ADF_SYSTEM_DEVICE(device_id) \
70 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
71
72static const struct pci_device_id adf_pci_tbl[] = {
73 ADF_SYSTEM_DEVICE(ADF_DH895XCC_PCI_DEVICE_ID),
74 {0,}
75};
76MODULE_DEVICE_TABLE(pci, adf_pci_tbl);
77
78static int adf_probe(struct pci_dev *dev, const struct pci_device_id *ent);
79static void adf_remove(struct pci_dev *dev);
80
81static struct pci_driver adf_driver = {
82 .id_table = adf_pci_tbl,
83 .name = adf_driver_name,
84 .probe = adf_probe,
85 .remove = adf_remove
86};
87
88static void adf_cleanup_accel(struct adf_accel_dev *accel_dev)
89{
90 struct adf_accel_pci *accel_pci_dev = &accel_dev->accel_pci_dev;
91 int i;
92
93 adf_exit_admin_comms(accel_dev);
94 adf_exit_arb(accel_dev);
95 adf_cleanup_etr_data(accel_dev);
96
97 for (i = 0; i < ADF_PCI_MAX_BARS; i++) {
98 struct adf_bar *bar = &accel_pci_dev->pci_bars[i];
99
100 if (bar->virt_addr)
101 pci_iounmap(accel_pci_dev->pci_dev, bar->virt_addr);
102 }
103
104 if (accel_dev->hw_device) {
105 switch (accel_dev->hw_device->pci_dev_id) {
106 case ADF_DH895XCC_PCI_DEVICE_ID:
107 adf_clean_hw_data_dh895xcc(accel_dev->hw_device);
108 break;
109 default:
110 break;
111 }
112 kfree(accel_dev->hw_device);
113 }
114 adf_cfg_dev_remove(accel_dev);
115 debugfs_remove(accel_dev->debugfs_dir);
116 adf_devmgr_rm_dev(accel_dev);
117 pci_release_regions(accel_pci_dev->pci_dev);
118 pci_disable_device(accel_pci_dev->pci_dev);
119 kfree(accel_dev);
120}
121
122static uint8_t adf_get_dev_node_id(struct pci_dev *pdev)
123{
124 unsigned int bus_per_cpu = 0;
125 struct cpuinfo_x86 *c = &cpu_data(num_online_cpus() - 1);
126
127 if (!c->phys_proc_id)
128 return 0;
129
130 bus_per_cpu = 256 / (c->phys_proc_id + 1);
131
132 if (bus_per_cpu != 0)
133 return pdev->bus->number / bus_per_cpu;
134 return 0;
135}
136
137static int qat_dev_start(struct adf_accel_dev *accel_dev)
138{
139 int cpus = num_online_cpus();
140 int banks = GET_MAX_BANKS(accel_dev);
141 int instances = min(cpus, banks);
142 char key[ADF_CFG_MAX_KEY_LEN_IN_BYTES];
143 int i;
144 unsigned long val;
145
146 if (adf_cfg_section_add(accel_dev, ADF_KERNEL_SEC))
147 goto err;
148 if (adf_cfg_section_add(accel_dev, "Accelerator0"))
149 goto err;
150 for (i = 0; i < instances; i++) {
151 val = i;
152 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_BANK_NUM, i);
153 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
154 key, (void *)&val, ADF_DEC))
155 goto err;
156
157 snprintf(key, sizeof(key), ADF_CY "%d" ADF_ETRMGR_CORE_AFFINITY,
158 i);
159 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
160 key, (void *)&val, ADF_DEC))
161 goto err;
162
163 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_ASYM_SIZE, i);
164 val = 128;
165 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
166 key, (void *)&val, ADF_DEC))
167 goto err;
168
169 val = 512;
170 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_SYM_SIZE, i);
171 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
172 key, (void *)&val, ADF_DEC))
173 goto err;
174
175 val = 0;
176 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_ASYM_TX, i);
177 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
178 key, (void *)&val, ADF_DEC))
179 goto err;
180
181 val = 2;
182 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_SYM_TX, i);
183 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
184 key, (void *)&val, ADF_DEC))
185 goto err;
186
187 val = 4;
188 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_RND_TX, i);
189 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
190 key, (void *)&val, ADF_DEC))
191 goto err;
192
193 val = 8;
194 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_ASYM_RX, i);
195 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
196 key, (void *)&val, ADF_DEC))
197 goto err;
198
199 val = 10;
200 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_SYM_RX, i);
201 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
202 key, (void *)&val, ADF_DEC))
203 goto err;
204
205 val = 12;
206 snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_RND_RX, i);
207 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
208 key, (void *)&val, ADF_DEC))
209 goto err;
210
211 val = ADF_COALESCING_DEF_TIME;
212 snprintf(key, sizeof(key), ADF_ETRMGR_COALESCE_TIMER_FORMAT, i);
213 if (adf_cfg_add_key_value_param(accel_dev, "Accelerator0",
214 key, (void *)&val, ADF_DEC))
215 goto err;
216 }
217
218 val = i;
219 if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
220 ADF_NUM_CY, (void *)&val, ADF_DEC))
221 goto err;
222
223 set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status);
224 return adf_dev_start(accel_dev);
225err:
226 dev_err(&GET_DEV(accel_dev), "Failed to start QAT accel dev\n");
227 return -EINVAL;
228}
229
230static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
231{
232 struct adf_accel_dev *accel_dev;
233 struct adf_accel_pci *accel_pci_dev;
234 struct adf_hw_device_data *hw_data;
235 void __iomem *pmisc_bar_addr = NULL;
236 char name[ADF_DEVICE_NAME_LENGTH];
237 unsigned int i, bar_nr;
238 uint8_t node;
239 int ret;
240
241 switch (ent->device) {
242 case ADF_DH895XCC_PCI_DEVICE_ID:
243 break;
244 default:
245 dev_err(&pdev->dev, "Invalid device 0x%x.\n", ent->device);
246 return -ENODEV;
247 }
248
249 node = adf_get_dev_node_id(pdev);
250 accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, node);
251 if (!accel_dev)
252 return -ENOMEM;
253
254 accel_dev->numa_node = node;
255 INIT_LIST_HEAD(&accel_dev->crypto_list);
256
257 /* Add accel device to accel table.
258 * This should be called before adf_cleanup_accel is called */
259 if (adf_devmgr_add_dev(accel_dev)) {
260 dev_err(&pdev->dev, "Failed to add new accelerator device.\n");
261 kfree(accel_dev);
262 return -EFAULT;
263 }
264
265 accel_dev->owner = THIS_MODULE;
266 /* Allocate and configure device configuration structure */
267 hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, node);
268 if (!hw_data) {
269 ret = -ENOMEM;
270 goto out_err;
271 }
272
273 accel_dev->hw_device = hw_data;
274 switch (ent->device) {
275 case ADF_DH895XCC_PCI_DEVICE_ID:
276 adf_init_hw_data_dh895xcc(accel_dev->hw_device);
277 break;
278 default:
279 return -ENODEV;
280 }
281 accel_pci_dev = &accel_dev->accel_pci_dev;
282 pci_read_config_byte(pdev, PCI_REVISION_ID, &accel_pci_dev->revid);
283 pci_read_config_dword(pdev, ADF_DH895XCC_FUSECTL_OFFSET,
284 &hw_data->fuses);
285
286 /* Get Accelerators and Accelerators Engines masks */
287 hw_data->accel_mask = hw_data->get_accel_mask(hw_data->fuses);
288 hw_data->ae_mask = hw_data->get_ae_mask(hw_data->fuses);
289 accel_pci_dev->sku = hw_data->get_sku(hw_data);
290 accel_pci_dev->pci_dev = pdev;
291 /* If the device has no acceleration engines then ignore it. */
292 if (!hw_data->accel_mask || !hw_data->ae_mask ||
293 ((~hw_data->ae_mask) & 0x01)) {
294 dev_err(&pdev->dev, "No acceleration units found");
295 ret = -EFAULT;
296 goto out_err;
297 }
298
299 /* Create dev top level debugfs entry */
300 snprintf(name, sizeof(name), "%s%s_dev%d", ADF_DEVICE_NAME_PREFIX,
301 hw_data->dev_class->name, hw_data->instance_id);
302 accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
303 if (!accel_dev->debugfs_dir) {
304 dev_err(&pdev->dev, "Could not create debugfs dir\n");
305 ret = -EINVAL;
306 goto out_err;
307 }
308
309 /* Create device configuration table */
310 ret = adf_cfg_dev_add(accel_dev);
311 if (ret)
312 goto out_err;
313
314 /* enable PCI device */
315 if (pci_enable_device(pdev)) {
316 ret = -EFAULT;
317 goto out_err;
318 }
319
320 /* set dma identifier */
321 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
322 if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
323 dev_err(&pdev->dev, "No usable DMA configuration\n");
324 ret = -EFAULT;
325 goto out_err;
326 } else {
327 pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
328 }
329
330 } else {
331 pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
332 }
333
334 if (pci_request_regions(pdev, adf_driver_name)) {
335 ret = -EFAULT;
336 goto out_err;
337 }
338
339 /* Read accelerator capabilities mask */
340 pci_read_config_dword(pdev, ADF_DH895XCC_LEGFUSE_OFFSET,
341 &hw_data->accel_capabilities_mask);
342
343 /* Find and map all the device's BARS */
344 for (i = 0; i < ADF_PCI_MAX_BARS; i++) {
345 struct adf_bar *bar = &accel_pci_dev->pci_bars[i];
346
347 bar_nr = i * 2;
348 bar->base_addr = pci_resource_start(pdev, bar_nr);
349 if (!bar->base_addr)
350 break;
351 bar->size = pci_resource_len(pdev, bar_nr);
352 bar->virt_addr = pci_iomap(accel_pci_dev->pci_dev, bar_nr, 0);
353 if (!bar->virt_addr) {
354 dev_err(&pdev->dev, "Failed to map BAR %d\n", i);
355 ret = -EFAULT;
356 goto out_err;
357 }
358 if (i == ADF_DH895XCC_PMISC_BAR)
359 pmisc_bar_addr = bar->virt_addr;
360 }
361 pci_set_master(pdev);
362
363 if (adf_enable_aer(accel_dev, &adf_driver)) {
364 dev_err(&pdev->dev, "Failed to enable aer\n");
365 ret = -EFAULT;
366 goto out_err;
367 }
368
369 if (adf_init_etr_data(accel_dev)) {
370 dev_err(&pdev->dev, "Failed initialize etr\n");
371 ret = -EFAULT;
372 goto out_err;
373 }
374
375 if (adf_init_admin_comms(accel_dev)) {
376 dev_err(&pdev->dev, "Failed initialize admin comms\n");
377 ret = -EFAULT;
378 goto out_err;
379 }
380
381 if (adf_init_arb(accel_dev)) {
382 dev_err(&pdev->dev, "Failed initialize hw arbiter\n");
383 ret = -EFAULT;
384 goto out_err;
385 }
386 if (pci_save_state(pdev)) {
387 dev_err(&pdev->dev, "Failed to save pci state\n");
388 ret = -ENOMEM;
389 goto out_err;
390 }
391
392 /* Enable bundle and misc interrupts */
393 ADF_CSR_WR(pmisc_bar_addr, ADF_DH895XCC_SMIAPF0_MASK_OFFSET,
394 ADF_DH895XCC_SMIA0_MASK);
395 ADF_CSR_WR(pmisc_bar_addr, ADF_DH895XCC_SMIAPF1_MASK_OFFSET,
396 ADF_DH895XCC_SMIA1_MASK);
397
398 ret = qat_dev_start(accel_dev);
399 if (ret) {
400 adf_dev_stop(accel_dev);
401 goto out_err;
402 }
403
404 return 0;
405out_err:
406 adf_cleanup_accel(accel_dev);
407 return ret;
408}
409
410static void __exit adf_remove(struct pci_dev *pdev)
411{
412 struct adf_accel_dev *accel_dev = adf_devmgr_pci_to_accel_dev(pdev);
413
414 if (!accel_dev) {
415 pr_err("QAT: Driver removal failed\n");
416 return;
417 }
418 if (adf_dev_stop(accel_dev))
419 dev_err(&GET_DEV(accel_dev), "Failed to stop QAT accel dev\n");
420 adf_disable_aer(accel_dev);
421 adf_cleanup_accel(accel_dev);
422}
423
424static int __init adfdrv_init(void)
425{
426 request_module("intel_qat");
427 if (qat_admin_register())
428 return -EFAULT;
429
430 if (pci_register_driver(&adf_driver)) {
431 pr_err("QAT: Driver initialization failed\n");
432 return -EFAULT;
433 }
434 return 0;
435}
436
437static void __exit adfdrv_release(void)
438{
439 pci_unregister_driver(&adf_driver);
440 qat_admin_unregister();
441}
442
443module_init(adfdrv_init);
444module_exit(adfdrv_release);
445
446MODULE_LICENSE("Dual BSD/GPL");
447MODULE_AUTHOR("Intel");
448MODULE_DESCRIPTION("Intel(R) QuickAssist Technology");
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.h b/drivers/crypto/qat/qat_dh895xcc/adf_drv.h
new file mode 100644
index 000000000000..a2fbb6ce75cd
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.h
@@ -0,0 +1,67 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#ifndef ADF_DH895x_DRV_H_
48#define ADF_DH895x_DRV_H_
49#include <adf_accel_devices.h>
50#include <adf_transport.h>
51
52void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data);
53void adf_clean_hw_data_dh895xcc(struct adf_hw_device_data *hw_data);
54int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev);
55void adf_isr_resource_free(struct adf_accel_dev *accel_dev);
56void adf_update_ring_arb_enable(struct adf_etr_ring_data *ring);
57void adf_get_arbiter_mapping(struct adf_accel_dev *accel_dev,
58 uint32_t const **arb_map_config);
59int adf_init_admin_comms(struct adf_accel_dev *accel_dev);
60void adf_exit_admin_comms(struct adf_accel_dev *accel_dev);
61int adf_put_admin_msg_sync(struct adf_accel_dev *accel_dev,
62 uint32_t ae, void *in, void *out);
63int qat_admin_register(void);
64int qat_admin_unregister(void);
65int adf_init_arb(struct adf_accel_dev *accel_dev);
66void adf_exit_arb(struct adf_accel_dev *accel_dev);
67#endif
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_hw_arbiter.c b/drivers/crypto/qat/qat_dh895xcc/adf_hw_arbiter.c
new file mode 100644
index 000000000000..36ffa70211c9
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_hw_arbiter.c
@@ -0,0 +1,159 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#include <adf_accel_devices.h>
48#include <adf_transport_internal.h>
49#include "adf_drv.h"
50
51#define ADF_ARB_NUM 4
52#define ADF_ARB_REQ_RING_NUM 8
53#define ADF_ARB_REG_SIZE 0x4
54#define ADF_ARB_WTR_SIZE 0x20
55#define ADF_ARB_OFFSET 0x30000
56#define ADF_ARB_REG_SLOT 0x1000
57#define ADF_ARB_WTR_OFFSET 0x010
58#define ADF_ARB_RO_EN_OFFSET 0x090
59#define ADF_ARB_WQCFG_OFFSET 0x100
60#define ADF_ARB_WRK_2_SER_MAP_OFFSET 0x180
61#define ADF_ARB_WRK_2_SER_MAP 10
62#define ADF_ARB_RINGSRVARBEN_OFFSET 0x19C
63
64#define WRITE_CSR_ARB_RINGSRVARBEN(csr_addr, index, value) \
65 ADF_CSR_WR(csr_addr, ADF_ARB_RINGSRVARBEN_OFFSET + \
66 (ADF_ARB_REG_SLOT * index), value);
67
68#define WRITE_CSR_ARB_RESPORDERING(csr_addr, index, value) \
69 ADF_CSR_WR(csr_addr, (ADF_ARB_OFFSET + \
70 ADF_ARB_RO_EN_OFFSET) + (ADF_ARB_REG_SIZE * index), value);
71
72#define WRITE_CSR_ARB_WEIGHT(csr_addr, arb, index, value) \
73 ADF_CSR_WR(csr_addr, (ADF_ARB_OFFSET + \
74 ADF_ARB_WTR_OFFSET) + (ADF_ARB_WTR_SIZE * arb) + \
75 (ADF_ARB_REG_SIZE * index), value);
76
77#define WRITE_CSR_ARB_SARCONFIG(csr_addr, index, value) \
78 ADF_CSR_WR(csr_addr, ADF_ARB_OFFSET + \
79 (ADF_ARB_REG_SIZE * index), value);
80
81#define WRITE_CSR_ARB_WRK_2_SER_MAP(csr_addr, index, value) \
82 ADF_CSR_WR(csr_addr, (ADF_ARB_OFFSET + \
83 ADF_ARB_WRK_2_SER_MAP_OFFSET) + \
84 (ADF_ARB_REG_SIZE * index), value);
85
86#define WRITE_CSR_ARB_WQCFG(csr_addr, index, value) \
87 ADF_CSR_WR(csr_addr, (ADF_ARB_OFFSET + \
88 ADF_ARB_WQCFG_OFFSET) + (ADF_ARB_REG_SIZE * index), value);
89
90int adf_init_arb(struct adf_accel_dev *accel_dev)
91{
92 void __iomem *csr = accel_dev->transport->banks[0].csr_addr;
93 uint32_t arb_cfg = 0x1 << 31 | 0x4 << 4 | 0x1;
94 uint32_t arb, i;
95 const uint32_t *thd_2_arb_cfg;
96
97 /* Service arb configured for 32 bytes responses and
98 * ring flow control check enabled. */
99 for (arb = 0; arb < ADF_ARB_NUM; arb++)
100 WRITE_CSR_ARB_SARCONFIG(csr, arb, arb_cfg);
101
102 /* Setup service weighting */
103 for (arb = 0; arb < ADF_ARB_NUM; arb++)
104 for (i = 0; i < ADF_ARB_REQ_RING_NUM; i++)
105 WRITE_CSR_ARB_WEIGHT(csr, arb, i, 0xFFFFFFFF);
106
107 /* Setup ring response ordering */
108 for (i = 0; i < ADF_ARB_REQ_RING_NUM; i++)
109 WRITE_CSR_ARB_RESPORDERING(csr, i, 0xFFFFFFFF);
110
111 /* Setup worker queue registers */
112 for (i = 0; i < ADF_ARB_WRK_2_SER_MAP; i++)
113 WRITE_CSR_ARB_WQCFG(csr, i, i);
114
115 /* Map worker threads to service arbiters */
116 adf_get_arbiter_mapping(accel_dev, &thd_2_arb_cfg);
117
118 if (!thd_2_arb_cfg)
119 return -EFAULT;
120
121 for (i = 0; i < ADF_ARB_WRK_2_SER_MAP; i++)
122 WRITE_CSR_ARB_WRK_2_SER_MAP(csr, i, *(thd_2_arb_cfg + i));
123
124 return 0;
125}
126
127void adf_update_ring_arb_enable(struct adf_etr_ring_data *ring)
128{
129 WRITE_CSR_ARB_RINGSRVARBEN(ring->bank->csr_addr,
130 ring->bank->bank_number,
131 ring->bank->ring_mask & 0xFF);
132}
133
134void adf_exit_arb(struct adf_accel_dev *accel_dev)
135{
136 void __iomem *csr;
137 unsigned int i;
138
139 if (!accel_dev->transport)
140 return;
141
142 csr = accel_dev->transport->banks[0].csr_addr;
143
144 /* Reset arbiter configuration */
145 for (i = 0; i < ADF_ARB_NUM; i++)
146 WRITE_CSR_ARB_SARCONFIG(csr, i, 0);
147
148 /* Shutdown work queue */
149 for (i = 0; i < ADF_ARB_WRK_2_SER_MAP; i++)
150 WRITE_CSR_ARB_WQCFG(csr, i, 0);
151
152 /* Unmap worker threads to service arbiters */
153 for (i = 0; i < ADF_ARB_WRK_2_SER_MAP; i++)
154 WRITE_CSR_ARB_WRK_2_SER_MAP(csr, i, 0);
155
156 /* Disable arbitration on all rings */
157 for (i = 0; i < GET_MAX_BANKS(accel_dev); i++)
158 WRITE_CSR_ARB_RINGSRVARBEN(csr, i, 0);
159}
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
new file mode 100644
index 000000000000..77e2d3a573f4
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
@@ -0,0 +1,266 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#include <linux/kernel.h>
48#include <linux/init.h>
49#include <linux/types.h>
50#include <linux/pci.h>
51#include <linux/slab.h>
52#include <linux/errno.h>
53#include <linux/interrupt.h>
54#include <adf_accel_devices.h>
55#include <adf_common_drv.h>
56#include <adf_cfg.h>
57#include <adf_cfg_strings.h>
58#include <adf_cfg_common.h>
59#include <adf_transport_access_macros.h>
60#include <adf_transport_internal.h>
61#include "adf_drv.h"
62
63static int adf_enable_msix(struct adf_accel_dev *accel_dev)
64{
65 struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev;
66 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
67 uint32_t msix_num_entries = hw_data->num_banks + 1;
68 int i;
69
70 for (i = 0; i < msix_num_entries; i++)
71 pci_dev_info->msix_entries.entries[i].entry = i;
72
73 if (pci_enable_msix(pci_dev_info->pci_dev,
74 pci_dev_info->msix_entries.entries,
75 msix_num_entries)) {
76 pr_err("QAT: Failed to enable MSIX IRQ\n");
77 return -EFAULT;
78 }
79 return 0;
80}
81
82static void adf_disable_msix(struct adf_accel_pci *pci_dev_info)
83{
84 pci_disable_msix(pci_dev_info->pci_dev);
85}
86
87static irqreturn_t adf_msix_isr_bundle(int irq, void *bank_ptr)
88{
89 struct adf_etr_bank_data *bank = bank_ptr;
90
91 WRITE_CSR_INT_FLAG_AND_COL(bank->csr_addr, bank->bank_number, 0);
92 tasklet_hi_schedule(&bank->resp_hanlder);
93 return IRQ_HANDLED;
94}
95
96static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
97{
98 struct adf_accel_dev *accel_dev = dev_ptr;
99
100 pr_info("QAT: qat_dev%d spurious AE interrupt\n", accel_dev->accel_id);
101 return IRQ_HANDLED;
102}
103
104static int adf_request_irqs(struct adf_accel_dev *accel_dev)
105{
106 struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev;
107 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
108 struct msix_entry *msixe = pci_dev_info->msix_entries.entries;
109 struct adf_etr_data *etr_data = accel_dev->transport;
110 int ret, i;
111 char *name;
112
113 /* Request msix irq for all banks */
114 for (i = 0; i < hw_data->num_banks; i++) {
115 struct adf_etr_bank_data *bank = &etr_data->banks[i];
116 unsigned int cpu, cpus = num_online_cpus();
117
118 name = *(pci_dev_info->msix_entries.names + i);
119 snprintf(name, ADF_MAX_MSIX_VECTOR_NAME,
120 "qat%d-bundle%d", accel_dev->accel_id, i);
121 ret = request_irq(msixe[i].vector,
122 adf_msix_isr_bundle, 0, name, bank);
123 if (ret) {
124 pr_err("QAT: failed to enable irq %d for %s\n",
125 msixe[i].vector, name);
126 return ret;
127 }
128
129 cpu = ((accel_dev->accel_id * hw_data->num_banks) + i) % cpus;
130 irq_set_affinity_hint(msixe[i].vector, get_cpu_mask(cpu));
131 }
132
133 /* Request msix irq for AE */
134 name = *(pci_dev_info->msix_entries.names + i);
135 snprintf(name, ADF_MAX_MSIX_VECTOR_NAME,
136 "qat%d-ae-cluster", accel_dev->accel_id);
137 ret = request_irq(msixe[i].vector, adf_msix_isr_ae, 0, name, accel_dev);
138 if (ret) {
139 pr_err("QAT: failed to enable irq %d, for %s\n",
140 msixe[i].vector, name);
141 return ret;
142 }
143 return ret;
144}
145
146static void adf_free_irqs(struct adf_accel_dev *accel_dev)
147{
148 struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev;
149 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
150 struct msix_entry *msixe = pci_dev_info->msix_entries.entries;
151 struct adf_etr_data *etr_data = accel_dev->transport;
152 int i;
153
154 for (i = 0; i < hw_data->num_banks; i++) {
155 irq_set_affinity_hint(msixe[i].vector, NULL);
156 free_irq(msixe[i].vector, &etr_data->banks[i]);
157 }
158 irq_set_affinity_hint(msixe[i].vector, NULL);
159 free_irq(msixe[i].vector, accel_dev);
160}
161
162static int adf_isr_alloc_msix_entry_table(struct adf_accel_dev *accel_dev)
163{
164 int i;
165 char **names;
166 struct msix_entry *entries;
167 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
168 uint32_t msix_num_entries = hw_data->num_banks + 1;
169
170 entries = kzalloc_node(msix_num_entries * sizeof(*entries),
171 GFP_KERNEL, accel_dev->numa_node);
172 if (!entries)
173 return -ENOMEM;
174
175 names = kzalloc(msix_num_entries * sizeof(char *), GFP_KERNEL);
176 if (!names) {
177 kfree(entries);
178 return -ENOMEM;
179 }
180 for (i = 0; i < msix_num_entries; i++) {
181 *(names + i) = kzalloc(ADF_MAX_MSIX_VECTOR_NAME, GFP_KERNEL);
182 if (!(*(names + i)))
183 goto err;
184 }
185 accel_dev->accel_pci_dev.msix_entries.entries = entries;
186 accel_dev->accel_pci_dev.msix_entries.names = names;
187 return 0;
188err:
189 for (i = 0; i < msix_num_entries; i++) {
190 if (*(names + i))
191 kfree(*(names + i));
192 }
193 kfree(entries);
194 kfree(names);
195 return -ENOMEM;
196}
197
198static void adf_isr_free_msix_entry_table(struct adf_accel_dev *accel_dev)
199{
200 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
201 uint32_t msix_num_entries = hw_data->num_banks + 1;
202 char **names = accel_dev->accel_pci_dev.msix_entries.names;
203 int i;
204
205 kfree(accel_dev->accel_pci_dev.msix_entries.entries);
206 for (i = 0; i < msix_num_entries; i++) {
207 if (*(names + i))
208 kfree(*(names + i));
209 }
210 kfree(names);
211}
212
213static int adf_setup_bh(struct adf_accel_dev *accel_dev)
214{
215 struct adf_etr_data *priv_data = accel_dev->transport;
216 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
217 int i;
218
219 for (i = 0; i < hw_data->num_banks; i++)
220 tasklet_init(&priv_data->banks[i].resp_hanlder,
221 adf_response_handler,
222 (unsigned long)&priv_data->banks[i]);
223 return 0;
224}
225
226static void adf_cleanup_bh(struct adf_accel_dev *accel_dev)
227{
228 struct adf_etr_data *priv_data = accel_dev->transport;
229 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
230 int i;
231
232 for (i = 0; i < hw_data->num_banks; i++) {
233 tasklet_disable(&priv_data->banks[i].resp_hanlder);
234 tasklet_kill(&priv_data->banks[i].resp_hanlder);
235 }
236}
237
238void adf_isr_resource_free(struct adf_accel_dev *accel_dev)
239{
240 adf_free_irqs(accel_dev);
241 adf_cleanup_bh(accel_dev);
242 adf_disable_msix(&accel_dev->accel_pci_dev);
243 adf_isr_free_msix_entry_table(accel_dev);
244}
245
246int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev)
247{
248 int ret;
249
250 ret = adf_isr_alloc_msix_entry_table(accel_dev);
251 if (ret)
252 return ret;
253 if (adf_enable_msix(accel_dev))
254 goto err_out;
255
256 if (adf_setup_bh(accel_dev))
257 goto err_out;
258
259 if (adf_request_irqs(accel_dev))
260 goto err_out;
261
262 return 0;
263err_out:
264 adf_isr_resource_free(accel_dev);
265 return -EFAULT;
266}
diff --git a/drivers/crypto/qat/qat_dh895xcc/qat_admin.c b/drivers/crypto/qat/qat_dh895xcc/qat_admin.c
new file mode 100644
index 000000000000..55b7a8e48bad
--- /dev/null
+++ b/drivers/crypto/qat/qat_dh895xcc/qat_admin.c
@@ -0,0 +1,107 @@
1/*
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
4
5 GPL LICENSE SUMMARY
6 Copyright(c) 2014 Intel Corporation.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of version 2 of the GNU General Public License as
9 published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 Contact Information:
17 qat-linux@intel.com
18
19 BSD LICENSE
20 Copyright(c) 2014 Intel Corporation.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
23 are met:
24
25 * Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27 * Redistributions in binary form must reproduce the above copyright
28 notice, this list of conditions and the following disclaimer in
29 the documentation and/or other materials provided with the
30 distribution.
31 * Neither the name of Intel Corporation nor the names of its
32 contributors may be used to endorse or promote products derived
33 from this software without specific prior written permission.
34
35 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*/
47#include <icp_qat_fw_init_admin.h>
48#include <adf_accel_devices.h>
49#include <adf_common_drv.h>
50#include "adf_drv.h"
51
52static struct service_hndl qat_admin;
53
54static int qat_send_admin_cmd(struct adf_accel_dev *accel_dev, int cmd)
55{
56 struct adf_hw_device_data *hw_device = accel_dev->hw_device;
57 struct icp_qat_fw_init_admin_req req;
58 struct icp_qat_fw_init_admin_resp resp;
59 int i;
60
61 memset(&req, 0, sizeof(struct icp_qat_fw_init_admin_req));
62 req.init_admin_cmd_id = cmd;
63 for (i = 0; i < hw_device->get_num_aes(hw_device); i++) {
64 memset(&resp, 0, sizeof(struct icp_qat_fw_init_admin_resp));
65 if (adf_put_admin_msg_sync(accel_dev, i, &req, &resp) ||
66 resp.init_resp_hdr.status)
67 return -EFAULT;
68 }
69 return 0;
70}
71
72static int qat_admin_start(struct adf_accel_dev *accel_dev)
73{
74 return qat_send_admin_cmd(accel_dev, ICP_QAT_FW_INIT_ME);
75}
76
77static int qat_admin_event_handler(struct adf_accel_dev *accel_dev,
78 enum adf_event event)
79{
80 int ret;
81
82 switch (event) {
83 case ADF_EVENT_START:
84 ret = qat_admin_start(accel_dev);
85 break;
86 case ADF_EVENT_STOP:
87 case ADF_EVENT_INIT:
88 case ADF_EVENT_SHUTDOWN:
89 default:
90 ret = 0;
91 }
92 return ret;
93}
94
95int qat_admin_register(void)
96{
97 memset(&qat_admin, 0, sizeof(struct service_hndl));
98 qat_admin.event_hld = qat_admin_event_handler;
99 qat_admin.name = "qat_admin";
100 qat_admin.admin = 1;
101 return adf_service_register(&qat_admin);
102}
103
104int qat_admin_unregister(void)
105{
106 return adf_service_unregister(&qat_admin);
107}