diff options
author | Allan, Bruce W <bruce.w.allan@intel.com> | 2015-01-09 14:54:58 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-01-13 06:30:45 -0500 |
commit | 22e4dda06dd0fa2a56e573049411479a1f759cbb (patch) | |
tree | 993ee6abf4fa732e01297c3df8730f25c743541b /drivers/crypto | |
parent | 8a45ac12ec5b6ee67f8559c78ae11d9af8b821ee (diff) |
crypto: qat - fix device reset flow
When the device needs a reset, e.g. when an uncorrectable PCIe AER event
occurs, various services/data structures need to be cleaned up, the
hardware reset and the services/data structures initialized and started.
The code to perform the cleanup and initialization was not performed when
a device reset was done.
This patch moves some of the initialization code out of the .probe entry-
point into a separate function that is now called during probe as well as
after the hardware has been reset. Similarly, a new function is added for
first cleaning up these services/data structures prior to resetting. The
new functions are adf_dev_init() and adf_dev_shutdown(), respectively, for
which there are already prototypes but no actual functions just yet and are
now called when the device is reset and during probe/cleanup of the driver.
The down and up flows via ioctl calls has similarly been updated.
In addition, there are two other bugs in the reset flow - one in the logic
for determining whether to schedule a device reset upon receiving an
uncorrectable AER event which prevents the reset flow from being initiated,
and another with clearing the status bit indicating a device is configured
(when resetting the device the configuration remains across the reset so
the bit should not be cleared, otherwise, the necessary services will not
be re-started in adf_dev_start() after the reset - clear the bit only when
actually deleting the configuration).
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_accel_devices.h | 5 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_aer.c | 7 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_cfg.c | 2 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_common_drv.h | 2 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_ctl_drv.c | 7 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_init.c | 91 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 19 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_dh895xcc/adf_drv.c | 42 |
8 files changed, 128 insertions, 47 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h index 2ed425664a16..ed226cee6e29 100644 --- a/drivers/crypto/qat/qat_common/adf_accel_devices.h +++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h | |||
@@ -148,6 +148,11 @@ struct adf_hw_device_data { | |||
148 | int (*alloc_irq)(struct adf_accel_dev *accel_dev); | 148 | int (*alloc_irq)(struct adf_accel_dev *accel_dev); |
149 | void (*free_irq)(struct adf_accel_dev *accel_dev); | 149 | void (*free_irq)(struct adf_accel_dev *accel_dev); |
150 | void (*enable_error_correction)(struct adf_accel_dev *accel_dev); | 150 | void (*enable_error_correction)(struct adf_accel_dev *accel_dev); |
151 | int (*init_admin_comms)(struct adf_accel_dev *accel_dev); | ||
152 | void (*exit_admin_comms)(struct adf_accel_dev *accel_dev); | ||
153 | int (*init_arb)(struct adf_accel_dev *accel_dev); | ||
154 | void (*exit_arb)(struct adf_accel_dev *accel_dev); | ||
155 | void (*enable_ints)(struct adf_accel_dev *accel_dev); | ||
151 | const char *fw_name; | 156 | const char *fw_name; |
152 | uint32_t pci_dev_id; | 157 | uint32_t pci_dev_id; |
153 | uint32_t fuses; | 158 | uint32_t fuses; |
diff --git a/drivers/crypto/qat/qat_common/adf_aer.c b/drivers/crypto/qat/qat_common/adf_aer.c index 10ce4a2854ab..740dc9e1c70c 100644 --- a/drivers/crypto/qat/qat_common/adf_aer.c +++ b/drivers/crypto/qat/qat_common/adf_aer.c | |||
@@ -125,8 +125,9 @@ static void adf_device_reset_worker(struct work_struct *work) | |||
125 | 125 | ||
126 | adf_dev_restarting_notify(accel_dev); | 126 | adf_dev_restarting_notify(accel_dev); |
127 | adf_dev_stop(accel_dev); | 127 | adf_dev_stop(accel_dev); |
128 | adf_dev_shutdown(accel_dev); | ||
128 | adf_dev_restore(accel_dev); | 129 | adf_dev_restore(accel_dev); |
129 | if (adf_dev_start(accel_dev)) { | 130 | if (adf_dev_init(accel_dev) || adf_dev_start(accel_dev)) { |
130 | /* The device hanged and we can't restart it so stop here */ | 131 | /* The device hanged and we can't restart it so stop here */ |
131 | dev_err(&GET_DEV(accel_dev), "Restart device failed\n"); | 132 | dev_err(&GET_DEV(accel_dev), "Restart device failed\n"); |
132 | kfree(reset_data); | 133 | kfree(reset_data); |
@@ -148,8 +149,8 @@ static int adf_dev_aer_schedule_reset(struct adf_accel_dev *accel_dev, | |||
148 | { | 149 | { |
149 | struct adf_reset_dev_data *reset_data; | 150 | struct adf_reset_dev_data *reset_data; |
150 | 151 | ||
151 | if (adf_dev_started(accel_dev) && | 152 | if (!adf_dev_started(accel_dev) || |
152 | !test_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) | 153 | test_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) |
153 | return 0; | 154 | return 0; |
154 | 155 | ||
155 | set_bit(ADF_STATUS_RESTARTING, &accel_dev->status); | 156 | set_bit(ADF_STATUS_RESTARTING, &accel_dev->status); |
diff --git a/drivers/crypto/qat/qat_common/adf_cfg.c b/drivers/crypto/qat/qat_common/adf_cfg.c index aba7f1d043fb..de16da9070a5 100644 --- a/drivers/crypto/qat/qat_common/adf_cfg.c +++ b/drivers/crypto/qat/qat_common/adf_cfg.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/seq_file.h> | 50 | #include <linux/seq_file.h> |
51 | #include "adf_accel_devices.h" | 51 | #include "adf_accel_devices.h" |
52 | #include "adf_cfg.h" | 52 | #include "adf_cfg.h" |
53 | #include "adf_common_drv.h" | ||
53 | 54 | ||
54 | static DEFINE_MUTEX(qat_cfg_read_lock); | 55 | static DEFINE_MUTEX(qat_cfg_read_lock); |
55 | 56 | ||
@@ -159,6 +160,7 @@ void adf_cfg_del_all(struct adf_accel_dev *accel_dev) | |||
159 | down_write(&dev_cfg_data->lock); | 160 | down_write(&dev_cfg_data->lock); |
160 | adf_cfg_section_del_all(&dev_cfg_data->sec_list); | 161 | adf_cfg_section_del_all(&dev_cfg_data->sec_list); |
161 | up_write(&dev_cfg_data->lock); | 162 | up_write(&dev_cfg_data->lock); |
163 | clear_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); | ||
162 | } | 164 | } |
163 | 165 | ||
164 | /** | 166 | /** |
diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h index 5e8f9d431e5d..a62e485c8786 100644 --- a/drivers/crypto/qat/qat_common/adf_common_drv.h +++ b/drivers/crypto/qat/qat_common/adf_common_drv.h | |||
@@ -93,7 +93,7 @@ int adf_service_unregister(struct service_hndl *service); | |||
93 | int adf_dev_init(struct adf_accel_dev *accel_dev); | 93 | int adf_dev_init(struct adf_accel_dev *accel_dev); |
94 | int adf_dev_start(struct adf_accel_dev *accel_dev); | 94 | int adf_dev_start(struct adf_accel_dev *accel_dev); |
95 | int adf_dev_stop(struct adf_accel_dev *accel_dev); | 95 | int adf_dev_stop(struct adf_accel_dev *accel_dev); |
96 | int adf_dev_shutdown(struct adf_accel_dev *accel_dev); | 96 | void adf_dev_shutdown(struct adf_accel_dev *accel_dev); |
97 | 97 | ||
98 | int adf_ctl_dev_register(void); | 98 | int adf_ctl_dev_register(void); |
99 | void adf_ctl_dev_unregister(void); | 99 | void adf_ctl_dev_unregister(void); |
diff --git a/drivers/crypto/qat/qat_common/adf_ctl_drv.c b/drivers/crypto/qat/qat_common/adf_ctl_drv.c index 7ee93f881db6..74207a6f0516 100644 --- a/drivers/crypto/qat/qat_common/adf_ctl_drv.c +++ b/drivers/crypto/qat/qat_common/adf_ctl_drv.c | |||
@@ -282,6 +282,8 @@ static int adf_ctl_stop_devices(uint32_t id) | |||
282 | if (adf_dev_stop(accel_dev)) { | 282 | if (adf_dev_stop(accel_dev)) { |
283 | pr_err("QAT: Failed to stop qat_dev%d\n", id); | 283 | pr_err("QAT: Failed to stop qat_dev%d\n", id); |
284 | ret = -EFAULT; | 284 | ret = -EFAULT; |
285 | } else { | ||
286 | adf_dev_shutdown(accel_dev); | ||
285 | } | 287 | } |
286 | } | 288 | } |
287 | } | 289 | } |
@@ -343,7 +345,9 @@ static int adf_ctl_ioctl_dev_start(struct file *fp, unsigned int cmd, | |||
343 | if (!adf_dev_started(accel_dev)) { | 345 | if (!adf_dev_started(accel_dev)) { |
344 | pr_info("QAT: Starting acceleration device qat_dev%d.\n", | 346 | pr_info("QAT: Starting acceleration device qat_dev%d.\n", |
345 | ctl_data->device_id); | 347 | ctl_data->device_id); |
346 | ret = adf_dev_start(accel_dev); | 348 | ret = adf_dev_init(accel_dev); |
349 | if (!ret) | ||
350 | ret = adf_dev_start(accel_dev); | ||
347 | } else { | 351 | } else { |
348 | pr_info("QAT: Acceleration device qat_dev%d already started.\n", | 352 | pr_info("QAT: Acceleration device qat_dev%d already started.\n", |
349 | ctl_data->device_id); | 353 | ctl_data->device_id); |
@@ -351,6 +355,7 @@ static int adf_ctl_ioctl_dev_start(struct file *fp, unsigned int cmd, | |||
351 | if (ret) { | 355 | if (ret) { |
352 | pr_err("QAT: Failed to start qat_dev%d\n", ctl_data->device_id); | 356 | pr_err("QAT: Failed to start qat_dev%d\n", ctl_data->device_id); |
353 | adf_dev_stop(accel_dev); | 357 | adf_dev_stop(accel_dev); |
358 | adf_dev_shutdown(accel_dev); | ||
354 | } | 359 | } |
355 | out: | 360 | out: |
356 | kfree(ctl_data); | 361 | kfree(ctl_data); |
diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c index 5c0e47a00a87..a3afa0ff9ec6 100644 --- a/drivers/crypto/qat/qat_common/adf_init.c +++ b/drivers/crypto/qat/qat_common/adf_init.c | |||
@@ -108,26 +108,47 @@ int adf_service_unregister(struct service_hndl *service) | |||
108 | EXPORT_SYMBOL_GPL(adf_service_unregister); | 108 | EXPORT_SYMBOL_GPL(adf_service_unregister); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * adf_dev_start() - Start acceleration service for the given accel device | 111 | * adf_dev_init() - Init data structures and services for the given accel device |
112 | * @accel_dev: Pointer to acceleration device. | 112 | * @accel_dev: Pointer to acceleration device. |
113 | * | 113 | * |
114 | * Function notifies all the registered services that the acceleration device | 114 | * Initialize the ring data structures and the admin comms and arbitration |
115 | * is ready to be used. | 115 | * services. |
116 | * To be used by QAT device specific drivers. | ||
117 | * | 116 | * |
118 | * Return: 0 on success, error code othewise. | 117 | * Return: 0 on success, error code othewise. |
119 | */ | 118 | */ |
120 | int adf_dev_start(struct adf_accel_dev *accel_dev) | 119 | int adf_dev_init(struct adf_accel_dev *accel_dev) |
121 | { | 120 | { |
122 | struct service_hndl *service; | 121 | struct service_hndl *service; |
123 | struct list_head *list_itr; | 122 | struct list_head *list_itr; |
124 | struct adf_hw_device_data *hw_data = accel_dev->hw_device; | 123 | struct adf_hw_device_data *hw_data = accel_dev->hw_device; |
125 | 124 | ||
125 | if (!hw_data) { | ||
126 | dev_err(&GET_DEV(accel_dev), | ||
127 | "QAT: Failed to init device - hw_data not set\n"); | ||
128 | return -EFAULT; | ||
129 | } | ||
130 | |||
126 | if (!test_bit(ADF_STATUS_CONFIGURED, &accel_dev->status)) { | 131 | if (!test_bit(ADF_STATUS_CONFIGURED, &accel_dev->status)) { |
127 | pr_info("QAT: Device not configured\n"); | 132 | pr_info("QAT: Device not configured\n"); |
128 | return -EFAULT; | 133 | return -EFAULT; |
129 | } | 134 | } |
130 | set_bit(ADF_STATUS_STARTING, &accel_dev->status); | 135 | |
136 | if (adf_init_etr_data(accel_dev)) { | ||
137 | dev_err(&GET_DEV(accel_dev), "Failed initialize etr\n"); | ||
138 | return -EFAULT; | ||
139 | } | ||
140 | |||
141 | if (hw_data->init_admin_comms && hw_data->init_admin_comms(accel_dev)) { | ||
142 | dev_err(&GET_DEV(accel_dev), "Failed initialize admin comms\n"); | ||
143 | return -EFAULT; | ||
144 | } | ||
145 | |||
146 | if (hw_data->init_arb && hw_data->init_arb(accel_dev)) { | ||
147 | dev_err(&GET_DEV(accel_dev), "Failed initialize hw arbiter\n"); | ||
148 | return -EFAULT; | ||
149 | } | ||
150 | |||
151 | hw_data->enable_ints(accel_dev); | ||
131 | 152 | ||
132 | if (adf_ae_init(accel_dev)) { | 153 | if (adf_ae_init(accel_dev)) { |
133 | pr_err("QAT: Failed to initialise Acceleration Engine\n"); | 154 | pr_err("QAT: Failed to initialise Acceleration Engine\n"); |
@@ -178,6 +199,27 @@ int adf_dev_start(struct adf_accel_dev *accel_dev) | |||
178 | 199 | ||
179 | hw_data->enable_error_correction(accel_dev); | 200 | hw_data->enable_error_correction(accel_dev); |
180 | 201 | ||
202 | return 0; | ||
203 | } | ||
204 | EXPORT_SYMBOL_GPL(adf_dev_init); | ||
205 | |||
206 | /** | ||
207 | * adf_dev_start() - Start acceleration service for the given accel device | ||
208 | * @accel_dev: Pointer to acceleration device. | ||
209 | * | ||
210 | * Function notifies all the registered services that the acceleration device | ||
211 | * is ready to be used. | ||
212 | * To be used by QAT device specific drivers. | ||
213 | * | ||
214 | * Return: 0 on success, error code othewise. | ||
215 | */ | ||
216 | int adf_dev_start(struct adf_accel_dev *accel_dev) | ||
217 | { | ||
218 | struct service_hndl *service; | ||
219 | struct list_head *list_itr; | ||
220 | |||
221 | set_bit(ADF_STATUS_STARTING, &accel_dev->status); | ||
222 | |||
181 | if (adf_ae_start(accel_dev)) { | 223 | if (adf_ae_start(accel_dev)) { |
182 | pr_err("QAT: AE Start Failed\n"); | 224 | pr_err("QAT: AE Start Failed\n"); |
183 | return -EFAULT; | 225 | return -EFAULT; |
@@ -232,7 +274,6 @@ EXPORT_SYMBOL_GPL(adf_dev_start); | |||
232 | */ | 274 | */ |
233 | int adf_dev_stop(struct adf_accel_dev *accel_dev) | 275 | int adf_dev_stop(struct adf_accel_dev *accel_dev) |
234 | { | 276 | { |
235 | struct adf_hw_device_data *hw_data = accel_dev->hw_device; | ||
236 | struct service_hndl *service; | 277 | struct service_hndl *service; |
237 | struct list_head *list_itr; | 278 | struct list_head *list_itr; |
238 | int ret, wait = 0; | 279 | int ret, wait = 0; |
@@ -241,7 +282,6 @@ int adf_dev_stop(struct adf_accel_dev *accel_dev) | |||
241 | !test_bit(ADF_STATUS_STARTING, &accel_dev->status)) { | 282 | !test_bit(ADF_STATUS_STARTING, &accel_dev->status)) { |
242 | return 0; | 283 | return 0; |
243 | } | 284 | } |
244 | clear_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); | ||
245 | clear_bit(ADF_STATUS_STARTING, &accel_dev->status); | 285 | clear_bit(ADF_STATUS_STARTING, &accel_dev->status); |
246 | clear_bit(ADF_STATUS_STARTED, &accel_dev->status); | 286 | clear_bit(ADF_STATUS_STARTED, &accel_dev->status); |
247 | 287 | ||
@@ -285,6 +325,29 @@ int adf_dev_stop(struct adf_accel_dev *accel_dev) | |||
285 | clear_bit(ADF_STATUS_AE_STARTED, &accel_dev->status); | 325 | clear_bit(ADF_STATUS_AE_STARTED, &accel_dev->status); |
286 | } | 326 | } |
287 | 327 | ||
328 | return 0; | ||
329 | } | ||
330 | EXPORT_SYMBOL_GPL(adf_dev_stop); | ||
331 | |||
332 | /** | ||
333 | * adf_dev_shutdown() - shutdown acceleration services and data strucutures | ||
334 | * @accel_dev: Pointer to acceleration device | ||
335 | * | ||
336 | * Cleanup the ring data structures and the admin comms and arbitration | ||
337 | * services. | ||
338 | */ | ||
339 | void adf_dev_shutdown(struct adf_accel_dev *accel_dev) | ||
340 | { | ||
341 | struct adf_hw_device_data *hw_data = accel_dev->hw_device; | ||
342 | struct service_hndl *service; | ||
343 | struct list_head *list_itr; | ||
344 | |||
345 | if (!hw_data) { | ||
346 | dev_err(&GET_DEV(accel_dev), | ||
347 | "QAT: Failed to shutdown device - hw_data not set\n"); | ||
348 | return; | ||
349 | } | ||
350 | |||
288 | if (test_bit(ADF_STATUS_AE_UCODE_LOADED, &accel_dev->status)) { | 351 | if (test_bit(ADF_STATUS_AE_UCODE_LOADED, &accel_dev->status)) { |
289 | if (adf_ae_fw_release(accel_dev)) | 352 | if (adf_ae_fw_release(accel_dev)) |
290 | pr_err("QAT: Failed to release the ucode\n"); | 353 | pr_err("QAT: Failed to release the ucode\n"); |
@@ -335,9 +398,15 @@ int adf_dev_stop(struct adf_accel_dev *accel_dev) | |||
335 | if (!test_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) | 398 | if (!test_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) |
336 | adf_cfg_del_all(accel_dev); | 399 | adf_cfg_del_all(accel_dev); |
337 | 400 | ||
338 | return 0; | 401 | if (hw_data->exit_arb) |
402 | hw_data->exit_arb(accel_dev); | ||
403 | |||
404 | if (hw_data->exit_admin_comms) | ||
405 | hw_data->exit_admin_comms(accel_dev); | ||
406 | |||
407 | adf_cleanup_etr_data(accel_dev); | ||
339 | } | 408 | } |
340 | EXPORT_SYMBOL_GPL(adf_dev_stop); | 409 | EXPORT_SYMBOL_GPL(adf_dev_shutdown); |
341 | 410 | ||
342 | int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev) | 411 | int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev) |
343 | { | 412 | { |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c index ef05825cc651..6a735d5c0e37 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | |||
@@ -46,6 +46,7 @@ | |||
46 | */ | 46 | */ |
47 | #include <adf_accel_devices.h> | 47 | #include <adf_accel_devices.h> |
48 | #include "adf_dh895xcc_hw_data.h" | 48 | #include "adf_dh895xcc_hw_data.h" |
49 | #include "adf_common_drv.h" | ||
49 | #include "adf_drv.h" | 50 | #include "adf_drv.h" |
50 | 51 | ||
51 | /* Worker thread to service arbiter mappings based on dev SKUs */ | 52 | /* Worker thread to service arbiter mappings based on dev SKUs */ |
@@ -182,6 +183,19 @@ static void adf_enable_error_correction(struct adf_accel_dev *accel_dev) | |||
182 | } | 183 | } |
183 | } | 184 | } |
184 | 185 | ||
186 | static void adf_enable_ints(struct adf_accel_dev *accel_dev) | ||
187 | { | ||
188 | void __iomem *addr; | ||
189 | |||
190 | addr = (&GET_BARS(accel_dev)[ADF_DH895XCC_PMISC_BAR])->virt_addr; | ||
191 | |||
192 | /* Enable bundle and misc interrupts */ | ||
193 | ADF_CSR_WR(addr, ADF_DH895XCC_SMIAPF0_MASK_OFFSET, | ||
194 | ADF_DH895XCC_SMIA0_MASK); | ||
195 | ADF_CSR_WR(addr, ADF_DH895XCC_SMIAPF1_MASK_OFFSET, | ||
196 | ADF_DH895XCC_SMIA1_MASK); | ||
197 | } | ||
198 | |||
185 | void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) | 199 | void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) |
186 | { | 200 | { |
187 | hw_data->dev_class = &dh895xcc_class; | 201 | hw_data->dev_class = &dh895xcc_class; |
@@ -206,6 +220,11 @@ void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) | |||
206 | hw_data->get_misc_bar_id = get_misc_bar_id; | 220 | hw_data->get_misc_bar_id = get_misc_bar_id; |
207 | hw_data->get_sku = get_sku; | 221 | hw_data->get_sku = get_sku; |
208 | hw_data->fw_name = ADF_DH895XCC_FW; | 222 | hw_data->fw_name = ADF_DH895XCC_FW; |
223 | hw_data->init_admin_comms = adf_init_admin_comms; | ||
224 | hw_data->exit_admin_comms = adf_exit_admin_comms; | ||
225 | hw_data->init_arb = adf_init_arb; | ||
226 | hw_data->exit_arb = adf_exit_arb; | ||
227 | hw_data->enable_ints = adf_enable_ints; | ||
209 | } | 228 | } |
210 | 229 | ||
211 | void adf_clean_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) | 230 | void adf_clean_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c index 948f66be262b..8ffdb95c9804 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c | |||
@@ -90,9 +90,7 @@ static void adf_cleanup_accel(struct adf_accel_dev *accel_dev) | |||
90 | struct adf_accel_pci *accel_pci_dev = &accel_dev->accel_pci_dev; | 90 | struct adf_accel_pci *accel_pci_dev = &accel_dev->accel_pci_dev; |
91 | int i; | 91 | int i; |
92 | 92 | ||
93 | adf_exit_admin_comms(accel_dev); | 93 | adf_dev_shutdown(accel_dev); |
94 | adf_exit_arb(accel_dev); | ||
95 | adf_cleanup_etr_data(accel_dev); | ||
96 | 94 | ||
97 | for (i = 0; i < ADF_PCI_MAX_BARS; i++) { | 95 | for (i = 0; i < ADF_PCI_MAX_BARS; i++) { |
98 | struct adf_bar *bar = &accel_pci_dev->pci_bars[i]; | 96 | struct adf_bar *bar = &accel_pci_dev->pci_bars[i]; |
@@ -119,7 +117,7 @@ static void adf_cleanup_accel(struct adf_accel_dev *accel_dev) | |||
119 | kfree(accel_dev); | 117 | kfree(accel_dev); |
120 | } | 118 | } |
121 | 119 | ||
122 | static int qat_dev_start(struct adf_accel_dev *accel_dev) | 120 | static int adf_dev_configure(struct adf_accel_dev *accel_dev) |
123 | { | 121 | { |
124 | int cpus = num_online_cpus(); | 122 | int cpus = num_online_cpus(); |
125 | int banks = GET_MAX_BANKS(accel_dev); | 123 | int banks = GET_MAX_BANKS(accel_dev); |
@@ -206,7 +204,7 @@ static int qat_dev_start(struct adf_accel_dev *accel_dev) | |||
206 | goto err; | 204 | goto err; |
207 | 205 | ||
208 | set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); | 206 | set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); |
209 | return adf_dev_start(accel_dev); | 207 | return 0; |
210 | err: | 208 | err: |
211 | dev_err(&GET_DEV(accel_dev), "Failed to start QAT accel dev\n"); | 209 | dev_err(&GET_DEV(accel_dev), "Failed to start QAT accel dev\n"); |
212 | return -EINVAL; | 210 | return -EINVAL; |
@@ -217,7 +215,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
217 | struct adf_accel_dev *accel_dev; | 215 | struct adf_accel_dev *accel_dev; |
218 | struct adf_accel_pci *accel_pci_dev; | 216 | struct adf_accel_pci *accel_pci_dev; |
219 | struct adf_hw_device_data *hw_data; | 217 | struct adf_hw_device_data *hw_data; |
220 | void __iomem *pmisc_bar_addr = NULL; | ||
221 | char name[ADF_DEVICE_NAME_LENGTH]; | 218 | char name[ADF_DEVICE_NAME_LENGTH]; |
222 | unsigned int i, bar_nr; | 219 | unsigned int i, bar_nr; |
223 | int ret; | 220 | int ret; |
@@ -347,8 +344,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
347 | ret = -EFAULT; | 344 | ret = -EFAULT; |
348 | goto out_err; | 345 | goto out_err; |
349 | } | 346 | } |
350 | if (i == ADF_DH895XCC_PMISC_BAR) | ||
351 | pmisc_bar_addr = bar->virt_addr; | ||
352 | } | 347 | } |
353 | pci_set_master(pdev); | 348 | pci_set_master(pdev); |
354 | 349 | ||
@@ -358,36 +353,21 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
358 | goto out_err; | 353 | goto out_err; |
359 | } | 354 | } |
360 | 355 | ||
361 | if (adf_init_etr_data(accel_dev)) { | ||
362 | dev_err(&pdev->dev, "Failed initialize etr\n"); | ||
363 | ret = -EFAULT; | ||
364 | goto out_err; | ||
365 | } | ||
366 | |||
367 | if (adf_init_admin_comms(accel_dev)) { | ||
368 | dev_err(&pdev->dev, "Failed initialize admin comms\n"); | ||
369 | ret = -EFAULT; | ||
370 | goto out_err; | ||
371 | } | ||
372 | |||
373 | if (adf_init_arb(accel_dev)) { | ||
374 | dev_err(&pdev->dev, "Failed initialize hw arbiter\n"); | ||
375 | ret = -EFAULT; | ||
376 | goto out_err; | ||
377 | } | ||
378 | if (pci_save_state(pdev)) { | 356 | if (pci_save_state(pdev)) { |
379 | dev_err(&pdev->dev, "Failed to save pci state\n"); | 357 | dev_err(&pdev->dev, "Failed to save pci state\n"); |
380 | ret = -ENOMEM; | 358 | ret = -ENOMEM; |
381 | goto out_err; | 359 | goto out_err; |
382 | } | 360 | } |
383 | 361 | ||
384 | /* Enable bundle and misc interrupts */ | 362 | ret = adf_dev_configure(accel_dev); |
385 | ADF_CSR_WR(pmisc_bar_addr, ADF_DH895XCC_SMIAPF0_MASK_OFFSET, | 363 | if (ret) |
386 | ADF_DH895XCC_SMIA0_MASK); | 364 | goto out_err; |
387 | ADF_CSR_WR(pmisc_bar_addr, ADF_DH895XCC_SMIAPF1_MASK_OFFSET, | 365 | |
388 | ADF_DH895XCC_SMIA1_MASK); | 366 | ret = adf_dev_init(accel_dev); |
367 | if (ret) | ||
368 | goto out_err; | ||
389 | 369 | ||
390 | ret = qat_dev_start(accel_dev); | 370 | ret = adf_dev_start(accel_dev); |
391 | if (ret) { | 371 | if (ret) { |
392 | adf_dev_stop(accel_dev); | 372 | adf_dev_stop(accel_dev); |
393 | goto out_err; | 373 | goto out_err; |