From patchwork Tue Aug 29 09:24:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lombard X-Patchwork-Id: 1827201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=oHtkZPg+; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RZhwM1nMrz1yZs for ; Tue, 29 Aug 2023 19:29:55 +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=oHtkZPg+; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4RZhwM0jgtz3cHf for ; Tue, 29 Aug 2023 19:29:55 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org 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=oHtkZPg+; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=clombard@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 4RZhnw4xgbz3bvP for ; Tue, 29 Aug 2023 19:24:20 +1000 (AEST) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37T8er9u005959 for ; Tue, 29 Aug 2023 09:24:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ODOJ4uDA/7rJdN9Svy6ky7Ru58YpT6GnwOhJQn1cxic=; b=oHtkZPg+fJw1BuDm5rC+8FwQky9Tjzcw1Trcsi3vEyFnutSZ9UMat43gxL3hTu31S6B1 MkzOf8Ry25XX2fwXxwYCCPqRkB2I9ttqWhO9NQrZyWMCpfKOWI1sZ6UKMz/mlUihuxk1 ENnmATGePV8hqgR04qTMoBnbGz02av5Bh3LvNdvyQX9BpYqq3PTf4zHYT6PcE88/wfAb WIDTQTW/4GKUpqxHVXmhHHAWx00TRN0KolaxsUYWHXY64FcpZUCuR/FkrICLyJc2aN+E GdLhtNaEV/XrEK+GgxrFIy/LwNvCH0com5P9yH+rx70gvk7qYY/XF7xpt/jxQtZLJX8D cg== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3srv501g9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 29 Aug 2023 09:24:18 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 37T8neHE019181 for ; Tue, 29 Aug 2023 09:24:17 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3sqxe1hqfh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 29 Aug 2023 09:24:17 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 37T9OFbr38994518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 29 Aug 2023 09:24:16 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CCDAC20043 for ; Tue, 29 Aug 2023 09:24:15 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 954A920040 for ; Tue, 29 Aug 2023 09:24:15 +0000 (GMT) Received: from li-ac0ca24c-3330-11b2-a85c-93224c50ad7a.home (unknown [9.171.88.232]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 29 Aug 2023 09:24:15 +0000 (GMT) From: Christophe Lombard To: skiboot@lists.ozlabs.org Date: Tue, 29 Aug 2023 11:24:09 +0200 Message-ID: <20230829092409.75899-16-clombard@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230829092409.75899-1-clombard@linux.ibm.com> References: <20230829092409.75899-1-clombard@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -CMPJNyVLswFs5aFmHkv__6ybxTWFxSE X-Proofpoint-GUID: -CMPJNyVLswFs5aFmHkv__6ybxTWFxSE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-29_06,2023-08-28_04,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308290078 Subject: [Skiboot] [PATCH V6 15/15] platforms/astbmc: Enable PLDM support 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" Last BMC firmware is available with a complete PLDM support on Rainier system. This patch allows initially to: - Initialize the MCTP core. - Enable the mctp binding over LPC bus interface and new wrappers to send and receive PLDM messages over the mctp library. - Retrieve all needed PLDM data. - "Virtualize" the content of a BMC flash based on lid files. Then, others mandatory support (watchdog, opal rtc, opal ipmi) are enabled. Signed-off-by: Christophe Lombard --- core/init.c | 16 +++++++++++++++- platforms/astbmc/astbmc.h | 4 ++++ platforms/astbmc/common.c | 34 ++++++++++++++++++++++++++++++++++ platforms/astbmc/pnor.c | 25 +++++++++++++++++++++++++ platforms/qemu/qemu.c | 6 ++++++ 5 files changed, 84 insertions(+), 1 deletion(-) diff --git a/core/init.c b/core/init.c index 73748a5d3..2d8a54595 100644 --- a/core/init.c +++ b/core/init.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -562,8 +563,12 @@ void __noreturn load_and_boot_kernel(bool is_reboot) trustedboot_exit_boot_services(); +#ifdef CONFIG_PLDM + pldm_platform_send_progress_state_change( + PLDM_STATE_SET_BOOT_PROG_STATE_STARTING_OP_SYS); +#else ipmi_set_fw_progress_sensor(IPMI_FW_OS_BOOT); - +#endif if (!is_reboot) { /* We wait for the nvram read to complete here so we can @@ -1408,10 +1413,19 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt) /* Setup ibm,firmware-versions if able */ if (platform.bmc) { flash_dt_add_fw_version(); +#ifdef CONFIG_PLDM + pldm_fru_dt_add_bmc_version(); +#else ipmi_dt_add_bmc_info(); +#endif } +#ifdef CONFIG_PLDM + pldm_platform_send_progress_state_change( + PLDM_STATE_SET_BOOT_PROG_STATE_PCI_RESORUCE_CONFIG); +#else ipmi_set_fw_progress_sensor(IPMI_FW_PCI_INIT); +#endif /* * These last few things must be done as late as possible diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h index 00f221230..7783fe20c 100644 --- a/platforms/astbmc/astbmc.h +++ b/platforms/astbmc/astbmc.h @@ -96,6 +96,10 @@ extern const struct bmc_platform bmc_plat_ast2600_openbmc; extern void astbmc_early_init(void); extern int64_t astbmc_ipmi_reboot(void); extern int64_t astbmc_ipmi_power_down(uint64_t request); +#ifdef CONFIG_PLDM +extern int astbmc_pldm_init(void); +extern int pnor_pldm_init(void); +#endif extern void astbmc_init(void); extern void astbmc_ext_irq_serirq_cpld(unsigned int chip_id); extern int pnor_init(void); diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c index 6697230bd..675eb218a 100644 --- a/platforms/astbmc/common.c +++ b/platforms/astbmc/common.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,36 @@ static int astbmc_fru_init(void) return 0; } +#ifdef CONFIG_PLDM +int astbmc_pldm_init(void) +{ + int rc = OPAL_SUCCESS; + + /* PLDM over MCTP */ + rc = pldm_mctp_init(); + if (!rc) { + /* Initialize PNOR/NVRAM */ + rc = pnor_pldm_init(); + + if (!rc) { + pldm_watchdog_init(); + pldm_rtc_init(); + pldm_opal_init(); + } + } + + /* Initialize elog */ + elog_init(); + + /* Setup UART console for use by Linux via OPAL API */ + set_opal_console(&uart_opal_con); + + if (rc) + prlog(PR_WARNING, "Failed to configure PLDM\n"); + + return rc; +} +#endif void astbmc_init(void) { @@ -542,6 +573,9 @@ void astbmc_early_init(void) void astbmc_exit(void) { +#ifdef CONFIG_PLDM + return; +#endif ipmi_wdt_final_reset(); ipmi_set_boot_count(); diff --git a/platforms/astbmc/pnor.c b/platforms/astbmc/pnor.c index 64f2249d1..853da4674 100644 --- a/platforms/astbmc/pnor.c +++ b/platforms/astbmc/pnor.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,30 @@ static enum ast_flash_style ast_flash_get_fallback_style(void) return raw_mem; } +#ifdef CONFIG_PLDM +int pnor_pldm_init(void) +{ + struct blocklevel_device *bl = NULL; + int rc = 0; + + rc = pldm_lid_files_init(&bl); + if (rc) { + prerror("PLAT: Failed to init PNOR driver\n"); + goto fail; + } + + rc = flash_register(bl); + if (!rc) + return 0; + +fail: + if (bl) + pldm_lid_files_exit(bl); + + return rc; +} +#endif + int pnor_init(void) { struct spi_flash_ctrl *pnor_ctrl = NULL; diff --git a/platforms/qemu/qemu.c b/platforms/qemu/qemu.c index 96153e853..0f6e089fa 100644 --- a/platforms/qemu/qemu.c +++ b/platforms/qemu/qemu.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -80,7 +81,12 @@ static void qemu_init(void) if (!bt_device_present) { set_opal_console(&uart_opal_con); } else { +#ifdef CONFIG_PLDM + /* need to be checked according platform: P10, P11 ... */ + astbmc_pldm_init(); +#else astbmc_init(); +#endif } }