From patchwork Mon Oct 12 02:53:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1380596 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C8jvC2K1Kz9s0b for ; Mon, 12 Oct 2020 13:54:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Q9pkbjAX; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C8jvC1hr1zDqbf for ; Mon, 12 Oct 2020 13:54:31 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::644; helo=mail-pl1-x644.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Q9pkbjAX; dkim-atps=neutral Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C8jtF31lFzDqZL for ; Mon, 12 Oct 2020 13:53:41 +1100 (AEDT) Received: by mail-pl1-x644.google.com with SMTP id b19so7825100pld.0 for ; Sun, 11 Oct 2020 19:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cYi8iNvsFTjePnPZzXqsCZLmw5Liw5pCMpv5lbEZF0k=; b=Q9pkbjAXfdYd0GIYoyQMUym8IgSelq5ghTqSWDCIQdGj8pV457ynyzkHLDLQdYzJWR C7EsJ2rburjhUp++/wG74uSsnjdB46jz4ajlwBtfz3+GIXFSqdfP+k13kiwtQGsGrujO HMZ2r8mpoPSz9Dm7FNHdlzFwhdJACIN3hVq6rm9Gt25Q6f8dKAZ5lRjFjmNjuqGk1NE7 pUsD3Q0UXCb7OOWRG9S6ax4OIBtPc2fwkzjzHV3l52MXzVzzMxqumN25xq66YIu4xI62 bqOplSgdo+pp7S17ChRVr6ltkdkVqOtTl0zp4orViiw0BX4Oz3/ALCE15wBZS5MtY42L 0xNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cYi8iNvsFTjePnPZzXqsCZLmw5Liw5pCMpv5lbEZF0k=; b=cSYpE8N1so13pTaxIy8zdssVRrKbmZWLksemjyWpemj7YXpC4Ek6yn+WHt8CfhFvMY VFGyt07l6BdKhD+h/TBs5WQUrgvGSsOr1fiPHpsH1bsadl/76WSP6SqGpHK3reJp7oT2 ZorQ9lEN5pXmMrQpUimWVXhRQhPlgELgxetPdnYdQz9VrW9vG+kZQY9cUuqt8Wx/DNtK SOAfHTensbOymDYifnCD/m/D9tJTZ58evFm5mfZuKJNq32Nlyv3U85iLpF2EKH2Y+KrK dLQWVIYLRf85EVsco0JQCPggHrU22EG+yF1NKUJVPRLsF3SeJ2FFB+ASvfdJ4yMnY9J3 1DvQ== X-Gm-Message-State: AOAM533OM23wQu0IBg6o4+Rr+a7k3aOugjnFw5I12oQKSy1XBY7UeOlw V7cB76HcOIKI9NMrWXrUxUpxRLA7rEQLuA== X-Google-Smtp-Source: ABdhPJyRUIWGizRjSCp1/YuXJdl+sqM22IfgJbITAKAOChYXmvL84Mbc3jdeEZxedLusbWRVvps5hw== X-Received: by 2002:a17:902:c3c5:b029:d3:df24:1ffb with SMTP id j5-20020a170902c3c5b02900d3df241ffbmr22076620plj.35.1602471217050; Sun, 11 Oct 2020 19:53:37 -0700 (PDT) Received: from localhost.ibm.com (14-200-206-90.tpgi.com.au. [14.200.206.90]) by smtp.gmail.com with ESMTPSA id g4sm17909258pgg.75.2020.10.11.19.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2020 19:53:36 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Mon, 12 Oct 2020 13:53:07 +1100 Message-Id: <20201012025314.1070230-3-oohall@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201012025314.1070230-1-oohall@gmail.com> References: <20201012025314.1070230-1-oohall@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH 03/10] trace: Add nvram hack to use the old trace export behaviour X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Previously we put all the trace buffer exports in the exports/ node. However, there's one trace buffer for each core so I moved them into a subdirectory since they were crowding up the place. Most kernels don't support recursively exporting subnodes though so kernel's don't have support for recursively exporting subnodes, so add a hack to restore the old behaviour for now. Signed-off-by: Oliver O'Halloran --- core/init.c | 3 +++ core/trace.c | 17 ++++++++++------- include/trace.h | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/core/init.c b/core/init.c index 6ddc7bde1be6..fbe1f90e6aae 100644 --- a/core/init.c +++ b/core/init.c @@ -1372,6 +1372,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt) /* Disable protected execution facility in BML */ cpu_disable_pef(); + /* export the trace buffers */ + trace_add_dt_props(); + /* Now release parts of memory nodes we haven't used ourselves... */ mem_region_release_unused(); diff --git a/core/trace.c b/core/trace.c index 5a3ad4921cdf..561bd79e0654 100644 --- a/core/trace.c +++ b/core/trace.c @@ -18,6 +18,7 @@ #include #include #include +#include #define DEBUG_TRACES @@ -155,7 +156,7 @@ void trace_add(union trace *trace, u8 type, u16 len) unlock(&ti->lock); } -static void trace_add_dt_props(void) +void trace_add_dt_props(void) { uint64_t boot_buf_phys = (uint64_t) &boot_tracebuf.trace_info; struct dt_node *exports, *traces; @@ -168,9 +169,14 @@ static void trace_add_dt_props(void) if (!exports) return; - traces = dt_new(exports, "traces"); - if (!exports) - return; + /* + * nvram hack to put all the trace buffer exports in the exports + * node. This is useful if the kernel doesn't also export subnodes. + */ + if (nvram_query_safe("flat-trace-buf")) + traces = exports; + else + traces = dt_new(exports, "traces"); prop = malloc(sizeof(u64) * 2 * be32_to_cpu(debug_descriptor.num_traces)); @@ -256,7 +262,4 @@ void init_trace_buffers(void) continue; t->trace = t->primary->trace; } - - /* Trace node in DT. */ - trace_add_dt_props(); } diff --git a/include/trace.h b/include/trace.h index 04c8440b9e0c..1b1be249cbde 100644 --- a/include/trace.h +++ b/include/trace.h @@ -25,6 +25,7 @@ struct trace_info { /* Allocate trace buffers once we know memory topology */ void init_trace_buffers(void); +void trace_add_dt_props(void); /* This will fill in timestamp and cpu; you must do type and len. */ void trace_add(union trace *trace, u8 type, u16 len);