License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-07-08 16:20:04 +08:00
|
|
|
/*
|
|
|
|
* Copyright IBM Corp. 2015
|
|
|
|
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
|
|
|
|
*/
|
2017-01-24 22:58:52 +08:00
|
|
|
|
2015-07-08 16:20:04 +08:00
|
|
|
#include <linux/kernel.h>
|
2017-01-24 22:58:52 +08:00
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/lowcore.h>
|
2015-07-08 16:20:04 +08:00
|
|
|
#include <asm/ebcdic.h>
|
|
|
|
#include <asm/irq.h>
|
2018-05-23 17:07:13 +08:00
|
|
|
#include <asm/sections.h>
|
2018-04-12 00:42:37 +08:00
|
|
|
#include <asm/mem_detect.h>
|
2017-01-24 22:58:52 +08:00
|
|
|
#include "sclp.h"
|
|
|
|
#include "sclp_rw.h"
|
2015-07-08 16:20:04 +08:00
|
|
|
|
2018-05-23 17:07:13 +08:00
|
|
|
static struct read_info_sccb __bootdata(sclp_info_sccb);
|
|
|
|
static int __bootdata(sclp_info_sccb_valid);
|
2018-01-10 19:09:49 +08:00
|
|
|
char sclp_early_sccb[PAGE_SIZE] __aligned(PAGE_SIZE) __section(.data);
|
|
|
|
int sclp_init_state __section(.data) = sclp_init_state_uninitialized;
|
2018-01-23 23:50:43 +08:00
|
|
|
/*
|
|
|
|
* Used to keep track of the size of the event masks. Qemu until version 2.11
|
|
|
|
* only supports 4 and needs a workaround.
|
|
|
|
*/
|
2018-04-14 00:22:14 +08:00
|
|
|
bool sclp_mask_compat_mode __section(.data);
|
2017-01-27 22:54:57 +08:00
|
|
|
|
2017-01-24 22:58:52 +08:00
|
|
|
void sclp_early_wait_irq(void)
|
2015-07-08 16:20:04 +08:00
|
|
|
{
|
2017-01-24 22:58:52 +08:00
|
|
|
unsigned long psw_mask, addr;
|
2015-07-08 16:20:04 +08:00
|
|
|
psw_t psw_ext_save, psw_wait;
|
2017-01-11 16:14:45 +08:00
|
|
|
union ctlreg0 cr0, cr0_new;
|
2015-07-08 16:20:04 +08:00
|
|
|
|
2017-01-11 16:14:45 +08:00
|
|
|
__ctl_store(cr0.val, 0, 0);
|
|
|
|
cr0_new.val = cr0.val & ~CR0_IRQ_SUBCLASS_MASK;
|
|
|
|
cr0_new.lap = 0;
|
|
|
|
cr0_new.sssm = 1;
|
|
|
|
__ctl_load(cr0_new.val, 0, 0);
|
2015-07-08 16:20:04 +08:00
|
|
|
|
|
|
|
psw_ext_save = S390_lowcore.external_new_psw;
|
2015-11-04 21:16:57 +08:00
|
|
|
psw_mask = __extract_psw();
|
2015-07-08 16:20:04 +08:00
|
|
|
S390_lowcore.external_new_psw.mask = psw_mask;
|
|
|
|
psw_wait.mask = psw_mask | PSW_MASK_EXT | PSW_MASK_WAIT;
|
|
|
|
S390_lowcore.ext_int_code = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
asm volatile(
|
|
|
|
" larl %[addr],0f\n"
|
|
|
|
" stg %[addr],%[psw_wait_addr]\n"
|
|
|
|
" stg %[addr],%[psw_ext_addr]\n"
|
|
|
|
" lpswe %[psw_wait]\n"
|
|
|
|
"0:\n"
|
|
|
|
: [addr] "=&d" (addr),
|
|
|
|
[psw_wait_addr] "=Q" (psw_wait.addr),
|
|
|
|
[psw_ext_addr] "=Q" (S390_lowcore.external_new_psw.addr)
|
|
|
|
: [psw_wait] "Q" (psw_wait)
|
|
|
|
: "cc", "memory");
|
|
|
|
} while (S390_lowcore.ext_int_code != EXT_IRQ_SERVICE_SIG);
|
|
|
|
|
|
|
|
S390_lowcore.external_new_psw = psw_ext_save;
|
2017-01-11 16:14:45 +08:00
|
|
|
__ctl_load(cr0.val, 0, 0);
|
2015-07-08 16:20:04 +08:00
|
|
|
}
|
|
|
|
|
2017-02-02 19:33:03 +08:00
|
|
|
int sclp_early_cmd(sclp_cmdw_t cmd, void *sccb)
|
2015-07-08 16:20:04 +08:00
|
|
|
{
|
2017-01-24 22:58:52 +08:00
|
|
|
unsigned long flags;
|
|
|
|
int rc;
|
2015-07-08 16:20:04 +08:00
|
|
|
|
2017-01-24 22:58:52 +08:00
|
|
|
raw_local_irq_save(flags);
|
|
|
|
rc = sclp_service_call(cmd, sccb);
|
|
|
|
if (rc)
|
|
|
|
goto out;
|
|
|
|
sclp_early_wait_irq();
|
|
|
|
out:
|
|
|
|
raw_local_irq_restore(flags);
|
|
|
|
return rc;
|
2015-07-08 16:20:04 +08:00
|
|
|
}
|
|
|
|
|
2017-01-24 22:58:52 +08:00
|
|
|
struct write_sccb {
|
|
|
|
struct sccb_header header;
|
|
|
|
struct msg_buf msg;
|
|
|
|
} __packed;
|
|
|
|
|
2015-11-24 23:28:55 +08:00
|
|
|
/* Output multi-line text using SCLP Message interface. */
|
2017-01-24 22:58:52 +08:00
|
|
|
static void sclp_early_print_lm(const char *str, unsigned int len)
|
2015-07-08 16:20:04 +08:00
|
|
|
{
|
2017-01-24 22:58:52 +08:00
|
|
|
unsigned char *ptr, *end, ch;
|
|
|
|
unsigned int count, offset;
|
|
|
|
struct write_sccb *sccb;
|
|
|
|
struct msg_buf *msg;
|
|
|
|
struct mdb *mdb;
|
|
|
|
struct mto *mto;
|
|
|
|
struct go *go;
|
|
|
|
|
|
|
|
sccb = (struct write_sccb *) &sclp_early_sccb;
|
|
|
|
end = (unsigned char *) sccb + sizeof(sclp_early_sccb) - 1;
|
|
|
|
memset(sccb, 0, sizeof(*sccb));
|
|
|
|
ptr = (unsigned char *) &sccb->msg.mdb.mto;
|
|
|
|
offset = 0;
|
2015-07-08 16:20:04 +08:00
|
|
|
do {
|
2017-01-24 22:58:52 +08:00
|
|
|
for (count = sizeof(*mto); offset < len; count++) {
|
|
|
|
ch = str[offset++];
|
|
|
|
if ((ch == 0x0a) || (ptr + count > end))
|
2017-01-11 18:07:39 +08:00
|
|
|
break;
|
2015-07-08 16:20:04 +08:00
|
|
|
ptr[count] = _ascebc[ch];
|
|
|
|
}
|
2017-01-24 22:58:52 +08:00
|
|
|
mto = (struct mto *) ptr;
|
|
|
|
memset(mto, 0, sizeof(*mto));
|
|
|
|
mto->length = count;
|
|
|
|
mto->type = 4;
|
|
|
|
mto->line_type_flags = LNTPFLGS_ENDTEXT;
|
2015-07-08 16:20:04 +08:00
|
|
|
ptr += count;
|
2017-01-24 22:58:52 +08:00
|
|
|
} while ((offset < len) && (ptr + sizeof(*mto) <= end));
|
|
|
|
len = ptr - (unsigned char *) sccb;
|
|
|
|
sccb->header.length = len - offsetof(struct write_sccb, header);
|
|
|
|
msg = &sccb->msg;
|
|
|
|
msg->header.type = EVTYP_MSG;
|
|
|
|
msg->header.length = len - offsetof(struct write_sccb, msg.header);
|
|
|
|
mdb = &msg->mdb;
|
|
|
|
mdb->header.type = 1;
|
|
|
|
mdb->header.tag = 0xD4C4C240;
|
|
|
|
mdb->header.revision_code = 1;
|
|
|
|
mdb->header.length = len - offsetof(struct write_sccb, msg.mdb.header);
|
|
|
|
go = &mdb->go;
|
|
|
|
go->length = sizeof(*go);
|
|
|
|
go->type = 1;
|
|
|
|
sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_DATA, sccb);
|
2015-07-08 16:20:04 +08:00
|
|
|
}
|
|
|
|
|
2017-01-24 22:58:52 +08:00
|
|
|
struct vt220_sccb {
|
|
|
|
struct sccb_header header;
|
|
|
|
struct {
|
|
|
|
struct evbuf_header header;
|
|
|
|
char data[];
|
|
|
|
} msg;
|
|
|
|
} __packed;
|
|
|
|
|
2017-02-02 17:33:20 +08:00
|
|
|
/* Output multi-line text using SCLP VT220 interface. */
|
2017-01-24 22:58:52 +08:00
|
|
|
static void sclp_early_print_vt220(const char *str, unsigned int len)
|
|
|
|
{
|
|
|
|
struct vt220_sccb *sccb;
|
|
|
|
|
|
|
|
sccb = (struct vt220_sccb *) &sclp_early_sccb;
|
|
|
|
if (sizeof(*sccb) + len >= sizeof(sclp_early_sccb))
|
2017-02-02 17:33:20 +08:00
|
|
|
len = sizeof(sclp_early_sccb) - sizeof(*sccb);
|
2017-01-24 22:58:52 +08:00
|
|
|
memset(sccb, 0, sizeof(*sccb));
|
|
|
|
memcpy(&sccb->msg.data, str, len);
|
2017-02-02 17:33:20 +08:00
|
|
|
sccb->header.length = sizeof(*sccb) + len;
|
|
|
|
sccb->msg.header.length = sizeof(sccb->msg) + len;
|
2017-01-24 22:58:52 +08:00
|
|
|
sccb->msg.header.type = EVTYP_VT220MSG;
|
|
|
|
sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_DATA, sccb);
|
|
|
|
}
|
|
|
|
|
|
|
|
int sclp_early_set_event_mask(struct init_sccb *sccb,
|
2018-01-23 22:07:09 +08:00
|
|
|
sccb_mask_t receive_mask,
|
|
|
|
sccb_mask_t send_mask)
|
2017-01-24 22:58:52 +08:00
|
|
|
{
|
2018-01-23 23:50:43 +08:00
|
|
|
retry:
|
2017-01-24 22:58:52 +08:00
|
|
|
memset(sccb, 0, sizeof(*sccb));
|
|
|
|
sccb->header.length = sizeof(*sccb);
|
2018-01-23 23:50:43 +08:00
|
|
|
if (sclp_mask_compat_mode)
|
|
|
|
sccb->mask_length = SCLP_MASK_SIZE_COMPAT;
|
|
|
|
else
|
|
|
|
sccb->mask_length = sizeof(sccb_mask_t);
|
2018-01-23 23:41:38 +08:00
|
|
|
sccb_set_recv_mask(sccb, receive_mask);
|
|
|
|
sccb_set_send_mask(sccb, send_mask);
|
2017-02-02 19:33:03 +08:00
|
|
|
if (sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_MASK, sccb))
|
|
|
|
return -EIO;
|
2018-01-23 23:50:43 +08:00
|
|
|
if ((sccb->header.response_code == 0x74f0) && !sclp_mask_compat_mode) {
|
|
|
|
sclp_mask_compat_mode = true;
|
|
|
|
goto retry;
|
|
|
|
}
|
2017-02-02 19:33:03 +08:00
|
|
|
if (sccb->header.response_code != 0x20)
|
|
|
|
return -EIO;
|
|
|
|
return 0;
|
2017-01-24 22:58:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int sclp_early_con_check_linemode(struct init_sccb *sccb)
|
2015-07-08 16:20:04 +08:00
|
|
|
{
|
2018-01-23 23:41:38 +08:00
|
|
|
if (!(sccb_get_sclp_send_mask(sccb) & EVTYP_OPCMD_MASK))
|
2017-01-24 22:58:52 +08:00
|
|
|
return 0;
|
2018-01-23 23:41:38 +08:00
|
|
|
if (!(sccb_get_sclp_recv_mask(sccb) & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK)))
|
2017-01-24 22:58:52 +08:00
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-01-23 23:41:38 +08:00
|
|
|
unsigned int sclp_early_con_check_vt220(struct init_sccb *sccb)
|
|
|
|
{
|
|
|
|
if (sccb_get_sclp_send_mask(sccb) & EVTYP_VT220MSG_MASK)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-24 22:58:52 +08:00
|
|
|
static int sclp_early_setup(int disable, int *have_linemode, int *have_vt220)
|
|
|
|
{
|
|
|
|
unsigned long receive_mask, send_mask;
|
|
|
|
struct init_sccb *sccb;
|
|
|
|
int rc;
|
|
|
|
|
2018-01-23 23:41:38 +08:00
|
|
|
BUILD_BUG_ON(sizeof(struct init_sccb) > PAGE_SIZE);
|
|
|
|
|
2017-01-24 22:58:52 +08:00
|
|
|
*have_linemode = *have_vt220 = 0;
|
|
|
|
sccb = (struct init_sccb *) &sclp_early_sccb;
|
|
|
|
receive_mask = disable ? 0 : EVTYP_OPCMD_MASK;
|
|
|
|
send_mask = disable ? 0 : EVTYP_VT220MSG_MASK | EVTYP_MSG_MASK;
|
|
|
|
rc = sclp_early_set_event_mask(sccb, receive_mask, send_mask);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
*have_linemode = sclp_early_con_check_linemode(sccb);
|
2018-01-23 23:41:38 +08:00
|
|
|
*have_vt220 = !!(sccb_get_send_mask(sccb) & EVTYP_VT220MSG_MASK);
|
2017-01-24 22:58:52 +08:00
|
|
|
return rc;
|
2015-11-24 23:28:55 +08:00
|
|
|
}
|
|
|
|
|
2017-02-02 17:33:20 +08:00
|
|
|
/*
|
|
|
|
* Output one or more lines of text on the SCLP console (VT220 and /
|
|
|
|
* or line-mode).
|
2015-11-24 23:28:55 +08:00
|
|
|
*/
|
s390/hibernate: fix error handling when suspend cpu != resume cpu
The resume code checks if the resume cpu is the same as the suspend cpu.
If not, and if it is also not possible to switch to the suspend cpu, an
error message should be printed and the resume process should be stopped
by loading a disabled wait psw.
The current logic is broken in multiple ways, the message is never printed,
and the disabled wait psw never loaded because the kernel panics before that:
- sam31 and SIGP_SET_ARCHITECTURE to ESA mode is wrong, this will break
on the first 64bit instruction in sclp_early_printk().
- The init stack should be used, but the stack pointer is not set up correctly
(missing aghi %r15,-STACK_FRAME_OVERHEAD).
- __sclp_early_printk() checks the sclp_init_state. If it is not
sclp_init_state_uninitialized, it simply returns w/o printing anything.
In the resumed kernel however, sclp_init_state will never be uninitialized.
This patch fixes those issues by removing the sam31/ESA logic, adding a
correct init stack pointer, and also introducing sclp_early_printk_force()
to allow using sclp_early_printk() even when sclp_init_state is not
uninitialized.
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2018-09-11 00:03:29 +08:00
|
|
|
void __sclp_early_printk(const char *str, unsigned int len, unsigned int force)
|
2015-11-24 23:28:55 +08:00
|
|
|
{
|
2017-01-24 22:58:52 +08:00
|
|
|
int have_linemode, have_vt220;
|
|
|
|
|
s390/hibernate: fix error handling when suspend cpu != resume cpu
The resume code checks if the resume cpu is the same as the suspend cpu.
If not, and if it is also not possible to switch to the suspend cpu, an
error message should be printed and the resume process should be stopped
by loading a disabled wait psw.
The current logic is broken in multiple ways, the message is never printed,
and the disabled wait psw never loaded because the kernel panics before that:
- sam31 and SIGP_SET_ARCHITECTURE to ESA mode is wrong, this will break
on the first 64bit instruction in sclp_early_printk().
- The init stack should be used, but the stack pointer is not set up correctly
(missing aghi %r15,-STACK_FRAME_OVERHEAD).
- __sclp_early_printk() checks the sclp_init_state. If it is not
sclp_init_state_uninitialized, it simply returns w/o printing anything.
In the resumed kernel however, sclp_init_state will never be uninitialized.
This patch fixes those issues by removing the sam31/ESA logic, adding a
correct init stack pointer, and also introducing sclp_early_printk_force()
to allow using sclp_early_printk() even when sclp_init_state is not
uninitialized.
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2018-09-11 00:03:29 +08:00
|
|
|
if (!force && sclp_init_state != sclp_init_state_uninitialized)
|
2017-01-27 22:54:57 +08:00
|
|
|
return;
|
2017-01-24 22:58:52 +08:00
|
|
|
if (sclp_early_setup(0, &have_linemode, &have_vt220) != 0)
|
2015-11-24 23:28:55 +08:00
|
|
|
return;
|
|
|
|
if (have_linemode)
|
2017-01-24 22:58:52 +08:00
|
|
|
sclp_early_print_lm(str, len);
|
2015-11-24 23:28:55 +08:00
|
|
|
if (have_vt220)
|
2017-01-24 22:58:52 +08:00
|
|
|
sclp_early_print_vt220(str, len);
|
|
|
|
sclp_early_setup(1, &have_linemode, &have_vt220);
|
2015-07-08 16:20:04 +08:00
|
|
|
}
|
2017-01-11 16:14:52 +08:00
|
|
|
|
2017-01-24 22:58:52 +08:00
|
|
|
void sclp_early_printk(const char *str)
|
2017-01-11 16:14:52 +08:00
|
|
|
{
|
s390/hibernate: fix error handling when suspend cpu != resume cpu
The resume code checks if the resume cpu is the same as the suspend cpu.
If not, and if it is also not possible to switch to the suspend cpu, an
error message should be printed and the resume process should be stopped
by loading a disabled wait psw.
The current logic is broken in multiple ways, the message is never printed,
and the disabled wait psw never loaded because the kernel panics before that:
- sam31 and SIGP_SET_ARCHITECTURE to ESA mode is wrong, this will break
on the first 64bit instruction in sclp_early_printk().
- The init stack should be used, but the stack pointer is not set up correctly
(missing aghi %r15,-STACK_FRAME_OVERHEAD).
- __sclp_early_printk() checks the sclp_init_state. If it is not
sclp_init_state_uninitialized, it simply returns w/o printing anything.
In the resumed kernel however, sclp_init_state will never be uninitialized.
This patch fixes those issues by removing the sam31/ESA logic, adding a
correct init stack pointer, and also introducing sclp_early_printk_force()
to allow using sclp_early_printk() even when sclp_init_state is not
uninitialized.
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2018-09-11 00:03:29 +08:00
|
|
|
__sclp_early_printk(str, strlen(str), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sclp_early_printk_force(const char *str)
|
|
|
|
{
|
|
|
|
__sclp_early_printk(str, strlen(str), 1);
|
2017-01-11 16:14:52 +08:00
|
|
|
}
|
2018-05-23 17:07:13 +08:00
|
|
|
|
|
|
|
int __init sclp_early_read_info(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct read_info_sccb *sccb = &sclp_info_sccb;
|
|
|
|
sclp_cmdw_t commands[] = {SCLP_CMDW_READ_SCP_INFO_FORCED,
|
|
|
|
SCLP_CMDW_READ_SCP_INFO};
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(commands); i++) {
|
|
|
|
memset(sccb, 0, sizeof(*sccb));
|
|
|
|
sccb->header.length = sizeof(*sccb);
|
|
|
|
sccb->header.function_code = 0x80;
|
|
|
|
sccb->header.control_mask[2] = 0x80;
|
|
|
|
if (sclp_early_cmd(commands[i], sccb))
|
|
|
|
break;
|
|
|
|
if (sccb->header.response_code == 0x10) {
|
|
|
|
sclp_info_sccb_valid = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (sccb->header.response_code != 0x1f0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
int __init sclp_early_get_info(struct read_info_sccb *info)
|
|
|
|
{
|
|
|
|
if (!sclp_info_sccb_valid)
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
*info = sclp_info_sccb;
|
|
|
|
return 0;
|
|
|
|
}
|
2018-04-11 17:56:55 +08:00
|
|
|
|
2018-04-12 01:15:24 +08:00
|
|
|
int __init sclp_early_get_memsize(unsigned long *mem)
|
2018-04-11 17:56:55 +08:00
|
|
|
{
|
|
|
|
unsigned long rnmax;
|
|
|
|
unsigned long rnsize;
|
|
|
|
struct read_info_sccb *sccb = &sclp_info_sccb;
|
|
|
|
|
|
|
|
if (!sclp_info_sccb_valid)
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2;
|
|
|
|
rnsize = sccb->rnsize ? sccb->rnsize : sccb->rnsize2;
|
|
|
|
rnsize <<= 20;
|
|
|
|
*mem = rnsize * rnmax;
|
|
|
|
return 0;
|
|
|
|
}
|
2018-04-12 00:42:37 +08:00
|
|
|
|
2018-04-13 23:37:28 +08:00
|
|
|
int __init sclp_early_get_hsa_size(unsigned long *hsa_size)
|
|
|
|
{
|
|
|
|
if (!sclp_info_sccb_valid)
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
*hsa_size = 0;
|
|
|
|
if (sclp_info_sccb.hsa_size)
|
|
|
|
*hsa_size = (sclp_info_sccb.hsa_size - 1) * PAGE_SIZE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-12 00:42:37 +08:00
|
|
|
#define SCLP_STORAGE_INFO_FACILITY 0x0000400000000000UL
|
|
|
|
|
|
|
|
void __weak __init add_mem_detect_block(u64 start, u64 end) {}
|
|
|
|
int __init sclp_early_read_storage_info(void)
|
|
|
|
{
|
|
|
|
struct read_storage_sccb *sccb = (struct read_storage_sccb *)&sclp_early_sccb;
|
|
|
|
int rc, id, max_id = 0;
|
|
|
|
unsigned long rn, rzm;
|
|
|
|
sclp_cmdw_t command;
|
|
|
|
u16 sn;
|
|
|
|
|
|
|
|
if (!sclp_info_sccb_valid)
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
if (!(sclp_info_sccb.facilities & SCLP_STORAGE_INFO_FACILITY))
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
|
|
rzm = sclp_info_sccb.rnsize ?: sclp_info_sccb.rnsize2;
|
|
|
|
rzm <<= 20;
|
|
|
|
|
|
|
|
for (id = 0; id <= max_id; id++) {
|
|
|
|
memset(sclp_early_sccb, 0, sizeof(sclp_early_sccb));
|
|
|
|
sccb->header.length = sizeof(sclp_early_sccb);
|
|
|
|
command = SCLP_CMDW_READ_STORAGE_INFO | (id << 8);
|
|
|
|
rc = sclp_early_cmd(command, sccb);
|
|
|
|
if (rc)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
max_id = sccb->max_id;
|
|
|
|
switch (sccb->header.response_code) {
|
|
|
|
case 0x0010:
|
|
|
|
for (sn = 0; sn < sccb->assigned; sn++) {
|
|
|
|
if (!sccb->entries[sn])
|
|
|
|
continue;
|
|
|
|
rn = sccb->entries[sn] >> 16;
|
|
|
|
add_mem_detect_block((rn - 1) * rzm, rn * rzm);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0x0310:
|
|
|
|
case 0x0410:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
fail:
|
|
|
|
mem_detect.count = 0;
|
|
|
|
return -EIO;
|
|
|
|
}
|