Move the ap bus into the kernel and make it general available.
Additionally include the message types and the API layer as a
preparation for the workload management facility.
Signed-off-by: Ingo Tuchscherer <ingo.tuchscherer@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
#
ap-objs := ap_bus.o
-# zcrypt_api depends on ap
-obj-$(CONFIG_ZCRYPT) += ap.o zcrypt_api.o
-# msgtype* depend on zcrypt_api
-obj-$(CONFIG_ZCRYPT) += zcrypt_msgtype6.o zcrypt_msgtype50.o
-# adapter drivers depend on ap, zcrypt_api and msgtype*
+obj-$(subst m,y,$(CONFIG_ZCRYPT)) += ap.o
+# zcrypt_api.o and zcrypt_msgtype*.o depend on ap.o
+zcrypt-objs := zcrypt_api.o zcrypt_msgtype6.o zcrypt_msgtype50.o
+obj-$(CONFIG_ZCRYPT) += zcrypt.o
+# adapter drivers depend on ap.o and zcrypt.o
obj-$(CONFIG_ZCRYPT) += zcrypt_pcixcc.o zcrypt_cex2a.o zcrypt_cex4.o
* Module parameter
*/
int ap_domain_index = -1; /* Adjunct Processor Domain Index */
+static DEFINE_SPINLOCK(ap_domain_lock);
module_param_named(domain, ap_domain_index, int, S_IRUSR|S_IRGRP);
MODULE_PARM_DESC(domain, "domain index for ap devices");
EXPORT_SYMBOL(ap_domain_index);
return snprintf(buf, PAGE_SIZE, "%d\n", ap_domain_index);
}
-static BUS_ATTR(ap_domain, 0444, ap_domain_show, NULL);
+static ssize_t ap_domain_store(struct bus_type *bus,
+ const char *buf, size_t count)
+{
+ int domain;
+
+ if (sscanf(buf, "%i\n", &domain) != 1 ||
+ domain < 0 || domain > ap_max_domain_id)
+ return -EINVAL;
+ spin_lock_bh(&ap_domain_lock);
+ ap_domain_index = domain;
+ spin_unlock_bh(&ap_domain_lock);
+ return count;
+}
+
+static BUS_ATTR(ap_domain, 0644, ap_domain_show, ap_domain_store);
static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
{
* the "domain=" parameter or the domain with the maximum number
* of devices.
*/
- if (ap_domain_index >= 0)
+ spin_lock_bh(&ap_domain_lock);
+ if (ap_domain_index >= 0) {
/* Domain has already been selected. */
+ spin_unlock_bh(&ap_domain_lock);
return 0;
+ }
best_domain = -1;
max_count = 0;
for (i = 0; i < AP_DOMAINS; i++) {
}
if (best_domain >= 0){
ap_domain_index = best_domain;
+ spin_unlock_bh(&ap_domain_lock);
return 0;
}
+ spin_unlock_bh(&ap_domain_lock);
return -ENODEV;
}
if (ap_select_domain() != 0)
goto out;
+
+ spin_lock_bh(&ap_domain_lock);
for (i = 0; i < AP_DEVICES; i++) {
qid = AP_MKQID(i, ap_domain_index);
dev = bus_find_device(&ap_bus_type, NULL,
continue;
}
}
+ spin_unlock_bh(&ap_domain_lock);
out:
mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ);
}
#include "zcrypt_api.h"
#include "zcrypt_msgtype6.h"
+#include "zcrypt_msgtype50.h"
/*
* Module description.
goto out_misc;
}
+ zcrypt_msgtype6_init();
+ zcrypt_msgtype50_init();
return 0;
out_misc:
*
* The module termination code.
*/
-void zcrypt_api_exit(void)
+void __exit zcrypt_api_exit(void)
{
remove_proc_entry("driver/z90crypt", NULL);
misc_deregister(&zcrypt_misc_device);
zcrypt_debug_exit();
+ zcrypt_msgtype6_exit();
+ zcrypt_msgtype50_exit();
}
module_init(zcrypt_api_init);
.variant = MSGTYPE50_VARIANT_DEFAULT,
};
-int __init zcrypt_msgtype50_init(void)
+void __init zcrypt_msgtype50_init(void)
{
zcrypt_msgtype_register(&zcrypt_msgtype50_ops);
- return 0;
}
void __exit zcrypt_msgtype50_exit(void)
{
zcrypt_msgtype_unregister(&zcrypt_msgtype50_ops);
}
-
-module_init(zcrypt_msgtype50_init);
-module_exit(zcrypt_msgtype50_exit);
#define MSGTYPE_ADJUSTMENT 0x08 /*type04 extension (not needed in type50)*/
-int zcrypt_msgtype50_init(void);
+void zcrypt_msgtype50_init(void);
void zcrypt_msgtype50_exit(void);
#endif /* _ZCRYPT_MSGTYPE50_H_ */
.send_ep11_cprb = zcrypt_msgtype6_send_ep11_cprb,
};
-int __init zcrypt_msgtype6_init(void)
+void __init zcrypt_msgtype6_init(void)
{
zcrypt_msgtype_register(&zcrypt_msgtype6_norng_ops);
zcrypt_msgtype_register(&zcrypt_msgtype6_ops);
zcrypt_msgtype_register(&zcrypt_msgtype6_ep11_ops);
- return 0;
}
void __exit zcrypt_msgtype6_exit(void)
zcrypt_msgtype_unregister(&zcrypt_msgtype6_ops);
zcrypt_msgtype_unregister(&zcrypt_msgtype6_ep11_ops);
}
-
-module_init(zcrypt_msgtype6_init);
-module_exit(zcrypt_msgtype6_exit);
ap_msg->length = sizeof(*msg);
}
-int zcrypt_msgtype6_init(void);
+void zcrypt_msgtype6_init(void);
void zcrypt_msgtype6_exit(void);
#endif /* _ZCRYPT_MSGTYPE6_H_ */