From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 A237936997A for ; Wed, 26 Aug 2026 11:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787742477; cv=none; b=arru1zghPOl7hZt/YdrG69ElHXXO6hepyXxasGOUVvLTWMlT9gFK/b7iaOPgX/rXRh1PP3cX3fBw+AKeaev3Ogfpmj5js/ktWGFYoa2PK3ai17+JmGn1H1QLv0AzgBtOnfzP8Jql29kordOH2fs9XqmBPghImKT/PZcHtcMhWrA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787742477; c=relaxed/simple; bh=aLc1NpOIuawxiQXtw+ER8agEy/b9XyJrbmYQQ3CzQQ8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=D4ujARgZOjHEqHThmbRUsO6rUOTSQF3YbpChvGMV9/wmerF/3q/add70qsJYwpeujogIvT0RL+Ekr2sijOnLPGUAvAdvQoLs9SRXt7F2/kGhQ2xk7sKKbiTdAS63J42dg1/lBYcLCyWOoZ97bGCFTVOHUCxMKALRSoOWBw4LgqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=PoLnJ/Tn; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="PoLnJ/Tn" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67QAVfIs3793926; Wed, 26 Aug 2026 11:07:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=SICwhh jGxNhXSsOq7GPFaV9hQygchFki3GkCkSPKHXU=; b=PoLnJ/TnBrkpFewceYCw7/ FVR5RzZtjgDsqjBjaDWRdPaAQl0UtEa7BlsYR/YBKnjE3VyyS/+/VhC9OZtsbu+P weccOkTetSpEkxPoTvcBP7uefJmUEpBkNhnB8ffMyMbzVr7HbXVqPfhADBXFJPqu PQtOd4H5jGAkqhfuCQFw+b4Qfoz2KvO/CNyLVNVz4xzktlsEGPcLUB/VpH6RaHo+ VNdO1KqHjsdG/9LGng1EvsFyA0xpULNEZrcvMIX1kzW9SOTdN/e3O/OmsaUvUH5b 0hlK2XVInreUKX2u1aZpJseMYfKLO0oZO6LyW2J9J92PsdEGZSn6egxiVTYDIzwQ == Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4g73dxdvvt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Aug 2026 11:07:26 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 67QAuGkJ018391; Wed, 26 Aug 2026 11:07:26 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4g7rsy9akf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Aug 2026 11:07:26 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 67QB7MGv36372952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Aug 2026 11:07:22 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5380520049; Wed, 26 Aug 2026 11:07:22 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EE7F2004D; Wed, 26 Aug 2026 11:07:18 +0000 (GMT) Received: from [9.61.245.81] (unknown [9.61.245.81]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 26 Aug 2026 11:07:18 +0000 (GMT) Message-ID: <6a37522d-ac3d-4992-a240-40fcd49557aa@linux.ibm.com> Date: Wed, 26 Aug 2026 16:37:16 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] powerpc/rtas_pci: No hotplug on permanently removed device on pSeries To: Harsh Prateek Bora , Shivaprasad G Bhat , maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org Cc: mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, linux-kernel@vger.kernel.org References: <177725851139.12391.5948009745181492600.stgit@linux.ibm.com> <80aded32-3975-49f4-a91a-b58b236c832a@linux.ibm.com> Content-Language: en-US From: tasmiya In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12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Mwwy4gfThw0az0/W0wmUOyeJ54EKhJbcZTa/7gYaO050i2YHq+ID5yJ 0U/h+btnK56SReklskg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-26_03,2026-08-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 clxscore=1015 adultscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608260092 Greetings, Latest Patch tested : https://lore.kernel.org/linuxppc-dev/178246517230.1267.12206176311111155505.stgit@linux.ibm.com/ I have tested latest patch in my environment. The patch fixes the issue reported. On 25/08/26 8:46 pm, Harsh Prateek Bora wrote: > Hi Tasmiya, > > There was a v2 posted here: > https://lore.kernel.org/linuxppc-dev/178246517230.1267.12206176311111155505.stgit@linux.ibm.com/ > > > Although a minor change in return value and re-ordering before > CONFIG_BLOCKED incorporated in v2, it's better to test v2 and provide > test feedback on the same. > > Thanks > Harsh > > On 25/08/26 3:52 pm, tasmiya wrote: >> Greetings, >> >> Tested-by: Tasmiya Nalatwad >> Reported-by: Tasmiya Nalatwad >> >> >> I have Tested the patch in my KVM guest environment with device >> passthrough via vfio, It works fine and fixes the issue. >> Triggered EEH freeze beyond eeh_max_freezes to permanently remove the >> device, then hotplugged a new PCI device. Without the patch, the >> rescan attempted to bring back the permanently removed device. With >> the patch applied, the removed device is correctly skipped during >> rescan and only newly hotplugged device is seen in the guest. >> >> >> Thank you, >> >> Tasmiya >> >> >> On 27/04/26 8:25 am, Shivaprasad G Bhat wrote: >>> The eeh_driver disables and offlines the PE permanently when it >>> exceeds the freeze count beyond eeh_max_freeze within the last hour. >>> The PE is only offline, so the device tree entries, eeh device >>> references are all intact till the real unplug of the device from >>> the guest/host takes place. >>> >>> On pSeries, with a new hotplug of any PCI device, the drmgr initiates >>> a system-wide PCI rescan, which finds devices offlined by the >>> eeh_driver >>> and there will be attempts to bring them online. This leads to >>> recurring EEHs either at the config read time itself or a bit >>> later depending on the type of the problem. >>> >>> For PowerNV, the commit d2b0f6f77ee5 ("powerpc/eeh: No hotplug on >>> permanently removed dev") introduced the EEH_DEV_REMOVED flag to >>> prevent such inadvertent rescans on hierarchical toplogies relavent in >>> Baremetal setups. For pSeries, such topologies don't really make sense >>> as the devices are either part of the same PE OR exposed as independent >>> devices on multiple virtual PHBs. However, the inadvertent rescans are >>> still a possibility with either hotplug of a new device or otherwise >>> with manual system-wide pci bus rescan attempts. >>> >>> So the patch checks for EEH_DEV_REMOVED before allowing config space >>> access just like PowerNV, making the PCI core omit the PE, and thus >>> preventing subsequent EEH recurances. The patch is tested on PowerVM >>> and KVM machines with single and multi-function devices, and on the >>> devices behind a switch. The unplug of the affected devices post EEH >>> removal is also working fine as expected. >>> >>> Signed-off-by: Shivaprasad G Bhat >>> References: d2b0f6f77ee5 ("powerpc/eeh: No hotplug on permanently >>> removed dev") >>> --- >>>   arch/powerpc/kernel/rtas_pci.c |    6 ++++++ >>>   1 file changed, 6 insertions(+) >>> >>> diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/ >>> rtas_pci.c >>> index fccf96e897f6..ce24b18712ca 100644 >>> --- a/arch/powerpc/kernel/rtas_pci.c >>> +++ b/arch/powerpc/kernel/rtas_pci.c >>> @@ -57,6 +57,9 @@ int rtas_pci_dn_read_config(struct pci_dn *pdn, >>> int where, int size, u32 *val) >>>       if (pdn->edev && pdn->edev->pe && >>>           (pdn->edev->pe->state & EEH_PE_CFG_BLOCKED)) >>>           return PCIBIOS_SET_FAILED; >>> + >>> +    if (pdn->edev && pdn->edev->mode & EEH_DEV_REMOVED) >>> +        return PCIBIOS_SET_FAILED; >>>   #endif >>>       addr = rtas_config_addr(pdn->busno, pdn->devfn, where); >>> @@ -108,6 +111,9 @@ int rtas_pci_dn_write_config(struct pci_dn *pdn, >>> int where, int size, u32 val) >>>       if (pdn->edev && pdn->edev->pe && >>>           (pdn->edev->pe->state & EEH_PE_CFG_BLOCKED)) >>>           return PCIBIOS_SET_FAILED; >>> + >>> +    if (pdn->edev && pdn->edev->mode & EEH_DEV_REMOVED) >>> +        return PCIBIOS_SET_FAILED; >>>   #endif >>>       addr = rtas_config_addr(pdn->busno, pdn->devfn, where); >>> >>> >> >