From patchwork Fri Mar 20 08:18:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1258701 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (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 ozlabs.org (Postfix) with ESMTPS id 48kGs165KGz9sPF for ; Fri, 20 Mar 2020 19:19:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: 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=20161025 header.b=WjCY5dnK; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48kGs14VMvzDrYj for ; Fri, 20 Mar 2020 19:19:17 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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=20161025 header.b=WjCY5dnK; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 48kGrr0pc0zDrWX for ; Fri, 20 Mar 2020 19:19:05 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id j10so2833555pfi.12 for ; Fri, 20 Mar 2020 01:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QKiqac/OYcCJyUSiDQHWYmM0pbo3hPfLtRySzyy2CGs=; b=WjCY5dnKVEaRZuYmudPSmaosTLoSrO2k1ph0+cPQ0hnYif+QHKHSkb3M7rjuU1Mrw+ xBSObD81L+4oymca98uOkn3NKlY3kc55702ccMapL/GvUlpunS+AVX5h2mkgJ7sb99zd K6PCKRyl98wv0NrWsnzje+cgbH7DqfKvjVxwWSuSPT8ZmrJNbQnp+5UFHrwsxxCRrTOV buPpxA6fd30NpLo4p9VdRa0Dko5rjIt8XGW9oJKHQuWeQ8fShG/0zbHvnsxPI1hGU0zx tWfVU/RaTHCJLuWCqLeDPQewx1pwjnakyrJfTiQT5ovw7HpnRRV/QQQBc5z6oZMV/d70 7g0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QKiqac/OYcCJyUSiDQHWYmM0pbo3hPfLtRySzyy2CGs=; b=G6pVX0KQbLSsxu9JDVKNXRzUvzbA6tNej7ooZy6OEG9iHcRaNLNKDPYFwI/1PGwNkP bP28ikb+pPJ3cwlYVQLiPOgid+dSuGizV8xiM2RzekgKomE92dpzVLOjk+2J6QWoWSQz 5fZpwsjA60lBUT1j3Tx0SS+YrIsiPf5mAxPlEp1muRdx5rBfX1RX6k5cwR/8RJxq2h4/ PbEW2YTbWLq9N4b6UPU80S/PYOYPcWmnIPonz8WSLdkwZAYRukLLTsHP3PWhbv6VYR1N qs+grLk2aPNDGmiz6GR7oNHoDiHnx1fwE8qhIAPEOOYHJdNEoTLRLWym+ski8yHA2fAN CBDg== X-Gm-Message-State: ANhLgQ2kAxUBcKFWKaRZRN0IcaIFTbF5i0AQWTwAqalEew6qqislXNdj XDc06XTMreKdEmdgBOU718f5eLVD X-Google-Smtp-Source: ADFU+vtsyp18euxyxPVlJm2o5HTLQt6gFbsNFNj54WaKFa+G56sxGqn2nZoIZCLvN8z7/tvHHxS6qw== X-Received: by 2002:a62:7dd0:: with SMTP id y199mr8256050pfc.267.1584692342264; Fri, 20 Mar 2020 01:19:02 -0700 (PDT) Received: from localhost.ibm.com (61-68-226-105.tpgi.com.au. [61.68.226.105]) by smtp.gmail.com with ESMTPSA id n22sm3958909pjq.36.2020.03.20.01.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2020 01:19:01 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Fri, 20 Mar 2020 19:18:49 +1100 Message-Id: <20200320081849.6651-1-oohall@gmail.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Subject: [Skiboot] [PATCH] hw/prd: Hold FSP notifications while PRD is inactive 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" On FSP systems we rely on a service on the FSP to send us a notification when the OCCs become active. On systems with NVDIMMs this is especially critical because the OCC is responsible for starting the NVDIMM save procedure when power fails. The message sent from the FSP isn't sent to OPAL itself, rather it's sent to the PRD service running on the host (via OPAL). If this service is not running OPAL will currently send an error response back to the FSP and drop the message. This causes problems because the OCCs active message is generally sent while OPAL is still booting the system so the PRD daemon never gets notified that the OCC is active. Once the OS is running we rely on PRD to report the protection status of the NVDIMMs on the system. However, because it never recieves the notification from the FSP it will always report the DIMMs as un-protected because it thinks the OCCs are inactive. This patch fixes the issue by allowing a single message to be held in OPAL while PRD is inactive. Once OPAL recieves a notification that PRD has started we deliver the message. It's worth pointing out that this is kind of janky and brittle and would probably break horribly if FSP notify messages were multi-part since we could end up in a situation where only a single part of a multi-part message is queued, with the rest being dropped. However, the only user of the FSP notification message appears to be the OCC, and the OCC team says it's not a problem. I'll take their word for it. Signed-off-by: Oliver O'Halloran --- --- hw/prd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/prd.c b/hw/prd.c index b9d04c79d543..a9c3b34c27ce 100644 --- a/hw/prd.c +++ b/hw/prd.c @@ -374,7 +374,7 @@ int prd_hbrt_fsp_msg_notify(void *data, u32 dsize) int size, fw_notify_size; int rc = FSP_STATUS_GENERIC_ERROR; - if (!prd_enabled || !prd_active) { + if (!prd_enabled) { prlog(PR_NOTICE, "PRD: %s: PRD daemon is not ready\n", __func__); return rc; @@ -415,6 +415,12 @@ int prd_hbrt_fsp_msg_notify(void *data, u32 dsize) fw_notify->type = cpu_to_be64(PRD_FW_MSG_TYPE_HBRT_FSP); memcpy(&(fw_notify->mbox_msg), data, dsize); + if (!prd_active) { + // save the message, we'll deliver it when prd starts + rc = FSP_STATUS_BUSY; + goto unlock_events; + } + rc = opal_queue_prd_msg(prd_msg_fsp_notify); if (!rc) prd_msg_inuse = true; @@ -455,6 +461,11 @@ static int prd_msg_handle_init(struct opal_prd_msg *msg) * interrupts */ lock(&events_lock); prd_active = true; + + if (prd_msg_fsp_notify) { + if (!opal_queue_prd_msg(prd_msg_fsp_notify)) + prd_msg_inuse = true; + } if (!prd_msg_inuse) send_next_pending_event(); unlock(&events_lock);