From patchwork Fri Apr 16 21:02:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1467304 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org; receiver=) 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=TwXaHD1T; 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 4FMTFY3BVsz9sTD for ; Sat, 17 Apr 2021 07:03:13 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FMTFY27F4z3c9T for ; Sat, 17 Apr 2021 07:03:13 +1000 (AEST) Authentication-Results: lists.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=TwXaHD1T; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::82d; helo=mail-qt1-x82d.google.com; envelope-from=danielhb413@gmail.com; receiver=) 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=TwXaHD1T; dkim-atps=neutral Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 4FMTDk4GD4z30NG for ; Sat, 17 Apr 2021 07:02:30 +1000 (AEST) Received: by mail-qt1-x82d.google.com with SMTP id z15so13741027qtj.7 for ; Fri, 16 Apr 2021 14:02:30 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=yB+vSX1HdaS4xSQZ0Xj8cvvQKIrRD52dBzK1NC0kJXc=; b=TwXaHD1TxdYXn1ZkXBYQS9f6NeXHz7GIXjcfu1AVYsXcJqd1plTwPjQspNyzOGPt4i jp1ghutMRfOT2cPhkb2DAWK4RbdS6+2GdZ4p2vtyEW2/pR03+rvMOl5m5++EmCK0j7Z1 JGWo60gprGmhiAORO0TOv4y2YtRYgb8cnkybfF9dRKaVFaBqaAPOr1TvUpD5bVKy71b0 miQ9PW4erYJsGIIe9oqZt5bfm2QvoL75j85oBM1uo0XvDdss1k23fKUAS1q9idHNpMt5 D6tbeDV2SlNd6HjXZGQMhN1UKzjuPxZ+edd3+pjqgNYqvzSEEHigjBESPdxI9qoVjnH7 WsNQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=yB+vSX1HdaS4xSQZ0Xj8cvvQKIrRD52dBzK1NC0kJXc=; b=RrXlXLecepk2fxe1/yGAxPYYijFvr1BVJqY8oAZG88LPj++8/BHb5dPcghjTzFr506 Rp6WAz5ecnbbh9Jw42SCcS2DUJsqHdhlOJo8yllC1Cxrf5REUCFC95YGSh5cX2IkTF7H +4b7UqkjHXCMEMi86Rhb+g/U6azHXzrxirXjuguhBslJnbwA57s9idZRqghJRCmAr0Iy 9HpWoxRyq6jCBjJJQ8npl55ysdlx2WaiJflraj2Yj6AU2BTD42oX/X1EMckIwjIMvt9G HC94PI2ztWXt47g4iz93zom6vXPweSEHqgoSlVLMJq+MZ9qOKeo06F+hC8/bTHJQhQ4A Mbvw== X-Gm-Message-State: AOAM531l1oJS6GVyDdoyMIGDXTSsZNPoIZyB2Dnh7rNQPRCBgWqgMMsH ghmj0FAf47uZlnAR+orFxKGKF8i9V4D4Dv0FHcc= X-Google-Smtp-Source: ABdhPJyTWTmQnOTQciIFxi/5IdsKa5Xt5scVLMxbqPvIkfK9AvmqxCZRkaaciBuRFJANQhIkRzyc1Q== X-Received: by 2002:ac8:7451:: with SMTP id h17mr992648qtr.193.1618606947955; Fri, 16 Apr 2021 14:02:27 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:8811:45c7:4abc:f19a:be81]) by smtp.gmail.com with ESMTPSA id y6sm5020671qkd.106.2021.04.16.14.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 14:02:27 -0700 (PDT) From: Daniel Henrique Barboza To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/2] dlpar.c: introduce dlpar_unisolate_drc() Date: Fri, 16 Apr 2021 18:02:15 -0300 Message-Id: <20210416210216.380291-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416210216.380291-1-danielhb413@gmail.com> References: <20210416210216.380291-1-danielhb413@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , david@gibson.dropbear.id.au Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Next patch will execute a set-indicator call in hotplug-cpu.c. Create a dlpar_unisolate_drc() helper to avoid spreading more rtas_set_indicator() calls outside of dlpar.c. Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- arch/powerpc/platforms/pseries/dlpar.c | 14 ++++++++++++++ arch/powerpc/platforms/pseries/pseries.h | 1 + 2 files changed, 15 insertions(+) diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 233503fcf8f0..3ac70790ec7a 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c @@ -329,6 +329,20 @@ int dlpar_release_drc(u32 drc_index) return 0; } +int dlpar_unisolate_drc(u32 drc_index) +{ + int dr_status, rc; + + rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status, + DR_ENTITY_SENSE, drc_index); + if (rc || dr_status != DR_ENTITY_PRESENT) + return -1; + + rtas_set_indicator(ISOLATION_STATE, drc_index, UNISOLATE); + + return 0; +} + int handle_dlpar_errorlog(struct pseries_hp_errorlog *hp_elog) { int rc; diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h index 4fe48c04c6c2..4ea12037c920 100644 --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h @@ -55,6 +55,7 @@ extern int dlpar_attach_node(struct device_node *, struct device_node *); extern int dlpar_detach_node(struct device_node *); extern int dlpar_acquire_drc(u32 drc_index); extern int dlpar_release_drc(u32 drc_index); +extern int dlpar_unisolate_drc(u32 drc_index); void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog); int handle_dlpar_errorlog(struct pseries_hp_errorlog *hp_errlog); From patchwork Fri Apr 16 21:02:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1467305 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org; receiver=) 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=O/uzxfMJ; 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 4FMTG06smDz9sW1 for ; Sat, 17 Apr 2021 07:03:36 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FMTG05wp7z3cMt for ; Sat, 17 Apr 2021 07:03:36 +1000 (AEST) Authentication-Results: lists.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=O/uzxfMJ; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::729; helo=mail-qk1-x729.google.com; envelope-from=danielhb413@gmail.com; receiver=) 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=O/uzxfMJ; dkim-atps=neutral Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (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 4FMTDm5sGdz3bw1 for ; Sat, 17 Apr 2021 07:02:32 +1000 (AEST) Received: by mail-qk1-x729.google.com with SMTP id e13so20467009qkl.6 for ; Fri, 16 Apr 2021 14:02:32 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=bVeFYCnTaVSUp8Xv0RaV/4GEYDHU9zY3yyiCFqqEjEI=; b=O/uzxfMJzaKGXgQ3E7rqfClnCq0iW3cVafeo30Sk1FDrtCwnfLEfdqTLfwTz4diagL /Hb9acIfMphpe10Mp50uZJiMBoxlHbSHF3RhJwFBeaKiSn7KPrhJ7X7EaPV58rtWJ+lx VuYanEpCArypNbGDzEtznvcVlzFicRAbcKiZh8jRNUepMEC4Ym6hKSwysP+uFAQdypv1 PZ3wCGxosLv8YM3y2y0wFAZgZIhQCVyZzywkYKjQe3vHG2Sx7aFjFpZsBB//wfES3+hA 0Ujm3k3Vg5gKV21Yp471DZAD/l3x3qK5FUTVsSLmks8nt3gU7u7faeigmGMldFM5fCE6 N8wA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=bVeFYCnTaVSUp8Xv0RaV/4GEYDHU9zY3yyiCFqqEjEI=; b=LRtcCAak7JHtWgIs/maiDx3UWUDo2jaKUvfvgRdhJdmKFt+/jQ/aDwaEfm2ytslOLl 4Xwu60oPAP22Y6cNSfnuXQcFop1fGr8j6JiR60sxDRiGGiHob5/zC8/j2AoMElWkeiz3 Qmr6b8Bu7Smd5W7MTh1Qqu+tQtp/Y9oPjZB7P877yr5XJVicappvbQEHASDfg6ZBmKI7 dDBJV3g+6/6NFsqBRFy+/5boozGKsnFvE/BZAsTcMCBJvjaY5o16PMD1ZlCQbnwqt7YX tqj4LcHEaX4fv4RQf5WFgd7Id7uUNXJHcwnNGZVIo3EBeZGslstbV1nAuxWz/GYH8Gr2 PyUQ== X-Gm-Message-State: AOAM530JE1YztUv3xAkwyzQFy0MxWh0htM+oQekwp9ZUylBC4MQ2i9z8 9VbHItxKnJEELxZDJRW9TMlvQ2e2lk0xYuVwLpY= X-Google-Smtp-Source: ABdhPJwNOEUxKP49WfvvKI6CmXfSsdg+jCIk8bkPOD0/HknbqzgLMGV99tdz09D0HEUyXa9cELuG9Q== X-Received: by 2002:a05:620a:1181:: with SMTP id b1mr1195887qkk.81.1618606949835; Fri, 16 Apr 2021 14:02:29 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:8811:45c7:4abc:f19a:be81]) by smtp.gmail.com with ESMTPSA id y6sm5020671qkd.106.2021.04.16.14.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 14:02:29 -0700 (PDT) From: Daniel Henrique Barboza To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/2] hotplug-cpu.c: set UNISOLATE on dlpar_cpu_remove() failure Date: Fri, 16 Apr 2021 18:02:16 -0300 Message-Id: <20210416210216.380291-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416210216.380291-1-danielhb413@gmail.com> References: <20210416210216.380291-1-danielhb413@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , david@gibson.dropbear.id.au Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The RTAS set-indicator call, when attempting to UNISOLATE a DRC that is already UNISOLATED or CONFIGURED, returns RTAS_OK and does nothing else for both QEMU and phyp. This gives us an opportunity to use this behavior to signal the hypervisor layer when an error during device removal happens, allowing it to do a proper error handling, while not breaking QEMU/phyp implementations that don't have this support. This patch introduces this idea by unisolating all CPU DRCs that failed to be removed by dlpar_cpu_remove_by_index(), when handling the PSERIES_HP_ELOG_ID_DRC_INDEX event. This is being done for this event only because its the only CPU removal event QEMU uses, and there's no need at this moment to add this mechanism for phyp only code. Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- arch/powerpc/platforms/pseries/hotplug-cpu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 12cbffd3c2e3..ed66895c2f51 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -802,8 +802,15 @@ int dlpar_cpu(struct pseries_hp_errorlog *hp_elog) case PSERIES_HP_ELOG_ACTION_REMOVE: if (hp_elog->id_type == PSERIES_HP_ELOG_ID_DRC_COUNT) rc = dlpar_cpu_remove_by_count(count); - else if (hp_elog->id_type == PSERIES_HP_ELOG_ID_DRC_INDEX) + else if (hp_elog->id_type == PSERIES_HP_ELOG_ID_DRC_INDEX) { rc = dlpar_cpu_remove_by_index(drc_index); + /* Setting the isolation state of an UNISOLATED/CONFIGURED + * device to UNISOLATE is a no-op, but the hypervison can + * use it as a hint that the cpu removal failed. + */ + if (rc) + dlpar_unisolate_drc(drc_index); + } else rc = -EINVAL; break;