aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2014-01-21 09:52:36 +1100
committerEli Qiao <taget@linux.vnet.ibm.com>2014-01-22 10:26:24 +0800
commitfbd8173314a3ce24d3b9670c5a1aea342b144c04 (patch)
treebbdaf5af22ec86c372eee97f49fb54e103941b45
parent06f5602188ab63d07aee890e694a8f5cf2fa57ad (diff)
downloadpowerkvm-fbd8173314a3ce24d3b9670c5a1aea342b144c04.tar.gz
powerpc/powernv: Fix platform dump interface
This patch is a increamental patch on top of commit af93eec4. This adds support to resend dump available notification, updates README file. Alos fixes with few other minor issues. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/opal.h2
-rw-r--r--arch/powerpc/platforms/powernv/opal-dump.c54
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S1
3 files changed, 38 insertions, 19 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 013a696d098a00..554a031dcde807 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -173,6 +173,7 @@ extern int opal_enter_rtas(struct rtas_args *args,
#define OPAL_SENSOR_READ 88
#define OPAL_GET_PARAM 89
#define OPAL_SET_PARAM 90
+#define OPAL_DUMP_RESEND 91
#ifndef __ASSEMBLY__
@@ -868,6 +869,7 @@ int64_t opal_dump_init(uint8_t dump_type);
int64_t opal_dump_info(uint32_t *dump_id, uint32_t *dump_size);
int64_t opal_dump_read(uint32_t dump_id, uint64_t buffer);
int64_t opal_dump_ack(uint32_t dump_id);
+int64_t opal_dump_resend_notification(void);
int64_t opal_get_msg(uint64_t buffer, size_t size);
int64_t opal_check_completion(uint64_t buffer, size_t size, uint64_t token);
int64_t opal_sync_host_reboot(void);
diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c
index 646c970a08ca1a..444702769e6eb9 100644
--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -173,7 +173,7 @@ static int64_t dump_read_info(void)
}
/*
- * Send acknoledgement to OPAL
+ * Send acknowledgement to OPAL
*/
static int64_t dump_send_ack(uint32_t dump_id)
{
@@ -181,7 +181,7 @@ static int64_t dump_send_ack(uint32_t dump_id)
rc = opal_dump_ack(dump_id);
if (rc)
- pr_warn("%s: Failed to send ack message to ID 0x%x (%d)\n",
+ pr_warn("%s: Failed to send ack to Dump ID 0x%x (%d)\n",
__func__, dump_id, rc);
return rc;
}
@@ -214,12 +214,12 @@ static int64_t dump_read_data(void)
addr = __pa(list);
/* Fetch data */
- rc = OPAL_BUSY;
+ rc = OPAL_BUSY_EVENT;
while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
rc = opal_dump_read(dump_record.id, addr);
- if (rc == OPAL_BUSY) {
+ if (rc == OPAL_BUSY_EVENT) {
opal_poll_events(NULL);
- mdelay(10);
+ msleep(10);
}
}
@@ -258,11 +258,11 @@ static int extract_dump(void)
return rc;
}
if (rc == OPAL_PARTIAL)
- pr_info("%s: Partially read dump ID 0x%x\n",
+ pr_info("%s: Platform dump partially read. ID = 0x%x\n",
+ __func__, dump_record.id);
+ else
+ pr_info("%s: New platform dump available. ID = 0x%x\n",
__func__, dump_record.id);
-
- pr_info("%s: New platform dump available. ID = 0x%x\n",
- __func__, dump_record.id);
/* Update dump blob */
dump_blob.data = (void *)dump_record.buffer;
@@ -291,7 +291,7 @@ static void schedule_extract_dump(void)
* New dump available notification
*
* Once we get notification, we extract dump via OPAL call
- * and then write dump to file.
+ * and then pass dump to userspace via debugfs interface.
*/
static int dump_event(struct notifier_block *nb,
unsigned long events, void *change)
@@ -317,9 +317,17 @@ static struct notifier_block dump_nb = {
};
-/* FIXME: debugfs README message */
+/* debugfs README message */
static const char readme_msg[] =
- "This file will be populated shortly..";
+ "Platform dump HOWTO:\n\n"
+ "files:\n"
+ " dump - Binary file, contains actual dump data\n"
+ " dump_available (r--) - New dump available notification\n"
+ " 0 : No dump available\n"
+ " 1 : New dump available\n"
+ " dump_control(-w-) - Dump control file\n"
+ " 1 : Send acknowledgement (dump copied)\n"
+ " 2 : Initiate FipS dump\n";
/* debugfs dump_control file operations */
static ssize_t dump_control_write(struct file *file,
@@ -335,7 +343,7 @@ static ssize_t dump_control_write(struct file *file,
switch (buf[0]) {
case '1': /* Dump send ack */
- if(dump_avail) {
+ if (dump_avail) {
dump_avail = 0;
free_dump_data_buf();
dump_send_ack(dump_record.id);
@@ -405,16 +413,24 @@ out:
void __init opal_platform_dump_init(void)
{
- int ret;
+ int rc;
+
+ /* debugfs interface */
+ rc = debugfs_dump_init();
+ if (rc) {
+ pr_warn("%s: Failed to create debugfs interface (%d)\n",
+ __func__, rc);
+ return;
+ }
/* Register for opal notifier */
- ret = opal_notifier_register(&dump_nb);
- if (ret) {
+ rc = opal_notifier_register(&dump_nb);
+ if (rc) {
pr_warn("%s: Can't register OPAL event notifier (%d)\n",
- __func__, ret);
+ __func__, rc);
return;
}
- /* debugfs interface */
- ret = debugfs_dump_init();
+ /* Request to resend dump available notification */
+ opal_dump_resend_notification();
}
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index c4907aae01cb74..81e445f689232d 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -136,3 +136,4 @@ OPAL_CALL(opal_sync_host_reboot, OPAL_SYNC_HOST_REBOOT);
OPAL_CALL(opal_sensor_read, OPAL_SENSOR_READ);
OPAL_CALL(opal_get_param, OPAL_GET_PARAM);
OPAL_CALL(opal_set_param, OPAL_SET_PARAM);
+OPAL_CALL(opal_dump_resend_notification, OPAL_DUMP_RESEND);