Disable the coredump collection by default as doing so makes sense
for production devices. Also rename the "default" configuration
option to "enabled" to avoid confusion.

Signed-off-by: Rishabh Bhatnagar <[email protected]>
---
 Documentation/ABI/testing/sysfs-class-remoteproc | 10 ++++++----
 drivers/remoteproc/remoteproc_coredump.c         |  6 +++---
 drivers/remoteproc/remoteproc_sysfs.c            | 10 +++++-----
 include/linux/remoteproc.h                       |  8 ++++----
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-class-remoteproc 
b/Documentation/ABI/testing/sysfs-class-remoteproc
index 7368b50..dec1686 100644
--- a/Documentation/ABI/testing/sysfs-class-remoteproc
+++ b/Documentation/ABI/testing/sysfs-class-remoteproc
@@ -67,11 +67,14 @@ Description:        Remote processor coredump configuration
                Reports the coredump configuration of the remote processor,
                which will be one of:
 
-               "default"
-               "inline"
                "disabled"
+               "enabled"
+               "inline"
+
+               "disabled" means no dump will be collected. This is the
+               default remoteproc coredump configuration.
 
-               "default" means when the remote processor's coredump is
+               "enabled" means when the remote processor's coredump is
                collected it will be copied to a separate buffer and that
                buffer is exposed to userspace.
 
@@ -81,7 +84,6 @@ Description:  Remote processor coredump configuration
                copy the dump. Also recovery process will not proceed until
                all data is read by usersapce.
 
-               "disabled" means no dump will be collected.
 
 What:          /sys/class/remoteproc/.../recovery
 Date:          July 2020
diff --git a/drivers/remoteproc/remoteproc_coredump.c 
b/drivers/remoteproc/remoteproc_coredump.c
index bb15a29..34530dc 100644
--- a/drivers/remoteproc/remoteproc_coredump.c
+++ b/drivers/remoteproc/remoteproc_coredump.c
@@ -257,7 +257,7 @@ void rproc_coredump(struct rproc *rproc)
                 * directly read from device memory.
                 */
                data_size += elf_size_of_phdr(class);
-               if (dump_conf == RPROC_COREDUMP_DEFAULT)
+               if (dump_conf == RPROC_COREDUMP_ENABLED)
                        data_size += segment->size;
 
                phnum++;
@@ -297,14 +297,14 @@ void rproc_coredump(struct rproc *rproc)
                elf_phdr_set_p_flags(class, phdr, PF_R | PF_W | PF_X);
                elf_phdr_set_p_align(class, phdr, 0);
 
-               if (dump_conf == RPROC_COREDUMP_DEFAULT)
+               if (dump_conf == RPROC_COREDUMP_ENABLED)
                        rproc_copy_segment(rproc, data + offset, segment, 0,
                                           segment->size);
 
                offset += elf_phdr_get_p_filesz(class, phdr);
                phdr += elf_size_of_phdr(class);
        }
-       if (dump_conf == RPROC_COREDUMP_DEFAULT) {
+       if (dump_conf == RPROC_COREDUMP_ENABLED) {
                dev_coredumpv(&rproc->dev, data, data_size, GFP_KERNEL);
                return;
        }
diff --git a/drivers/remoteproc/remoteproc_sysfs.c 
b/drivers/remoteproc/remoteproc_sysfs.c
index e60a014..eb98ed2 100644
--- a/drivers/remoteproc/remoteproc_sysfs.c
+++ b/drivers/remoteproc/remoteproc_sysfs.c
@@ -68,12 +68,12 @@ static DEVICE_ATTR_RW(recovery);
 /*
  * A coredump-configuration-to-string lookup table, for exposing a
  * human readable configuration via sysfs. Always keep in sync with
- * enum rproc_coredump_mechanism
+ * enum rproc_dump_mechanism
  */
 static const char * const rproc_coredump_str[] = {
-       [RPROC_COREDUMP_DEFAULT]        = "default",
-       [RPROC_COREDUMP_INLINE]         = "inline",
        [RPROC_COREDUMP_DISABLED]       = "disabled",
+       [RPROC_COREDUMP_ENABLED]        = "enabled",
+       [RPROC_COREDUMP_INLINE]         = "inline",
 };
 
 /* Expose the current coredump configuration via debugfs */
@@ -115,10 +115,10 @@ static ssize_t coredump_store(struct device *dev,
 
        if (sysfs_streq(buf, "disabled")) {
                rproc->dump_conf = RPROC_COREDUMP_DISABLED;
+       } else if (sysfs_streq(buf, "enabled")) {
+               rproc->dump_conf = RPROC_COREDUMP_ENABLED;
        } else if (sysfs_streq(buf, "inline")) {
                rproc->dump_conf = RPROC_COREDUMP_INLINE;
-       } else if (sysfs_streq(buf, "default")) {
-               rproc->dump_conf = RPROC_COREDUMP_DEFAULT;
        } else {
                dev_err(&rproc->dev, "Invalid coredump configuration\n");
                return -EINVAL;
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 2fa68bf..3fa3ba6 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -442,16 +442,16 @@ enum rproc_crash_type {
 
 /**
  * enum rproc_dump_mechanism - Coredump options for core
- * @RPROC_COREDUMP_DEFAULT:    Copy dump to separate buffer and carry on with
+ * @RPROC_COREDUMP_DISABLED:   Don't perform any dump
+ * @RPROC_COREDUMP_ENABLED:    Copy dump to separate buffer and carry on with
                                recovery
  * @RPROC_COREDUMP_INLINE:     Read segments directly from device memory. Stall
                                recovery until all segments are read
- * @RPROC_COREDUMP_DISABLED:   Don't perform any dump
  */
 enum rproc_dump_mechanism {
-       RPROC_COREDUMP_DEFAULT,
-       RPROC_COREDUMP_INLINE,
        RPROC_COREDUMP_DISABLED,
+       RPROC_COREDUMP_ENABLED,
+       RPROC_COREDUMP_INLINE,
 };
 
 /**
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

Reply via email to