Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp670676ybl; Fri, 6 Dec 2019 04:27:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwJ8ck9sLz6hQlSHBxy/cUyRVPEPkiBEJa0Zebl3DgZRS/nxB5/sx8CNumEFuhqIibdpLB1 X-Received: by 2002:a05:6808:7da:: with SMTP id f26mr1867533oij.73.1575635242970; Fri, 06 Dec 2019 04:27:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575635242; cv=none; d=google.com; s=arc-20160816; b=O6XhejbrEW1ki9tYwn/7uUz4MJXwAV8hLXrqvmSNoDm7lfaBqenGZRdWMNaAopZc44 xfptNNn4vy/NHN2xnSPQzyfHcn6A2m6gBn2j2Qxi1HhjdKTPxo49lWzyyoii0wqxgP9E VuqdyLyJwybVW+k77fF+jYvqBMTgXazrHRNytLwosgLXP3FpwZGPivzsSzefUJFQb8Qs f4uvLcPIadRMe324uNxa25qEwIydYJjIQm9bfF7um8YXJ0l+7N0Z9nL/FXr7bGoNqD1Z G2SEKK0SnuLgyeo2i8DJnFSA2J1tc0KqvyJ9UHZ4ZXlpiiFlw4EEcZlwXeCkOSp3zKVf 14vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=rLGsqDa5iyxnhLm9KAcBN9Ik1XGF1cWNHGSD4VdY6Y0=; b=J4fZK5fRJMp9SBMioFRi2YDTFXoboisMQDjF1qNcko1kIFGMriGBtZeO4JcYVNCejg Vc0LdBI/T/Prb2HaIHMDdeHg7YNgRTohcGvFZgzOZ8vk6t7KtIaMFNKizAJDlAicon7y 93qfht7bGmm37uz5ModgI8nBD8KwaCqeE95xoxI2CrFa5jLacH4eP+GmPHOYLh45EwCv /h8hmsV5dsBx1WDNkHJ0azeZvKvv6yK6S8bPW8C4gSqT9x9pnGL5TfxS2F5M0tu09dHz ae+yIZmIjg3y+y/A43Z5fqofYT2DBU8xcdSLVisbQoljDlRbrNRLHQs1LQ2krl4yQhFp pkLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f187si6820529oia.218.2019.12.06.04.27.11; Fri, 06 Dec 2019 04:27:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726410AbfLFMZB (ORCPT + 99 others); Fri, 6 Dec 2019 07:25:01 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:24846 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726261AbfLFMY5 (ORCPT ); Fri, 6 Dec 2019 07:24:57 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB6CGwdG015153 for ; Fri, 6 Dec 2019 07:24:55 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2wq9hg9r1d-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 06 Dec 2019 07:24:55 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 6 Dec 2019 12:24:53 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 6 Dec 2019 12:24:51 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xB6COn9f60489814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Dec 2019 12:24:49 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 89A094C050; Fri, 6 Dec 2019 12:24:49 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E720A4C046; Fri, 6 Dec 2019 12:24:47 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.191]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 6 Dec 2019 12:24:47 +0000 (GMT) From: Sourabh Jain To: mpe@ellerman.id.au Cc: mahesh@linux.vnet.ibm.com, hbathini@linux.ibm.com, linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, corbet@lwn.net, linux-doc@vger.kernel.org, gregkh@linuxfoundation.org, Sourabh Jain Subject: [PATCH v4 4/6] powerpc/powernv: move core and fadump_release_opalcore under new kobject Date: Fri, 6 Dec 2019 17:54:32 +0530 X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191206122434.29587-1-sourabhjain@linux.ibm.com> References: <20191206122434.29587-1-sourabhjain@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19120612-0016-0000-0000-000002D241F2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120612-0017-0000-0000-000033344BFE Message-Id: <20191206122434.29587-5-sourabhjain@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-06_03:2019-12-05,2019-12-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 adultscore=0 malwarescore=0 suspectscore=1 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912060105 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../sysfs-kernel-fadump_release_opalcore | 2 ++ .../powerpc/firmware-assisted-dump.rst | 15 +++++---- arch/powerpc/platforms/powernv/opal-core.c | 31 ++++++++++++++----- 3 files changed, 34 insertions(+), 14 deletions(-) rename Documentation/ABI/{testing => removed}/sysfs-kernel-fadump_release_opalcore (82%) diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump_release_opalcore b/Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore similarity index 82% rename from Documentation/ABI/testing/sysfs-kernel-fadump_release_opalcore rename to Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore index 53313c1d4e7a..a8d46cd0f4e6 100644 --- a/Documentation/ABI/testing/sysfs-kernel-fadump_release_opalcore +++ b/Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore @@ -1,3 +1,5 @@ +This ABI is moved to /sys/firmware/opal/mpipl/release_core. + What: /sys/kernel/fadump_release_opalcore Date: Sep 2019 Contact: linuxppc-dev@lists.ozlabs.org diff --git a/Documentation/powerpc/firmware-assisted-dump.rst b/Documentation/powerpc/firmware-assisted-dump.rst index 0455a78486d5..345a3405206e 100644 --- a/Documentation/powerpc/firmware-assisted-dump.rst +++ b/Documentation/powerpc/firmware-assisted-dump.rst @@ -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 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 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. - # echo 1 > /sys/kernel/fadump_release_opalcore + # echo 1 > /sys/firmware/opal/mpipl/release_core 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 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 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: - echo 1 > /sys/kernel/fadump_release_opalcore + echo 1 > /sys/firmware/opal/mpipl/release_core Here is the list of files under powerpc debugfs: (Assuming debugfs is mounted on /sys/kernel/debug directory.) diff --git a/arch/powerpc/platforms/powernv/opal-core.c b/arch/powerpc/platforms/powernv/opal-core.c index ed895d82c048..7fcc092d065e 100644 --- a/arch/powerpc/platforms/powernv/opal-core.c +++ b/arch/powerpc/platforms/powernv/opal-core.c @@ -589,7 +589,8 @@ static ssize_t fadump_release_opalcore_store(struct kobject *kobj, return count; } -static struct kobj_attribute opalcore_rel_attr = __ATTR(fadump_release_opalcore, +struct kobject *mpipl_kobj; +static struct kobj_attribute opalcore_rel_attr = __ATTR(release_core, 0200, NULL, fadump_release_opalcore_store); @@ -609,7 +610,7 @@ static int __init opalcore_init(void) * then capture the dump. */ 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(); return rc; } @@ -617,18 +618,32 @@ static int __init opalcore_init(void) /* Set OPAL core file 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 */ - rc = sysfs_create_bin_file(opal_kobj, &opal_core_attr); + rc = sysfs_create_bin_file(mpipl_kobj, &opal_core_attr); if (rc != 0) { - pr_err("Failed to export /sys/firmware/opal/core\n"); + pr_err("Failed to export /sys/firmware/opal/mpipl/core\n"); opalcore_cleanup(); return rc; } - - rc = sysfs_create_file(kernel_kobj, &opalcore_rel_attr.attr); + /* The /sys/firmware/opal/core is moved to /sys/firmware/opal/mpipl/ + * directory, need to create symlink at old location to maintain + * backward compatibility. + */ + rc = create_sysfs_symlink_entry_to_kobj(opal_kobj, mpipl_kobj, + "core", NULL); + if (rc) { + pr_err("unable to create core symlink (%d)\n", rc); + return rc; + } + rc = sysfs_create_file(mpipl_kobj, &opalcore_rel_attr.attr); if (rc) { - pr_warn("unable to create sysfs file fadump_release_opalcore (%d)\n", - rc); + pr_warn("unable to create sysfs file release_core (%d)\n", rc); } return 0; -- 2.17.2