Commit 34196f82 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

[S390] chsc: consolidate memory allocations

Most wrappers around the channel subsystem call have their own logic
to allocate memory (with proper alignment) or use preallocated or
static memory. This patch converts most users of the channel
subsystem call to use the same preallocated page (proteced by a
spinlock).

Note: The sei_page which is used in our crw handler to call
"store event information" has to coexist, since
a) in crw context, while accessing the sei_page, sleeping is allowed
   (which will conflict with the spinlock protection of the chsc_page)
b) in crw context, while accessing the sei_page, channel subsystem
   calls are allowed (which itself would require the page).
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 34aec07c
This diff is collapsed.
...@@ -66,7 +66,7 @@ extern void chsc_init_cleanup(void); ...@@ -66,7 +66,7 @@ extern void chsc_init_cleanup(void);
extern int chsc_enable_facility(int); extern int chsc_enable_facility(int);
struct channel_subsystem; struct channel_subsystem;
extern int chsc_secm(struct channel_subsystem *, int); extern int chsc_secm(struct channel_subsystem *, int);
int __chsc_do_secm(struct channel_subsystem *css, int enable, void *page); int __chsc_do_secm(struct channel_subsystem *css, int enable);
int chsc_chp_vary(struct chp_id chpid, int on); int chsc_chp_vary(struct chp_id chpid, int on);
int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt, int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
......
...@@ -790,7 +790,6 @@ static struct notifier_block css_reboot_notifier = { ...@@ -790,7 +790,6 @@ static struct notifier_block css_reboot_notifier = {
static int css_power_event(struct notifier_block *this, unsigned long event, static int css_power_event(struct notifier_block *this, unsigned long event,
void *ptr) void *ptr)
{ {
void *secm_area;
int ret, i; int ret, i;
switch (event) { switch (event) {
...@@ -806,15 +805,8 @@ static int css_power_event(struct notifier_block *this, unsigned long event, ...@@ -806,15 +805,8 @@ static int css_power_event(struct notifier_block *this, unsigned long event,
mutex_unlock(&css->mutex); mutex_unlock(&css->mutex);
continue; continue;
} }
secm_area = (void *)get_zeroed_page(GFP_KERNEL | if (__chsc_do_secm(css, 0))
GFP_DMA);
if (secm_area) {
if (__chsc_do_secm(css, 0, secm_area))
ret = NOTIFY_BAD; ret = NOTIFY_BAD;
free_page((unsigned long)secm_area);
} else
ret = NOTIFY_BAD;
mutex_unlock(&css->mutex); mutex_unlock(&css->mutex);
} }
break; break;
...@@ -830,15 +822,8 @@ static int css_power_event(struct notifier_block *this, unsigned long event, ...@@ -830,15 +822,8 @@ static int css_power_event(struct notifier_block *this, unsigned long event,
mutex_unlock(&css->mutex); mutex_unlock(&css->mutex);
continue; continue;
} }
secm_area = (void *)get_zeroed_page(GFP_KERNEL | if (__chsc_do_secm(css, 1))
GFP_DMA);
if (secm_area) {
if (__chsc_do_secm(css, 1, secm_area))
ret = NOTIFY_BAD;
free_page((unsigned long)secm_area);
} else
ret = NOTIFY_BAD; ret = NOTIFY_BAD;
mutex_unlock(&css->mutex); mutex_unlock(&css->mutex);
} }
/* search for subchannels, which appeared during hibernation */ /* search for subchannels, which appeared during hibernation */
...@@ -867,10 +852,7 @@ static int __init css_bus_init(void) ...@@ -867,10 +852,7 @@ static int __init css_bus_init(void)
if (ret) if (ret)
return ret; return ret;
ret = chsc_determine_css_characteristics(); chsc_determine_css_characteristics();
if (ret == -ENOMEM)
goto out;
/* Try to enable MSS. */ /* Try to enable MSS. */
ret = chsc_enable_facility(CHSC_SDA_OC_MSS); ret = chsc_enable_facility(CHSC_SDA_OC_MSS);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment