From patchwork Thu Nov 25 00:41:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Niethe X-Patchwork-Id: 1559480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=20210112 header.b=WCudLr1V; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hzzbb6PJNz9t0G for ; Thu, 25 Nov 2021 11:42:03 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HzzbY2JQ4z3051 for ; Thu, 25 Nov 2021 11:42:01 +1100 (AEDT) Authentication-Results: lists.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=20210112 header.b=WCudLr1V; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1036; helo=mail-pj1-x1036.google.com; envelope-from=jniethe5@gmail.com; receiver=) 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=20210112 header.b=WCudLr1V; dkim-atps=neutral Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 4HzzbP2xqWz2yZh for ; Thu, 25 Nov 2021 11:41:53 +1100 (AEDT) Received: by mail-pj1-x1036.google.com with SMTP id p18-20020a17090ad31200b001a78bb52876so6368988pju.3 for ; Wed, 24 Nov 2021 16:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DGHRhlygHvo1+NMxxG9xGq8qqTVLpqvYObLRrDNpdN4=; b=WCudLr1VWRmZkhw8u93kSqCXjUeZ6LWzqLCq5Rru+W6uaXbSo4zvtkC3qz5RmhOhd3 Bh9KfxjsVn6sUkpjhAO2Stex3YiFqeyTBySbQQ8uXIdBL8vvknvNw4DPj3LzxdCcvYQf EkvnYszo/7GPpLZJI1KhTwFJXHayXWCXgZAbnW6A6IxZgbSPQ135JeHlRc5SabVK17kx vd4y0iVnIix34x73DkMHEXviMjI9CxTNTURuked/dQCCjJuVjwXOe+LEZ2oL+LbJOkUi cgWnt32dOgRrZNxiLekS2vZ/JvDl9lfGHpVnByhgdq+wNFBPCXh/31ELTmr6EzYPagyY eazw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DGHRhlygHvo1+NMxxG9xGq8qqTVLpqvYObLRrDNpdN4=; b=fzmFMk3Syt5np0ggNR9ImnuiYzmIb1EHN83xmmhi01+pt0lm8b/VQKO0eynMYuq2Ke HYrjen9slb5KegVuGRZA/89vXifl2gETtNnH0pLjJSUdrC7EW5mm6rDySzleMSilEQyi HppwFRPcp/Oy7DHamIOLvTu+sR9VGX3h5PJVia2rSKdS56K34sZh7Lxj3xFoxu1bltM8 dwA3eOOCY9ykWHGJajMaeIwkPJmTMbIlTdOW98VxCeeMAY8L9KTKdzKcJcI4IzcBfmWj UF8f63xx0QRDHpVWcfXweGg3a6v8rb15hikop8awmVIitpgS1MaEvP073xoPHnP5W+b+ OoJw== X-Gm-Message-State: AOAM530NGHWIvmD1UwJhAI7O0Higng0KnOZMpBgqFgO3h3rPsNI0fkg6 TiAFFeqlsUPbedyxC+AcFPyWlGzSzlc= X-Google-Smtp-Source: ABdhPJwXfx+RZxdqd6HO5xbahBDu2V97DIeIrd3XugFmPLmVrr9MOB3GdV9ME+Q5aPG/NT+usZU2iw== X-Received: by 2002:a17:903:1247:b0:143:b9b9:52a2 with SMTP id u7-20020a170903124700b00143b9b952a2mr24445071plh.35.1637800910785; Wed, 24 Nov 2021 16:41:50 -0800 (PST) Received: from tee480.ibm.com (159-196-117-139.9fc475.syd.nbn.aussiebb.net. [159.196.117.139]) by smtp.gmail.com with ESMTPSA id fw21sm5490326pjb.25.2021.11.24.16.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 16:41:50 -0800 (PST) From: Jordan Niethe To: pdbg@lists.ozlabs.org Date: Thu, 25 Nov 2021 11:41:31 +1100 Message-Id: <20211125004138.120917-3-jniethe5@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211125004138.120917-1-jniethe5@gmail.com> References: <20211125004138.120917-1-jniethe5@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 2/9] libpdbg: Enable p10 host backend X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Jordan Niethe --- libpdbg/dtb.c | 16 +++++++++++++++- src/main.c | 8 ++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c index 193b01ad1b38..2b084f74a042 100644 --- a/libpdbg/dtb.c +++ b/libpdbg/dtb.c @@ -42,6 +42,7 @@ #include "bmc-kernel.dt.h" #include "p8-host.dt.h" #include "p9-host.dt.h" +#include "p10-host.dt.h" #include "p8-cronus.dt.h" #include "cronus.dt.h" #include "bmc-sbefifo.dt.h" @@ -171,9 +172,15 @@ static void ppc_target(struct pdbg_dtb *dtb) dtb->backend.fdt = &_binary_p9_host_dtb_o_start; if (!dtb->system.fdt) dtb->system.fdt = &_binary_p9_dtb_o_start; + } else if (!strcmp(pdbg_backend_option, "p10")) { + pdbg_proc = PDBG_PROC_P10; + if (!dtb->backend.fdt) + dtb->backend.fdt = &_binary_p10_host_dtb_o_start; + if (!dtb->system.fdt) + dtb->system.fdt = &_binary_p10_dtb_o_start; } else { pdbg_log(PDBG_ERROR, "Invalid system type %s\n", pdbg_backend_option); - pdbg_log(PDBG_ERROR, "Use 'p8' or 'p9'\n"); + pdbg_log(PDBG_ERROR, "Use 'p8' or 'p9' or 'p10'\n"); } return; @@ -216,6 +223,13 @@ static void ppc_target(struct pdbg_dtb *dtb) dtb->backend.fdt = &_binary_p9_host_dtb_o_start; if (!dtb->system.fdt) dtb->system.fdt = &_binary_p9_dtb_o_start; + } else if (strncmp(pos, "POWER10", 7) == 0) { + pdbg_proc = PDBG_PROC_P10; + pdbg_log(PDBG_INFO, "Found a POWER10 PPC host system\n"); + if (!dtb->backend.fdt) + dtb->backend.fdt = &_binary_p10_host_dtb_o_start; + if (!dtb->system.fdt) + dtb->system.fdt = &_binary_p10_dtb_o_start; } else { pdbg_log(PDBG_ERROR, "Unsupported CPU type '%s'\n", pos); } diff --git a/src/main.c b/src/main.c index 63eb4075614b..461033e2e317 100644 --- a/src/main.c +++ b/src/main.c @@ -205,6 +205,9 @@ out2: } /* Stolen from skiboot */ +#define P10_PIR2GCID(pir) (((pir) >> 8) & 0xf) +#define P10_PIR2COREID(pir) (((pir) >> 2) & 0x3f) +#define P10_PIR2THREADID(pir) ((pir) & 0x3) #define P9_PIR2GCID(pir) (((pir) >> 8) & 0x7f) #define P9_PIR2COREID(pir) (((pir) >> 2) & 0x3f) #define P9_PIR2THREADID(pir) ((pir) & 0x3) @@ -227,6 +230,11 @@ bool pir_map(int pir, int *chip, int *core, int *thread) *core = P8_PIR2COREID(pir); *thread = P8_PIR2THREADID(pir); break; + case PDBG_PROC_P10: + *chip = P10_PIR2GCID(pir); + *core = P10_PIR2COREID(pir); + *thread = P10_PIR2THREADID(pir); + break; default: PR_ERROR("Unable to determine processor type for mapping to Linux CPU number\n"); return false;