powerpc/powernv: Move core and fadump_release_opalcore under new kobject
The /sys/firmware/opal/core and /sys/kernel/fadump_release_opalcore sysfs files are used to export and release the OPAL memory on PowerNV platform. let's organize them into a new kobject under /sys/firmware/opal/mpipl/ directory. A symlink is added to maintain the backward compatibility for /sys/firmware/opal/core sysfs file. Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20191211160910.21656-5-sourabhjain@linux.ibm.com
This commit is contained in:
parent
d418b19f34
commit
8852c07a88
|
@ -1,3 +1,5 @@
|
||||||
|
This ABI is moved to /sys/firmware/opal/mpipl/release_core.
|
||||||
|
|
||||||
What: /sys/kernel/fadump_release_opalcore
|
What: /sys/kernel/fadump_release_opalcore
|
||||||
Date: Sep 2019
|
Date: Sep 2019
|
||||||
Contact: linuxppc-dev@lists.ozlabs.org
|
Contact: linuxppc-dev@lists.ozlabs.org
|
|
@ -112,13 +112,13 @@ to ensure that crash data is preserved to process later.
|
||||||
|
|
||||||
-- On OPAL based machines (PowerNV), if the kernel is build with
|
-- On OPAL based machines (PowerNV), if the kernel is build with
|
||||||
CONFIG_OPAL_CORE=y, OPAL memory at the time of crash is also
|
CONFIG_OPAL_CORE=y, OPAL memory at the time of crash is also
|
||||||
exported as /sys/firmware/opal/core file. This procfs file is
|
exported as /sys/firmware/opal/mpipl/core file. This procfs file is
|
||||||
helpful in debugging OPAL crashes with GDB. The kernel memory
|
helpful in debugging OPAL crashes with GDB. The kernel memory
|
||||||
used for exporting this procfs file can be released by echo'ing
|
used for exporting this procfs file can be released by echo'ing
|
||||||
'1' to /sys/kernel/fadump_release_opalcore node.
|
'1' to /sys/firmware/opal/mpipl/release_core node.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
# echo 1 > /sys/kernel/fadump_release_opalcore
|
# echo 1 > /sys/firmware/opal/mpipl/release_core
|
||||||
|
|
||||||
Implementation details:
|
Implementation details:
|
||||||
-----------------------
|
-----------------------
|
||||||
|
@ -283,14 +283,17 @@ Here is the list of files under kernel sysfs:
|
||||||
enhanced to use this interface to release the memory reserved for
|
enhanced to use this interface to release the memory reserved for
|
||||||
dump and continue without 2nd reboot.
|
dump and continue without 2nd reboot.
|
||||||
|
|
||||||
/sys/kernel/fadump_release_opalcore
|
Note: /sys/kernel/fadump_release_opalcore sysfs has moved to
|
||||||
|
/sys/firmware/opal/mpipl/release_core
|
||||||
|
|
||||||
|
/sys/firmware/opal/mpipl/release_core
|
||||||
|
|
||||||
This file is available only on OPAL based machines when FADump is
|
This file is available only on OPAL based machines when FADump is
|
||||||
active during capture kernel. This is used to release the memory
|
active during capture kernel. This is used to release the memory
|
||||||
used by the kernel to export /sys/firmware/opal/core file. To
|
used by the kernel to export /sys/firmware/opal/mpipl/core file. To
|
||||||
release this memory, echo '1' to it:
|
release this memory, echo '1' to it:
|
||||||
|
|
||||||
echo 1 > /sys/kernel/fadump_release_opalcore
|
echo 1 > /sys/firmware/opal/mpipl/release_core
|
||||||
|
|
||||||
Here is the list of files under powerpc debugfs:
|
Here is the list of files under powerpc debugfs:
|
||||||
(Assuming debugfs is mounted on /sys/kernel/debug directory.)
|
(Assuming debugfs is mounted on /sys/kernel/debug directory.)
|
||||||
|
|
|
@ -71,6 +71,7 @@ static LIST_HEAD(opalcore_list);
|
||||||
static struct opalcore_config *oc_conf;
|
static struct opalcore_config *oc_conf;
|
||||||
static const struct opal_mpipl_fadump *opalc_metadata;
|
static const struct opal_mpipl_fadump *opalc_metadata;
|
||||||
static const struct opal_mpipl_fadump *opalc_cpu_metadata;
|
static const struct opal_mpipl_fadump *opalc_cpu_metadata;
|
||||||
|
struct kobject *mpipl_kobj;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set crashing CPU's signal to SIGUSR1. if the kernel is triggered
|
* Set crashing CPU's signal to SIGUSR1. if the kernel is triggered
|
||||||
|
@ -428,7 +429,7 @@ static void opalcore_cleanup(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Remove OPAL core sysfs file */
|
/* Remove OPAL core sysfs file */
|
||||||
sysfs_remove_bin_file(opal_kobj, &opal_core_attr);
|
sysfs_remove_bin_file(mpipl_kobj, &opal_core_attr);
|
||||||
oc_conf->ptload_phdr = NULL;
|
oc_conf->ptload_phdr = NULL;
|
||||||
oc_conf->ptload_cnt = 0;
|
oc_conf->ptload_cnt = 0;
|
||||||
|
|
||||||
|
@ -563,9 +564,9 @@ error_out:
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fadump_release_opalcore_store(struct kobject *kobj,
|
static ssize_t release_core_store(struct kobject *kobj,
|
||||||
struct kobj_attribute *attr,
|
struct kobj_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
int input = -1;
|
int input = -1;
|
||||||
|
|
||||||
|
@ -589,9 +590,23 @@ static ssize_t fadump_release_opalcore_store(struct kobject *kobj,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute opalcore_rel_attr = __ATTR(fadump_release_opalcore,
|
static struct kobj_attribute opalcore_rel_attr = __ATTR_WO(release_core);
|
||||||
0200, NULL,
|
|
||||||
fadump_release_opalcore_store);
|
static struct attribute *mpipl_attr[] = {
|
||||||
|
&opalcore_rel_attr.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct bin_attribute *mpipl_bin_attr[] = {
|
||||||
|
&opal_core_attr,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct attribute_group mpipl_group = {
|
||||||
|
.attrs = mpipl_attr,
|
||||||
|
.bin_attrs = mpipl_bin_attr,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init opalcore_init(void)
|
static int __init opalcore_init(void)
|
||||||
{
|
{
|
||||||
|
@ -609,7 +624,7 @@ static int __init opalcore_init(void)
|
||||||
* then capture the dump.
|
* then capture the dump.
|
||||||
*/
|
*/
|
||||||
if (!(is_opalcore_usable())) {
|
if (!(is_opalcore_usable())) {
|
||||||
pr_err("Failed to export /sys/firmware/opal/core\n");
|
pr_err("Failed to export /sys/firmware/opal/mpipl/core\n");
|
||||||
opalcore_cleanup();
|
opalcore_cleanup();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -617,18 +632,28 @@ static int __init opalcore_init(void)
|
||||||
/* Set OPAL core file size */
|
/* Set OPAL core file size */
|
||||||
opal_core_attr.size = oc_conf->opalcore_size;
|
opal_core_attr.size = oc_conf->opalcore_size;
|
||||||
|
|
||||||
|
mpipl_kobj = kobject_create_and_add("mpipl", opal_kobj);
|
||||||
|
if (!mpipl_kobj) {
|
||||||
|
pr_err("unable to create mpipl kobject\n");
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
/* Export OPAL core sysfs file */
|
/* Export OPAL core sysfs file */
|
||||||
rc = sysfs_create_bin_file(opal_kobj, &opal_core_attr);
|
rc = sysfs_create_group(mpipl_kobj, &mpipl_group);
|
||||||
if (rc != 0) {
|
if (rc) {
|
||||||
pr_err("Failed to export /sys/firmware/opal/core\n");
|
pr_err("mpipl sysfs group creation failed (%d)", rc);
|
||||||
opalcore_cleanup();
|
opalcore_cleanup();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
/* The /sys/firmware/opal/core is moved to /sys/firmware/opal/mpipl/
|
||||||
rc = sysfs_create_file(kernel_kobj, &opalcore_rel_attr.attr);
|
* directory, need to create symlink at old location to maintain
|
||||||
|
* backward compatibility.
|
||||||
|
*/
|
||||||
|
rc = compat_only_sysfs_link_entry_to_kobj(opal_kobj, mpipl_kobj,
|
||||||
|
"core", NULL);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
pr_warn("unable to create sysfs file fadump_release_opalcore (%d)\n",
|
pr_err("unable to create core symlink (%d)\n", rc);
|
||||||
rc);
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue