From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BEB93AC12F2 for ; Wed, 7 Feb 2024 20:51:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=yWpPxXbKEFI4Uca5RazMMXk5myFz07agwgaQqnrz4VE=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1707339070; v=1; b=aiQNimhyq/eDXgdJpQuVYqBgisUUC0qDl8TPKziFP4K+xslIoQ65GWo2sK8lJLW9dIJjraQU tk35aVCLVY7xQ0q0u5v00zm3cK3Eyaoyyo3DEmWehrhLIJ1T5gAvEMg8G5i+KO9qhqNSKZGga38 +eFWzy36UojNQMlMTIUUGLl8= X-Received: by 127.0.0.2 with SMTP id LuIhYY7687511xDrZ37XJTmY; Wed, 07 Feb 2024 12:51:10 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.1033.1707339069811485173 for ; Wed, 07 Feb 2024 12:51:09 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-477-t5_nyELJOuCcGpdTsjKQaw-1; Wed, 07 Feb 2024 15:51:05 -0500 X-MC-Unique: t5_nyELJOuCcGpdTsjKQaw-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id D18BA101FA0B; Wed, 7 Feb 2024 20:51:02 +0000 (UTC) X-Received: from [10.39.195.126] (unknown [10.39.195.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C713400D6D2; Wed, 7 Feb 2024 20:51:01 +0000 (UTC) Message-ID: <200b9430-0263-e76e-afca-d4ea14f23612@redhat.com> Date: Wed, 7 Feb 2024 21:51:00 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug functionality for USB4 bridge To: devel@edk2.groups.io, hong-chih.hsueh@amd.com Cc: feng1.ding@amd.com, jiangang.he@amd.com, abner.chang@amd.com, ray.ni@intel.com, gaoliming@byosoft.com.cn References: <76e2a0274cd2620ee43a5942c307d63c6c095d3b.1707258489.git.Hong-Chih.Hsueh@amd.com> From: "Laszlo Ersek" In-Reply-To: <76e2a0274cd2620ee43a5942c307d63c6c095d3b.1707258489.git.Hong-Chih.Hsueh@amd.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 1q77faceLrWs6MmtPI4Cxb0nx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=aiQNimhy; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2/6/24 23:34, Hsueh, Hong-Chih (Neo) via groups.io wrote: > A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The action= s require PciHotPlugRequestNotify to add a root bridge or remove a root bri= dge completely. > In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return wit= h no-action on second plug because bridge tree shows configured. > Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug ev= ent to fix this issue. >=20 > Cc: Feng Ding > Cc: Jiangang He > Signed-off-by: Neo Hsueh > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePk= g/Bus/Pci/PciBusDxe/PciEnumerator.c > index 3f8c6e6da7..2b7af60e0a 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c > @@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify ( > } > } > =20 > + DestroyPciDeviceTree (Bridge); > + > // > // End for > // I think the subject line is too specific. This patch appears to fix a gener= al resource leak in the PCI hot-unplug functionality. Writing up the USB4 a= ngle in the commit message is welcome in my opinion, but the subject should= state something like: MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug (And I think the bridge doesn't even have to be a *root* bridge for the lea= k to occur; is that right?) Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115252): https://edk2.groups.io/g/devel/message/115252 Mute This Topic: https://groups.io/mt/104208348/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-