From patchwork Thu May 31 04:29:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 923155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40xF1w5qpwz9s1B for ; Thu, 31 May 2018 14:32:52 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tm7eMD5/"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40xF1w4HgczF0S0 for ; Thu, 31 May 2018 14:32:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tm7eMD5/"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::242; helo=mail-pg0-x242.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tm7eMD5/"; dkim-atps=neutral Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40xDyv407TzDrpY for ; Thu, 31 May 2018 14:30:15 +1000 (AEST) Received: by mail-pg0-x242.google.com with SMTP id a13-v6so9113901pgu.4 for ; Wed, 30 May 2018 21:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+pQq2+uJG3Eb1rOZUaLaURa2sHu1p5Z8KmRaM5uSUN4=; b=Tm7eMD5/BDL7Ev9VoAYPTU59LG1I1F9n84tJ0hwyWILQhMZAg1lqKYVneQY2c8caBu p0tJQPcEZNTWlLYH+CGAxAYvJlQsUabeTnd4gM6OURmUPHIo90KNZRqksFERrKkl4NNs kpvsAJVneO8Vbxx/lY8GtohHRp1+NKXJ5261SXL10yN/RVJ1YGEHhmKFwuOCsY3uAUMq euYaW2Wb/DKaR7BVynFw4O4PJWytyO0M4iMO8zEOQgUkeyURW/8W/p1KGdJiqgQ4CA0V 03bV1lzazXvWCE6RAwTgSA18+66ePdQO2rbT6u3g7gXrGQW/3s/msF5DX6fG7J5HL7ul 40mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+pQq2+uJG3Eb1rOZUaLaURa2sHu1p5Z8KmRaM5uSUN4=; b=nd1tT46B26d1HeCr5tdzlFSpLygtQnuEwnaHNkH+NYdfryMyxG9Y3yy3rhrwfkdgz/ 48EUSrs2By8PN0rMe1oaJp+QDizjO2cgZnziIkMnoJGFEAdqIT2SYT9o3vi09QhHZ/+T UG+jEdGggM+qb65g0enp5sjBCYxrezuPSPEQceG9uHASS5xW1pInjMuAXxLJGqKFDdnY 6aZk1T1Hyxn6YhON2zLMgpkD/unaYLhwaSsPcg+aiM1ml55Ww1IwDR9PJjD0Pg5gSWEE jhvjvBzzRnlK8sjKp4Iwnnl5gesNeAlhNqZ+McGjJuyu1Jt6l0rTE2L8WJt+vdym6dR4 72ww== X-Gm-Message-State: ALKqPwclF3PbSLzZMGEFV449bFwgI4bSxGWiCJ+H7iXMJ5iOrTCo/CkI WxvXE6+VD3+WKz+rClQpc6ENTi3+ X-Google-Smtp-Source: ADUXVKIwYj0C+EiB+DDv6gq5vDurc2Pd/y3/MZ6dw+GryKKoVbWsoQb/umDIEIySSEg+VBW9vkvFYw== X-Received: by 2002:a63:42c7:: with SMTP id p190-v6mr1818140pga.142.1527741012981; Wed, 30 May 2018 21:30:12 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.19]) by smtp.gmail.com with ESMTPSA id w1-v6sm49652044pgp.3.2018.05.30.21.30.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 21:30:12 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 31 May 2018 14:00:06 +0930 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Thu, 31 May 2018 13:59:43 +0930 Message-Id: <20180531042943.15804-4-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531042943.15804-1-joel@jms.id.au> References: <20180531042943.15804-1-joel@jms.id.au> Subject: [Skiboot] [PATCH v3 3/3] dump: Always store kernel log buffer location X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" When the OPAL_REGISTER_DUMP_REGION call is made to register the kernel's log buffer, store that address in the debug descriptor. This address will be used by eg. pdbg to fetch the host kernel's log buffer over FSI. We unconditionally clear the value on a reboot (both fast-reboot and reliable reboot) to reduce the chance of debug tools getting the wrong buffer. Signed-off-by: Joel Stanley --- core/dump-region.c | 14 ++++++++++++-- core/init.c | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/dump-region.c b/core/dump-region.c index afa4c2685b89..2917276a4097 100644 --- a/core/dump-region.c +++ b/core/dump-region.c @@ -22,18 +22,28 @@ static int64_t opal_register_dump_region(uint32_t id, uint64_t addr, uint64_t size) { + if (id == OPAL_DUMP_REGION_LOG_BUF) { + prlog(PR_INFO, "Registered log buf at 0x%016llx\n", addr); + debug_descriptor.log_buf_phys = addr; + } + if (platform.register_dump_region) return platform.register_dump_region(id, addr, size); - return OPAL_UNSUPPORTED; + return OPAL_SUCCESS; } opal_call(OPAL_REGISTER_DUMP_REGION, opal_register_dump_region, 3); static int64_t opal_unregister_dump_region(uint32_t id) { + if (id == OPAL_DUMP_REGION_LOG_BUF) { + prlog(PR_INFO, "Unregistered log buf\n"); + debug_descriptor.log_buf_phys = 0; + } + if (platform.unregister_dump_region) return platform.unregister_dump_region(id); - return OPAL_UNSUPPORTED; + return OPAL_SUCCESS; } opal_call(OPAL_UNREGISTER_DUMP_REGION, opal_unregister_dump_region, 1); diff --git a/core/init.c b/core/init.c index 3b887a24d11c..6caf0ba6913d 100644 --- a/core/init.c +++ b/core/init.c @@ -563,6 +563,10 @@ void __noreturn load_and_boot_kernel(bool is_reboot) mem_dump_free(); + /* Zero out memory location before the next kernel starts, + * in case the previous kernel did not unregister */ + debug_descriptor.log_buf_phys = 0; + /* Take processours out of nap */ cpu_set_sreset_enable(false); cpu_set_ipi_enable(false);