{"id":784404,"url":"http://patchwork.ozlabs.org/api/1.2/patches/784404/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170705035627.19563-3-npiggin@gmail.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.2/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170705035627.19563-3-npiggin@gmail.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170705035627.19563-3-npiggin@gmail.com/","date":"2017-07-05T03:56:26","name":"[v2,2/3] powerpc/pseries/le: work around a firmware quirk","commit_ref":"bded0706434dd34fe9d39a8f1bbb518154cacd7f","pull_url":null,"state":"accepted","archived":false,"hash":"619b0ea010b84d94f43e8a23592628cc3c3eea06","submitter":{"id":69518,"url":"http://patchwork.ozlabs.org/api/1.2/people/69518/?format=json","name":"Nicholas Piggin","email":"npiggin@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170705035627.19563-3-npiggin@gmail.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/784404/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/784404/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3x2Rxs14Rrz9sBR\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 14:01:21 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3x2Rxs00jkzDr4P\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 14:01:21 +1000 (AEST)","from mail-pg0-x242.google.com (mail-pg0-x242.google.com\n\t[IPv6:2607:f8b0:400e:c05::242])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3x2Rrd0Y2MzDr1p\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed,  5 Jul 2017 13:56:49 +1000 (AEST)","by mail-pg0-x242.google.com with SMTP id d193so11236862pgc.2\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 04 Jul 2017 20:56:48 -0700 (PDT)","from roar.au.ibm.com (59-102-83-48.tpgi.com.au. [59.102.83.48])\n\tby smtp.gmail.com with ESMTPSA id\n\tu9sm47797908pfg.127.2017.07.04.20.56.43\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 04 Jul 2017 20:56:46 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ojY3ehOl\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ojY3ehOl\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ojY3ehOl\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=G7RcOOK9qvLz8T36/f/JUFfE5QuyOe9s0m+BHxQY/i0=;\n\tb=ojY3ehOlp7EL2rzYEXcbXeiShzwEAZLaJmTz37ukN8KD3Gq9p0v1NQfWDv29jo/ztD\n\t53OEmP2f1I9lB/+kcNecEvSDn3f37pzi34kz91Eq2QYUMATHAXWaYthcrCy3iceKtvQV\n\to8gN9pgu55jMgTtE93eoBbJpYnRtdJLgzx9ShWWOPXowD0PHR9dqFJriiu+3txxjPFro\n\tbq/hLNsgMtyDQLQwQyLF6n/kSiuaPBs6q5yIN/nLkTqfamYe7lY4XYG36nBWjOeZRe0/\n\tKOe61jGmb3Lm3hnZLXEf2YJqdXmQ5GiBNicAMJUOuRGNxLpnxcGJUcv1UYlFuOehOWGK\n\tTOug==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=G7RcOOK9qvLz8T36/f/JUFfE5QuyOe9s0m+BHxQY/i0=;\n\tb=APbM8RobGYTGeJfl7qRaX2uOE4F1+0+p55wrcutbXYp6C+g7qMYczSx1O4uC0sR5Yu\n\tVqWepEdu09kAhlpqgd5kD/DPkYcBU6HXUuXVXESlPK5a7oyCw484a6Byj4Kv1ZwTtf5w\n\tDSDlK4EGQBNRk9Ivq7G0MmJGPOYtvsTCMfrkgby3HXoPbxwVLGiTD7Uw9JCiG4JMUOv4\n\tvCUAkjWdLVl5rOPr6cdau1JvFrf9WiM6Df00Y9uU33EkGMcQwV+pU/IUNEv0/S5hztjR\n\t/CXqJOHp43fen24rqqAAwoUJwrnhlWR/zZ+gn4S9MbMWXnGo2C9zpyIxPY4IJwJcKewr\n\tS6CQ==","X-Gm-Message-State":"AIVw111tYufE8mUyGqFlWHNqhqdW6lI6yJLkozqTb4iHKrdrQih92GVt\n\tnIYd8+y/ClTtXN1f","X-Received":"by 10.84.224.15 with SMTP id r15mr19676529plj.78.1499227006969; \n\tTue, 04 Jul 2017 20:56:46 -0700 (PDT)","From":"Nicholas Piggin <npiggin@gmail.com>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH v2 2/3] powerpc/pseries/le: work around a firmware quirk","Date":"Wed,  5 Jul 2017 13:56:26 +1000","Message-Id":"<20170705035627.19563-3-npiggin@gmail.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170705035627.19563-1-npiggin@gmail.com>","References":"<20170705035627.19563-1-npiggin@gmail.com>","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Nicholas Piggin <npiggin@gmail.com>,\n\tMahesh Jagannath Salgaonkar <mahesh@linux.vnet.ibm.com>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"Some PowerVM firmware when delivering a system reset interrupt to a\nlittle endian OS will mess up SRR registers. They are byteswapped, and\nSRR1 is incorrect. An example from a crash:\n\n  NIP: 14dd0900000000c0\n  MSR: 1000000200000080\n\nIt's possible to detect this pattern in SRR1 (that would never happen in\nnormal operation), and at least fix the NIP. After this patch, the same\ninterrupt reports NIP properly:\n\n  NIP [c00000000009dd14] plpar_hcall_norets+0x1c/0x28\n\nSigned-off-by: Nicholas Piggin <npiggin@gmail.com>\n---\n arch/powerpc/platforms/pseries/ras.c | 15 +++++++++++++++\n 1 file changed, 15 insertions(+)","diff":"diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c\nindex bb70b26334f0..4923ffe230cf 100644\n--- a/arch/powerpc/platforms/pseries/ras.c\n+++ b/arch/powerpc/platforms/pseries/ras.c\n@@ -379,6 +379,21 @@ static void fwnmi_release_errinfo(void)\n \n int pSeries_system_reset_exception(struct pt_regs *regs)\n {\n+#ifdef __LITTLE_ENDIAN__\n+\t/*\n+\t * Some firmware byteswaps SRR registers and gives incorrect SRR1. Try\n+\t * to detect the bad SRR1 pattern here. Flip the NIP back to correct\n+\t * endian for reporting purposes. Unfortunately the MSR can't be fixed,\n+\t * so clear it. It will be missing MSR_RI so we won't try to recover.\n+\t */\n+\tif ((be64_to_cpu(regs->msr) &\n+\t\t\t(MSR_LE|MSR_RI|MSR_DR|MSR_IR|MSR_ME|MSR_PR|\n+\t\t\t MSR_ILE|MSR_HV|MSR_SF)) == (MSR_DR|MSR_SF)) {\n+\t\tregs->nip = be64_to_cpu((__be64)regs->nip);\n+\t\tregs->msr = 0;\n+\t}\n+#endif\n+\n \tif (fwnmi_active) {\n \t\tstruct rtas_error_log *errhdr = fwnmi_get_errinfo(regs);\n \t\tif (errhdr) {\n","prefixes":["v2","2/3"]}