Skip to content

Commit 1237608

Browse files
holger-denglerAlexander Gordeev
authored andcommitted
s390/ap: modularize ap bus
There is no hard requirement to have the ap bus statically in the kernel, so add an option to compile it as module. Cc: Tony Krowiak <akrowiak@linux.ibm.com> Cc: Halil Pasic <pasic@linux.ibm.com> Signed-off-by: Holger Dengler <dengler@linux.ibm.com> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent 2a483d3 commit 1237608

File tree

6 files changed

+44
-8
lines changed

6 files changed

+44
-8
lines changed

Documentation/arch/s390/vfio-ap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ These are the steps:
550550
following Kconfig elements selected:
551551
* IOMMU_SUPPORT
552552
* S390
553-
* ZCRYPT
553+
* AP
554554
* VFIO
555555
* KVM
556556

arch/s390/Kconfig

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,19 @@ config EADM_SCH
724724
To compile this driver as a module, choose M here: the
725725
module will be called eadm_sch.
726726

727+
config AP
728+
def_tristate y
729+
prompt "Support for Adjunct Processors (ap)"
730+
help
731+
This driver allows usage to Adjunct Processor (AP) devices via
732+
the ap bus, cards and queues. Supported Adjunct Processors are
733+
the CryptoExpress Cards (CEX).
734+
735+
To compile this driver as a module, choose M here: the
736+
module will be called ap.
737+
738+
If unsure, say Y (default).
739+
727740
config VFIO_CCW
728741
def_tristate n
729742
prompt "Support for VFIO-CCW subchannels"
@@ -740,7 +753,7 @@ config VFIO_AP
740753
prompt "VFIO support for AP devices"
741754
depends on KVM
742755
depends on VFIO
743-
depends on ZCRYPT
756+
depends on AP
744757
select VFIO_MDEV
745758
help
746759
This driver grants access to Adjunct Processor (AP) devices

drivers/crypto/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ config CRYPTO_DEV_GEODE
6767
config ZCRYPT
6868
tristate "Support for s390 cryptographic adapters"
6969
depends on S390
70+
depends on AP
7071
select HW_RANDOM
7172
help
7273
Select this option if you want to enable support for

drivers/s390/char/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ obj-$(CONFIG_SCLP_VT220_TTY) += sclp_vt220.o
3232

3333
obj-$(CONFIG_PCI) += sclp_pci.o
3434

35-
obj-$(subst m,y,$(CONFIG_ZCRYPT)) += sclp_ap.o
35+
obj-$(subst m,y,$(CONFIG_AP)) += sclp_ap.o
3636

3737
obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o
3838
obj-$(CONFIG_VMCP) += vmcp.o

drivers/s390/crypto/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55

66
ap-objs := ap_bus.o ap_card.o ap_queue.o
7-
obj-$(subst m,y,$(CONFIG_ZCRYPT)) += ap.o
7+
obj-$(CONFIG_AP) += ap.o
88
# zcrypt_api.o and zcrypt_msgtype*.o depend on ap.o
99
zcrypt-objs := zcrypt_api.o zcrypt_card.o zcrypt_queue.o
1010
zcrypt-objs += zcrypt_msgtype6.o zcrypt_msgtype50.o

drivers/s390/crypto/ap_bus.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
#include "ap_bus.h"
4545
#include "ap_debug.h"
4646

47-
/*
48-
* Module parameters; note though this file itself isn't modular.
49-
*/
47+
MODULE_AUTHOR("IBM Corporation");
48+
MODULE_DESCRIPTION("Adjunct Processor Bus driver");
49+
MODULE_LICENSE("GPL");
50+
5051
int ap_domain_index = -1; /* Adjunct Processor Domain Index */
5152
static DEFINE_SPINLOCK(ap_domain_lock);
5253
module_param_named(domain, ap_domain_index, int, 0440);
@@ -2284,6 +2285,16 @@ static void ap_scan_bus_wq_callback(struct work_struct *unused)
22842285
}
22852286
}
22862287

2288+
static inline void __exit ap_async_exit(void)
2289+
{
2290+
if (ap_thread_flag)
2291+
ap_poll_thread_stop();
2292+
chsc_notifier_unregister(&ap_bus_nb);
2293+
cancel_work(&ap_scan_bus_work);
2294+
hrtimer_cancel(&ap_poll_timer);
2295+
timer_delete(&ap_scan_bus_timer);
2296+
}
2297+
22872298
static inline int __init ap_async_init(void)
22882299
{
22892300
int rc;
@@ -2451,4 +2462,15 @@ static int __init ap_module_init(void)
24512462
ap_debug_exit();
24522463
return rc;
24532464
}
2454-
device_initcall(ap_module_init);
2465+
2466+
static void __exit ap_module_exit(void)
2467+
{
2468+
ap_async_exit();
2469+
ap_irq_exit();
2470+
root_device_unregister(ap_root_device);
2471+
bus_unregister(&ap_bus_type);
2472+
ap_debug_exit();
2473+
}
2474+
2475+
module_init(ap_module_init);
2476+
module_exit(ap_module_exit);

0 commit comments

Comments
 (0)