Skip to content

Commit 0fef40b

Browse files
hfreudeAlexander Gordeev
authored andcommitted
s390/ap: fix crash on older machines based on QCI info missing
On older z series machines (z12 and older) there is no QCI info available. The AP code took care of this and the AP bus scan then switched to simple probing via TAPQ. With commit 2839158 ("s390/ap: notify drivers on config changed and scan complete callbacks") some code was introduced which silently assumed that the QCI info is always available. However, with KVM simulating an older machine (z12) the result was a kernel crash. Funnily the same crash does not happen on LPAR - maybe because NULL is a valid pointer and reading some data from address 0 also works fine. This fix now improves the code to be aware that the QCI instruction may not be available on older machines and thus the two pointers to QCI info structs may simple be NULL. However, on a machine not providing the QCI info the two callbacks to the zcrypt device drivers on_config_changed() and on_scan_complete() provide parameters which are pointers to a QCI info struct. These both callbacks are NOT served if there is no QCI info available. The only consumer of these callbacks is the vfio device driver. This driver only supports CEX4 and higher. All physical machines which are able to provide CEX4 cards have QCI support available. So there is no sense in for example fill the QCI info struct by hand with looping over cards and queues and TAPQ each APQN. Signed-off-by: Harald Freudenberger <[email protected]> Signed-off-by: Tony Krowiak <[email protected]> Cc: [email protected] Fixes: 2839158 ("s390/ap: notify drivers on config changed and scan complete callbacks") Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 7b6670b commit 0fef40b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/s390/crypto/ap_bus.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,9 @@ static inline void ap_scan_adapter(int ap)
20862086
*/
20872087
static bool ap_get_configuration(void)
20882088
{
2089+
if (!ap_qci_info) /* QCI not supported */
2090+
return false;
2091+
20892092
memcpy(ap_qci_info_old, ap_qci_info, sizeof(*ap_qci_info));
20902093
ap_fetch_qci_info(ap_qci_info);
20912094

drivers/s390/crypto/ap_bus.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,16 @@ struct ap_driver {
148148
/*
149149
* Called at the start of the ap bus scan function when
150150
* the crypto config information (qci) has changed.
151+
* This callback is not invoked if there is no AP
152+
* QCI support available.
151153
*/
152154
void (*on_config_changed)(struct ap_config_info *new_config_info,
153155
struct ap_config_info *old_config_info);
154156
/*
155157
* Called at the end of the ap bus scan function when
156158
* the crypto config information (qci) has changed.
159+
* This callback is not invoked if there is no AP
160+
* QCI support available.
157161
*/
158162
void (*on_scan_complete)(struct ap_config_info *new_config_info,
159163
struct ap_config_info *old_config_info);

0 commit comments

Comments
 (0)