From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADDE2606A322 for ; Thu, 3 Dec 2026 05:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=J43iRL/p Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYywC-0003ng-PJ; Thu, 03 Dec 2026 00:00:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYyw5-0003n8-2g; Thu, 03 Dec 2026 00:00:49 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYyvz-0006ff-Uy; Thu, 03 Dec 2026 00:00:47 -0500 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B335LEs2231426; Thu, 3 Dec 2026 05:00:41 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=FuZ9Cd MjG8eBTOsU0hafJzt9aDDJqPyi7hM7b/GV7VQ=; b=J43iRL/p0olj2GQujlCoB7 dOpJobyg21LyxaZGAkDLfEBxCydyndRtYl5HXE2yZLbkAEuI+LS+aiwGSCwD67qW 4dZ25jP2ngopKGhzxRpA3iUfBwnEc4husUjiWRt0Z8iI/GEUdE9kACHcauAg2NWD 1AFnW3eRndG6vIP5FQIJ4xzoZSsK39LvjA8s2Py8MIni8O3cjIfLuSWb/Qg2k8vC 0ivBn2mBvK8TwIhtYg+RJuA2v6H27FTCsBTnoQvlz7v6zBJda5yJ8J0R+nS96wQZ 9pP2eLzS/eHQ750U/hJasG52N3QMlbSOinkawwEbA1A/X4LuNFoTIqNtQFSiR9fA == Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4jan7uua33-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 03 Dec 2026 05:00:41 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B334YMm1313252; Thu, 3 Dec 2026 05:00:40 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4j9u5g069s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Dec 2026 05:00:40 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B350d9T45351418 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Dec 2026 05:00:39 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 89BC55806A; Thu, 3 Dec 2026 05:00:39 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15C8758064; Thu, 3 Dec 2026 05:00:35 +0000 (GMT) Received: from [9.123.4.64] (unknown [9.123.4.64]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 3 Dec 2026 05:00:34 +0000 (GMT) Message-ID: Date: Thu, 3 Dec 2026 10:30:33 +0530 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 0/2] ppc/spapr: Fix MSI-X shadow and BAR mmap handling during EEH PE reset To: =?UTF-8?Q?C=C3=A9dric_Le_Goater?= , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, sbhat@linux.ibm.com, mahesh@linux.ibm.com, sourabhjain@linux.ibm.com, adityag@linux.ibm.com, npiggin@gmail.com, harshpb@linux.ibm.com, alex@shazbot.org Cc: amachhiw@linux.ibm.com, hbathini@linux.ibm.com, shivangu@linux.ibm.com, anushree.mathur@linux.ibm.com References: <20261123081546.49210-4-nnmlinux@linux.ibm.com> Content-Language: en-US From: Narayana Murty N 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 X-Authority-Analysis: v=2.4 cv=Vvy2kO2n c=1 sm=1 tr=0 ts=6b10f779 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=Ikd4Dj_1AAAA:8 a=0Id1f6NKdgRx0E04VKwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: aEO5yoyDKA_NN_O7FLMMXiyrCLrypd2c X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDAxOCBTYWx0ZWRfX9tzUZVjKm108 dqM1izDWFd21TPAGtXUekbq2fWuZArRy9hQUTVkKpLNNkQhomW2nwoIywD8ASZe3LGyVu0zVGLO AXf7p9a+7X2IJ1MXgL68QeBzuhsur3U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDAxOCBTYWx0ZWRfX/Kd3nQp/T3Qj E6He1JvpoHzL1ajhYLr4OGACF6E46Qr8c1wYU5tAz1IjyojFKw+bMEORFukJ8fYSBGiVYmtfQ+Z LsZ0gnHZ6E/Qn46rSOQww4KbKHlEHZk2MmB7wPtHMiC51oiDEislPvnsJ5LcKHdCGBoPh9YkXxO 3XM0keDvyGuneVmCmdq4z+EIvRJtKLthmgHnpQniwZrLHoMnqLbNUuFZklDNqyzIpAZIsWaG3Ro dfqVmJ6KoK09S+PLxwqX30qHMffViSKGam36ZDmEcnFnRjw3n2mD0uTLgVvOSfPF/K5eJtNn9N9 kYlr0N3gzpNq76gN4sIbRJDgU6x5k6OeNQWXEO8zZN3JKBQ/izAtuMIg0Ri9n9Yh3BceKb5IxLq FFBnJYhgXIAQ1+FERYlWvkUpZWZicH4qTnVJKoHdjpPlxYEtIc9zRXTo48arnABCQ7ZC3GxiIXT 8qXbrjlGOsodn2WRHUQ== X-Proofpoint-ORIG-GUID: N3b0g324ffGT9ldnlAVSTe6bZzcGy4zF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_01,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 priorityscore=1501 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030018 Received-SPF: pass client-ip=148.163.158.5; envelope-from=nnmlinux@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi Cédric, On 01/12/26 11:27 PM, Cédric Le Goater wrote: > Hello Narayana, > > On 11/23/26 09:15, Narayana Murty N wrote: >> This series fixes two independent but related problems in the sPAPR EEH >> PE reset path for VFIO pass-through devices. >> >> Patch 1 fixes MSI-X interrupt delivery after EEH recovery.  The existing >> pre-reset path calls msix_reset(), which clears QEMU's MSI-X table >> shadow. >> On pSeries, this shadow is populated through: >> >>      ibm,change-msi >>          -> spapr_msi_setmsg() >>          -> msix_set_message() >> >> and is not necessarily rebuilt before the guest restores MSI-X after an >> EEH reset. >> >> Instead of resetting the MSI-X state, disable MSI-X by clearing only the >> Enable bit using QEMU's cached PCI configuration value and dispatch the >> write through pci_host_config_write_common().  This lets VFIO tear down >> the active vectors and KVM irqfd routes through vfio_msix_disable() while >> preserving the MSI-X shadow needed when the guest later re-enables MSI-X. >> >> Patch 2 handles BAR mmap access while the PE is undergoing an EEH reset. >> BAR mmap access is disabled before issuing the hot or fundamental PE >> reset and restored only after VFIO_EEH_PE_CONFIGURE completes >> successfully.  During this interval BAR accesses fall back to the VFIO >> region read/write path. >> >> Following review feedback, the BAR mmap and INTx mmap timer handling are >> now encapsulated in VFIO PCI helpers instead of accessing >> VFIOPCIDevice internals directly from the pSeries code.  The pre-reset >> helper cancels a pending INTx mmap re-enable timer and disables the BAR >> mmap path after interrupt teardown.  The post-configure helper restores >> the normal mmap/INTx timer policy after successful PE configuration. >> >> Without the fixes, EEH recovery itself reports success for the >> passed-through BCM5719/tg3 device, but the interface does not recover its >> link: >> >>      EEH: Beginning: 'resume' >>      PCI 0001:00:01.0#0001: EEH: Invoking tg3->resume() >>      PCI 0001:00:01.0#0001: EEH: tg3 driver reports: 'none' >>      EEH: Finished:'resume' >>      EEH: Recovery successful. >> >> >>      # ethtool enP1p0s1 | grep Link >>              Link detected: no >> >> >> With the series applied, EEH recovery completes and the link subsequently >> comes back: >> >> >>      EEH: Beginning: 'resume' >>      PCI 0001:00:01.0#0001: EEH: Invoking tg3->resume() >>      PCI 0001:00:01.0#0001: EEH: tg3 driver reports: 'none' >>      EEH: Finished:'resume' >>      EEH: Recovery successful. >>      tg3 0001:00:01.0 enP1p0s1: Link is up at 1000 Mbps, full duplex >>      tg3 0001:00:01.0 enP1p0s1: Flow control is on for TX and on for RX >> >> >>      # ethtool enP1p0s1 | grep Link >>              Link detected: yes >> >> >> Signed-off-by: Narayana Murty N >> --- >> Change log: >> v2: >> - Reworked the BAR mmap handling based on review feedback so that generic >>    VFIO provides only the mmap mechanism and the pSeries code retains the >>    EEH policy. >> - Replaced the EEH-specific generic VFIO helpers >>    `vfio_pci_eeh_pre_reset()` and `vfio_pci_eeh_post_configure()` with a >>    neutral `vfio_pci_mmap_block()` helper. >> - Added per-device `mmap_blocked` state in vfio-pci.  Once BAR mmap is >>    blocked, later attempts to re-enable the mmap subregions, including >>    those from INTx timer or interrupt-mode transitions, are ignored. >> - Changed the BAR mmap handling from temporary disable/restore to a >>    persistent block after an EEH PE reset.  In particular, BAR mmap is no >>    longer restored after `VFIO_EEH_PE_CONFIGURE`. >> - Removed the pSeries post-configure device/bus walkers that were added >>    in v2 solely to restore BAR mmap. >> - Moved the generic mmap-block implementation into patch 1/2 and kept >>    the pSeries EEH use of that mechanism in patch 2/2. >> - Block BAR mmap before changing MSI-X state during EEH reset >>    preparation, so subsequent VFIO interrupt-mode activity cannot restore >>    the direct mmap path. >> - Retained the v2 MSI-X shadow preservation behavior: clear only >>    `PCI_MSIX_FLAGS_ENABLE` through the normal PCI config-write path and >>    do not call `msix_reset()`. >> - Updated the BAR mmap recovery policy based on BCM5719 passthrough >>    testing: restoring direct BAR mmap after PE configure could result in >>    the device becoming inaccessible again during guest resume, while >>    keeping BAR accesses on the VFIO region read/write path allowed the >>    Guest-2 EEH recovery to complete and the device to remain functional. >> >> v1: >> - Move BAR mmap and INTx mmap timer handling into VFIO PCI helpers, >>    as suggested by Mahesh. >> - Avoid direct access to VFIOPCIDevice BAR and INTx internals from >>    spapr_pci_vfio.c. >> - Restore normal INTx mmap handling after successful PE configuration. >> - Keep BAR mmap disabled when VFIO_EEH_PE_CONFIGURE fails. >> - Keep the MSI-X shadow preservation behavior from patch 1 unchanged. >>    v1: https://lore.kernel.org/qemu-devel/20260902114758.85160-1- >> nnmlinux@linux.ibm.com >> >> Narayana Murty N (2): >>    vfio/pci: Add persistent BAR mmap blocking helper >>    ppc/spapr: Preserve VFIO MSI-X shadow and block BAR mmap on EEH reset >> >>   hw/ppc/spapr_pci_vfio.c | 75 ++++++++++++++++++++++++++++------------- >>   hw/vfio/pci.c           | 59 ++++++++++++++++++++++++++++++++ >>   hw/vfio/pci.h           |  7 ++++ >>   3 files changed, 117 insertions(+), 24 deletions(-) > > > > This series needs a background section. As posted, the cover letter > assumes the reader already knows EEH, PEs and the pSeries VFIO > error-recovery path, and the majority of qemu-devel does not. Please > rewrite it to start with a problem background that answers: > > - What is EEH ? > - How does it differ from PCIe AER ? be explicit about the differences. > - How does this relate to the ongoing proposals to report PCIe errors >   to userspace and drive recovery from it [1] ? > - Which platform, which processors ? PowerNV bare metal ? pSeries >   guests under PowerVM/KVM ? > - What is a PE ? > - How does recovery work on the host? > - How does it reach the guest ? > - What is RTAS ? > > And then state the problems, not just the symptoms. > > Please also fix the cover letter. It seems to still describe the v1 > disable/restore design, and has no v3. changelog section is confusing. > Sure, will address these review comments in V4. Thanks, Narayana. > Thanks, > > C. > > > [1] [RFC PATCH v2 00/16] vfio/pci: Handle PCI error recovery and report > state to userspace >     https://lore.kernel.org/all/20260929173305.204856-1- > skolothumtho@nvidia.com/ >