Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Holger Dengler and committed by
Alexander Gordeev
12376084 2a483d33

+44 -8
+1 -1
Documentation/arch/s390/vfio-ap.rst
··· 550 550 following Kconfig elements selected: 551 551 * IOMMU_SUPPORT 552 552 * S390 553 - * ZCRYPT 553 + * AP 554 554 * VFIO 555 555 * KVM 556 556
+14 -1
arch/s390/Kconfig
··· 724 724 To compile this driver as a module, choose M here: the 725 725 module will be called eadm_sch. 726 726 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 + 727 740 config VFIO_CCW 728 741 def_tristate n 729 742 prompt "Support for VFIO-CCW subchannels" ··· 753 740 prompt "VFIO support for AP devices" 754 741 depends on KVM 755 742 depends on VFIO 756 - depends on ZCRYPT 743 + depends on AP 757 744 select VFIO_MDEV 758 745 help 759 746 This driver grants access to Adjunct Processor (AP) devices
+1
drivers/crypto/Kconfig
··· 67 67 config ZCRYPT 68 68 tristate "Support for s390 cryptographic adapters" 69 69 depends on S390 70 + depends on AP 70 71 select HW_RANDOM 71 72 help 72 73 Select this option if you want to enable support for
+1 -1
drivers/s390/char/Makefile
··· 32 32 33 33 obj-$(CONFIG_PCI) += sclp_pci.o 34 34 35 - obj-$(subst m,y,$(CONFIG_ZCRYPT)) += sclp_ap.o 35 + obj-$(subst m,y,$(CONFIG_AP)) += sclp_ap.o 36 36 37 37 obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o 38 38 obj-$(CONFIG_VMCP) += vmcp.o
+1 -1
drivers/s390/crypto/Makefile
··· 4 4 # 5 5 6 6 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 8 8 # zcrypt_api.o and zcrypt_msgtype*.o depend on ap.o 9 9 zcrypt-objs := zcrypt_api.o zcrypt_card.o zcrypt_queue.o 10 10 zcrypt-objs += zcrypt_msgtype6.o zcrypt_msgtype50.o
+26 -4
drivers/s390/crypto/ap_bus.c
··· 44 44 #include "ap_bus.h" 45 45 #include "ap_debug.h" 46 46 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 + 50 51 int ap_domain_index = -1; /* Adjunct Processor Domain Index */ 51 52 static DEFINE_SPINLOCK(ap_domain_lock); 52 53 module_param_named(domain, ap_domain_index, int, 0440); ··· 2285 2284 } 2286 2285 } 2287 2286 2287 + static inline void __exit ap_async_exit(void) 2288 + { 2289 + if (ap_thread_flag) 2290 + ap_poll_thread_stop(); 2291 + chsc_notifier_unregister(&ap_bus_nb); 2292 + cancel_work(&ap_scan_bus_work); 2293 + hrtimer_cancel(&ap_poll_timer); 2294 + timer_delete(&ap_scan_bus_timer); 2295 + } 2296 + 2288 2297 static inline int __init ap_async_init(void) 2289 2298 { 2290 2299 int rc; ··· 2462 2451 ap_debug_exit(); 2463 2452 return rc; 2464 2453 } 2465 - device_initcall(ap_module_init); 2454 + 2455 + static void __exit ap_module_exit(void) 2456 + { 2457 + ap_async_exit(); 2458 + ap_irq_exit(); 2459 + root_device_unregister(ap_root_device); 2460 + bus_unregister(&ap_bus_type); 2461 + ap_debug_exit(); 2462 + } 2463 + 2464 + module_init(ap_module_init); 2465 + module_exit(ap_module_exit);