<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <br>
    <br>
    <div class="moz-cite-prefix">Le 21/06/2023 à 07:16, Nicholas Piggin
      a écrit :<br>
    </div>
    <blockquote type="cite" cite="mid:CTI2N9I4N88W.1P1S3NF66H8N@wheely">
      <pre class="moz-quote-pre" wrap="">On Wed Jun 21, 2023 at 1:01 AM AEST, Christophe Lombard wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Last BMC firmware is available with a complete PLDM support on Rainier
system.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
It works with shipping firmware?
</pre>
    </blockquote>
    <br>
    <span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
          class="ryNqvb">yes, today shipping BMC firmware supports both
          protocols by default on a P10<br>
          machine, which will certainly no longer be, I think, the case
          on a P11 machine.</span></span> <br>
      <span class="jCAhz ChMk0b"><span class="ryNqvb">Only PLDM will
          exist.<br>
          <br>
        </span></span></span>
    <blockquote type="cite" cite="mid:CTI2N9I4N88W.1P1S3NF66H8N@wheely">
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">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 <a class="moz-txt-link-rfc2396E" href="mailto:clombard@linux.ibm.com"><clombard@linux.ibm.com></a>
---
 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 e832a009..922eeb11 100644
--- a/core/init.c
+++ b/core/init.c
@@ -34,6 +34,7 @@
 #include <libfdt/libfdt.h>
 #include <timer.h>
 #include <ipmi.h>
+#include <pldm.h>
 #include <sensor.h>
 #include <xive.h>
 #include <nvram.h>
@@ -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
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Will need to dynamically select IPMI or PLDM I guess.
</pre>
    </blockquote>
    <br>
    With the current patches, we don't have implemented a mechanism to
    select<br>
    IPMI or PLDM automatically. This is done when compiling skiboot.<br>
    You must add the CONFIG_PLDM option if you want to use the PLDM
    protocol<br>
    instead of IPMI. It's one or the other.<br>
    <br>
    <blockquote type="cite" cite="mid:CTI2N9I4N88W.1P1S3NF66H8N@wheely">
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">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 <xscom.h>
 #include <ast.h>
 #include <ipmi.h>
+#include <pldm.h>
 #include <bt.h>
 #include <errorlog.h>
 #include <lpc.h>
@@ -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");
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Is it possible to then try IPMI here, or is that more difficult?
</pre>
    </blockquote>
    <br>
    <span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
          class="ryNqvb">It might be possible.</span></span> <span
        class="jCAhz ChMk0b"><span class="ryNqvb">We could actually try
          to see if the BMC responds to<br>
          an IPMI request.</span></span><span class="jCAhz"><span
          class="ryNqvb">
        </span></span><span class="jCAhz ChMk0b"><span class="ryNqvb">Otherwise,
          we switch to PLDM.<br>
          <br>
        </span></span></span><span class="HwtZe" lang="en"><span
        class="jCAhz ChMk0b"><span class="ryNqvb">The CONFIG_PLDM
          compilation flag was set up in order not to include, by<br>
          default, the pldm code in skiboot for P10 machines and before,
          but we <br>
          can still use it, if we want, by re-compiling</span></span> <span
        class="jCAhz ChMk0b"><span class="ryNqvb">Skiboot.</span></span><br>
      <span class="jCAhz ChMk0b"></span></span><span class="HwtZe"
      lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb"><span
            class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
                class="ryNqvb">When the P11 machine will be introduced
                in skiboot, it will be necessary to<br>
                compile, by default, with the pldm code.</span></span></span></span></span></span><span
      class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span
          class="ryNqvb"></span></span></span><br>
    <br>
    <blockquote type="cite" cite="mid:CTI2N9I4N88W.1P1S3NF66H8N@wheely">
      <pre class="moz-quote-pre" wrap="">
Thanks,
Nick
</pre>
    </blockquote>
    <br>
  </body>
</html>