From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C9BC25BACC; Tue, 11 Mar 2025 15:27:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706864; cv=none; b=Hf2TrqAW8STtLlqY2a3cA2jwAJ04kEztZY5yY/XQcnC0k/DWi9uu9+WdXEjxZpD/z6rej3YAyjUsTTUNpB5rDDAVAhiWw7JyUu0THIIIWGPXQ3lIqjVzDwo4oNogeVyA9XVMdVIdI3bFuN+2W4ePjdBWCbCTjecyYS1hcbTZL/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706864; c=relaxed/simple; bh=iAKAPYErsQi5pgcRP+RzcYQ0GazQNb7UwhSsnNjFQTc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tPdSk0yw+z04iBRIyRi8wpt+RaQ4NaYlYyxzKO9JIb5b5p8bs8GUzaDmWIJB5K0GtVf4CLzH/fYrTEFnwqjRV84XOA7N3Kdh+GdD9PXqyKEAUi69qPYfQa4Xk0GNcmGOVvB57ai7/ElZLbEGBZemqXw+CIF8Ab3nMZeUWKiqEzI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gZRyypCW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gZRyypCW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7655AC4CEE9; Tue, 11 Mar 2025 15:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741706863; bh=iAKAPYErsQi5pgcRP+RzcYQ0GazQNb7UwhSsnNjFQTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZRyypCWTUivIT8xzf0miVooJ+OR+NlNjnJzN/vDLsrPGucfwCOlBPq121m1ERJwi clie0HvXG/VPnjz4BOHeY8ORA1/bltPipvL3TYiQtNhwkDdSDyd+ALiseP2k4n05bg QU6KP7Hb1TXvs6sfEtw9AK4xJOoBHHUW1G8skb8o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Ritesh Harjani (IBM)" , Narayana Murty N , Madhavan Srinivasan Subject: [PATCH 5.10 194/462] powerpc/pseries/eeh: Fix get PE state translation Date: Tue, 11 Mar 2025 15:57:40 +0100 Message-ID: <20250311145806.023231375@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250311145758.343076290@linuxfoundation.org> References: <20250311145758.343076290@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Narayana Murty N commit 11b93559000c686ad7e5ab0547e76f21cc143844 upstream. The PE Reset State "0" returned by RTAS calls "ibm_read_slot_reset_[state|state2]" indicates that the reset is deactivated and the PE is in a state where MMIO and DMA are allowed. However, the current implementation of "pseries_eeh_get_state()" does not reflect this, causing drivers to incorrectly assume that MMIO and DMA operations cannot be resumed. The userspace drivers as a part of EEH recovery using VFIO ioctls fail to detect when the recovery process is complete. The VFIO_EEH_PE_GET_STATE ioctl does not report the expected EEH_PE_STATE_NORMAL state, preventing userspace drivers from functioning properly on pseries systems. The patch addresses this issue by updating 'pseries_eeh_get_state()' to include "EEH_STATE_MMIO_ENABLED" and "EEH_STATE_DMA_ENABLED" in the result mask for PE Reset State "0". This ensures correct state reporting to the callers, aligning the behavior with the PAPR specification and fixing the bug in EEH recovery for VFIO user workflows. Fixes: 00ba05a12b3c ("powerpc/pseries: Cleanup on pseries_eeh_get_state()") Cc: stable@vger.kernel.org Reviewed-by: Ritesh Harjani (IBM) Signed-off-by: Narayana Murty N Link: https://lore.kernel.org/stable/20241212075044.10563-1-nnmlinux%40linux.ibm.com Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20250116103954.17324-1-nnmlinux@linux.ibm.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/eeh_pseries.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -578,8 +578,10 @@ static int pseries_eeh_get_state(struct switch(rets[0]) { case 0: - result = EEH_STATE_MMIO_ACTIVE | - EEH_STATE_DMA_ACTIVE; + result = EEH_STATE_MMIO_ACTIVE | + EEH_STATE_DMA_ACTIVE | + EEH_STATE_MMIO_ENABLED | + EEH_STATE_DMA_ENABLED; break; case 1: result = EEH_STATE_RESET_ACTIVE |