From patchwork Mon Jul 19 13:19:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1507032 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ZpvBYwZd; dkim-atps=neutral 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GT2ZG0L8Vz9sXG for ; Mon, 19 Jul 2021 23:22:14 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GT2ZF6Ppxz3bWl for ; Mon, 19 Jul 2021 23:22:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ZpvBYwZd; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ZpvBYwZd; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GT2Y469Jdz3bYr for ; Mon, 19 Jul 2021 23:21:12 +1000 (AEST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16JD3pjT072941 for ; Mon, 19 Jul 2021 09:21:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=KXhv85uZFV85h/yqM8I7gQ/j2tUJp3J0an6Yr6V44Zg=; b=ZpvBYwZdYU9jxHT7Diw4X9cefB/Ww6cNfTBaNuDnL3YRo6X3KWxC7eMH6pNGgsHqo94P r2gFcKbxLUqV7QDk+ELUHFYocHMv948AE9IiKhoq6k0n2NRz//gKYOVnCVKbtNS9GTGZ H8j2PRzgbGP53/UCEpXiZgeNFOJGMjdMFdZIrJaVaZqOpuLrFZbayPWDu2jTzL4ednDd UfUBxXTXT2qCbyaNQJNylJiuS82VKBlGKMb4Aea6vupb9SMax4M3QlLXVXJczby+P0f1 XV+GnCC1y7rWS2r+YmpDLGPFrfMQ70HML4XM5g+C69RhXE8Ws+1BFQPs95yD1LcVf21a PQ== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 39w8sxavaq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Jul 2021 09:21:10 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16JDCI80015977 for ; Mon, 19 Jul 2021 13:21:08 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 39vng70bq0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Jul 2021 13:21:08 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16JDL5GD26476924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Jul 2021 13:21:05 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9EF33A405E; Mon, 19 Jul 2021 13:21:05 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BCF69A4040; Mon, 19 Jul 2021 13:21:04 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.86.230]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 19 Jul 2021 13:21:04 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Mon, 19 Jul 2021 18:49:28 +0530 Message-Id: <20210719132012.150948-18-hegdevasant@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210719132012.150948-1-hegdevasant@linux.vnet.ibm.com> References: <20210719132012.150948-1-hegdevasant@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: jdjv-PqvOrlu6o4zZkSjn4LsizA1JZF_ X-Proofpoint-GUID: jdjv-PqvOrlu6o4zZkSjn4LsizA1JZF_ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-19_05:2021-07-19, 2021-07-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 priorityscore=1501 mlxscore=0 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107190076 Subject: [Skiboot] [PATCH 17/61] hdata/P10: Fix xscom address and ibm, chip-id property 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" `xscom_id` is deprecated in P10. Instead we should use topology ID's ("Primary topology table index") to calculate xscom address. Also use ("Processor fabric topology id") for "ibm,chip-id" property. Signed-off-by: Vasant Hegde --- hdata/fsp.c | 2 +- hdata/hdata.h | 1 + hdata/spira.c | 34 +++++++++++++++++++++++----------- hdata/spira.h | 3 +++ 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/hdata/fsp.c b/hdata/fsp.c index 458b7e636..42f1121ab 100644 --- a/hdata/fsp.c +++ b/hdata/fsp.c @@ -297,7 +297,7 @@ static void add_chip_id_to_sensors(struct dt_node *sensor_node, uint32_t slca_in } dt_add_property_cells(sensor_node, - "ibm,chip-id", be32_to_cpu(cinfo->xscom_id)); + "ibm,chip-id", get_xscom_id(cinfo)); return; } } diff --git a/hdata/hdata.h b/hdata/hdata.h index cbc61c31d..bae4eaa58 100644 --- a/hdata/hdata.h +++ b/hdata/hdata.h @@ -24,6 +24,7 @@ extern void vpd_data_parse(struct dt_node *node, extern struct dt_node *find_xscom_for_chip(uint32_t chip_id); extern uint32_t pcid_to_chip_id(uint32_t proc_chip_id); +extern uint32_t get_xscom_id(const struct sppcrd_chip_info *cinfo); extern struct dt_node *add_core_common(struct dt_node *cpus, const struct sppcia_cpu_cache *cache, diff --git a/hdata/spira.c b/hdata/spira.c index b7101d72e..7d56f3f29 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -289,12 +289,23 @@ struct HDIF_common_hdr *__get_hdif(struct spira_ntuple *n, const char id[], return h; } -static struct dt_node *add_xscom_node(uint64_t base, uint32_t hw_id, - uint32_t proc_chip_id) +uint32_t get_xscom_id(const struct sppcrd_chip_info *cinfo) +{ + if (proc_gen <= proc_gen_p9) + return be32_to_cpu(cinfo->xscom_id); + + /* On P10 use Processor fabric topology id for chip id */ + return (uint32_t)(cinfo->fab_topology_id); +} + +static struct dt_node *add_xscom_node(uint64_t base, + const struct sppcrd_chip_info *cinfo) { struct dt_node *node; uint64_t addr, size; uint64_t freq; + uint32_t hw_id = get_xscom_id(cinfo); + uint32_t proc_chip_id = be32_to_cpu(cinfo->proc_chip_id); switch (proc_gen) { case proc_gen_p8: @@ -302,13 +313,16 @@ static struct dt_node *add_xscom_node(uint64_t base, uint32_t hw_id, addr = base | ((uint64_t)hw_id << PPC_BITLSHIFT(28)); break; case proc_gen_p9: - case proc_gen_p10: /* XXX P10 */ - default: /* On P9 we need to put the chip ID in the natural powerbus * position. */ addr = base | (((uint64_t)hw_id) << 42); break; + case proc_gen_p10: + default: + /* Use Primary topology table index for xscom address */ + addr = base | (((uint64_t)cinfo->topology_id_table[cinfo->primary_topology_loc]) << 44); + break; }; size = (u64)1 << PPC_BITLSHIFT(28); @@ -611,9 +625,7 @@ static bool add_xscom_sppcrd(uint64_t xscom_base) continue; /* Create the XSCOM node */ - np = add_xscom_node(xscom_base, - be32_to_cpu(cinfo->xscom_id), - be32_to_cpu(cinfo->proc_chip_id)); + np = add_xscom_node(xscom_base, cinfo); if (!np) continue; @@ -636,7 +648,7 @@ static bool add_xscom_sppcrd(uint64_t xscom_base) SPPCRD_IDATA_KW_VPD); if (vpd_node) dt_add_property_cells(vpd_node, "ibm,chip-id", - be32_to_cpu(cinfo->xscom_id)); + get_xscom_id(cinfo)); fru_id = HDIF_get_idata(hdif, SPPCRD_IDATA_FRU_ID, NULL); if (fru_id) @@ -875,7 +887,7 @@ static bool add_chiptod_new(void) flags |= CHIPTOD_ID_FLAGS_PRIMARY; } - add_chiptod_node(be32_to_cpu(cinfo->xscom_id), flags); + add_chiptod_node(get_xscom_id(cinfo), flags); found = true; } return found; @@ -947,7 +959,7 @@ static void add_nx(void) continue; if (cinfo->nx_state) - add_nx_node(be32_to_cpu(cinfo->xscom_id)); + add_nx_node(get_xscom_id(cinfo)); } } @@ -1397,7 +1409,7 @@ uint32_t pcid_to_chip_id(uint32_t proc_chip_id) continue; } if (proc_chip_id == be32_to_cpu(cinfo->proc_chip_id)) - return be32_to_cpu(cinfo->xscom_id); + return get_xscom_id(cinfo); } /* Not found, what to do ? Assert ? For now return a number diff --git a/hdata/spira.h b/hdata/spira.h index 7da1154d7..3a8a31e1a 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -1096,6 +1096,9 @@ struct sppcrd_chip_info { #define CHIP_MAX_TOPOLOGY_ENTRIES 32 uint8_t topology_id_table[CHIP_MAX_TOPOLOGY_ENTRIES]; uint8_t primary_topology_loc; /* Index in topology_id_table */ + __be32 abc_bus_speed; /* SMP A */ + __be32 wxyz_bus_speed; /* SMP X */ + uint8_t fab_topology_id;/* topology id associated with the chip. */ } __packed; /* Idata index 1 : Chip TOD */