From patchwork Fri Jul 21 09:07:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lombard X-Patchwork-Id: 1810820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) 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=f05jb9fq; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R6kMf0QGmz1yYc for ; Fri, 21 Jul 2023 19:11:58 +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=f05jb9fq; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4R6kMd6QmXz3dTX for ; Fri, 21 Jul 2023 19:11:57 +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=f05jb9fq; 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 4R6kGY1hTFz3cX8 for ; Fri, 21 Jul 2023 19:07:33 +1000 (AEST) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36L8ouO7009140 for ; Fri, 21 Jul 2023 09:07:31 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=9Y1t7Lyyn03nfKON2Y05MmXGSvdaXav3Rh2g1v5lrm0=; b=f05jb9fqMy4yuHx4UJCmnIZYQTZWR6JfIW601r+bBq09nk+wM8Z+p+Jf4sUACW0Mnsn/ H5rw9POWTpqbTRleDEXKrV5U6P1Z5I3Ndf384Z6vwu/3TPHaRqgVp0xnpIpkfnQ5Xo3d kQYDcHKdllRV5RzyXhBtNVTiVWLVmlbiHyJNAzxHhOJge+/I/50s0oMI0CUy8YcHgbZ4 ai9b0UCkUS2Mn/HakaBkFeloy7ZWd/0+02FwtPv5UHHqclrvrPHkvr1sSqF7mEhUng40 2xiXiyLOQm7MreghN4mwfb9l6hDzDttcKoWrbYQuB7d7MZLRLX06nForv5nrQsfyf4lX xA== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ryp34sq55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 21 Jul 2023 09:07:31 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36L7tujr007605 for ; Fri, 21 Jul 2023 09:07:30 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3rv80jjwbb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 21 Jul 2023 09:07:30 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36L97Stt20841028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 21 Jul 2023 09:07:28 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B9AB20043 for ; Fri, 21 Jul 2023 09:07:28 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E53982004D for ; Fri, 21 Jul 2023 09:07:27 +0000 (GMT) Received: from li-ac0ca24c-3330-11b2-a85c-93224c50ad7a.ibm.com.com (unknown [9.179.31.149]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP for ; Fri, 21 Jul 2023 09:07:27 +0000 (GMT) From: Christophe Lombard To: skiboot@lists.ozlabs.org Date: Fri, 21 Jul 2023 11:07:21 +0200 Message-ID: <20230721090721.26050-16-clombard@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721090721.26050-1-clombard@linux.ibm.com> References: <20230721090721.26050-1-clombard@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: L-A7dKV0mU4-IWlYVxdx-YCtHjoR-7Ck X-Proofpoint-GUID: L-A7dKV0mU4-IWlYVxdx-YCtHjoR-7Ck X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_05,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 spamscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210081 Subject: [Skiboot] [PATCH V5 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 73748a5d..2d8a5459 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 00f22123..7783fe20 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 6697230b..675eb218 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 64f2249d..853da467 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 96153e85..0f6e089f 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 } }