The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: tasmiya <tasmiya@linux.ibm.com>,
	Shivaprasad G Bhat <sbhat@linux.ibm.com>,
	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
Subject: Re: [PATCH] powerpc/rtas_pci: No hotplug on permanently removed device on pSeries
Date: Tue, 25 Aug 2026 20:46:15 +0530	[thread overview]
Message-ID: <c6117753-10a7-4e10-bd8f-526a5dd8a300@linux.ibm.com> (raw)
In-Reply-To: <80aded32-3975-49f4-a91a-b58b236c832a@linux.ibm.com>

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 <tasmiya@linux.ibm.com>
> Reported-by: Tasmiya Nalatwad <tasmiya@linux.ibm.com>
> 
> 
> 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 <sbhat@linux.ibm.com>
>> 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);
>>
>>
> 


  reply	other threads:[~2026-08-25 15:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  2:55 [PATCH] powerpc/rtas_pci: No hotplug on permanently removed device on pSeries Shivaprasad G Bhat
2026-05-12 17:17 ` Harsh Prateek Bora
2026-05-12 17:44   ` Harsh Prateek Bora
2026-06-26  9:14     ` Shivaprasad G Bhat
2026-08-25 10:22 ` tasmiya
2026-08-25 15:16   ` Harsh Prateek Bora [this message]
2026-08-26 11:07     ` tasmiya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6117753-10a7-4e10-bd8f-526a5dd8a300@linux.ibm.com \
    --to=harshpb@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=sbhat@linux.ibm.com \
    --cc=tasmiya@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox