From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.38820.1671496008494754992 for ; Mon, 19 Dec 2022 16:26:48 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=njuSHu0Q; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: hao.a.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671496008; x=1703032008; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=vxbC9bnJsCZbB0ymaFEQt+iUVQ1NVfCJBLGJjLmJJnI=; b=njuSHu0QMTYF0wS0DZUK2DS9/cj5wfmkpY6tkZeneiSyfEwstLcEDeUC sopEr4CgzGlnASlHcjP+c3RjJ4kafDHaVRmFT6kt7PZdDzU/aVt1O5ywT 53L5C3r9fUw1syUzOxukYpHAiHsp9b23m4jl7/MlD/+jDwxvMZB2df4JZ KA8tYjNGA4l1/4TXEOYIsoRexHeChpJCUtHDUBKO5SjM4uZ+NUcmD57mg Lk8sUn6WOESGeOfq5PY8BbV2xQwxV/wkNdaiPxRE24YHDbvoH0GQYuBcO 44TeSrYvB9hZT4ZyZ9US1PILWKBpHyrQ0sWJpwGPTbOCh3PTnBm4KSR0F A==; X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="346588684" X-IronPort-AV: E=Sophos;i="5.96,257,1665471600"; d="scan'208";a="346588684" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 16:26:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="775091964" X-IronPort-AV: E=Sophos;i="5.96,258,1665471600"; d="scan'208";a="775091964" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga004.jf.intel.com with ESMTP; 19 Dec 2022 16:26:47 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 19 Dec 2022 16:26:47 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 19 Dec 2022 16:26:46 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 19 Dec 2022 16:26:46 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.47) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Mon, 19 Dec 2022 16:26:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0aQ0a/XAhRdW/Xo6TL46lw3da2jOFjS4ISDUqsQiy4zp0oPjMkjZNOz5WK92AcOF9TismKVoPEWuoMKF2gjbZ/yt6o97D0Ea+rpGFFxy/eF6O8zhcbq3mbKYPKH/4nKWl7Hgo3MTSHcXSiU8nIxHQ3c9XjRahifdkz+uJdDR3ETQUXLl/Dsa5Z+6ag9cWd6yndSJ7W8CFmE+1PTUeIRh5tVGdsm5NtBGGltJHpxQJE3V8C0oZDJQbstLgP4KP30M181NUlWloFGFOqh7c4kq9n2N7zvTGipWybO1ggUOcG9z7Hzlc/rP68EfZMhORRECz+by/Ul5O8GDzmu4vOt8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R5Loz2SoWmK7TONB6E5pzSCvzEPYJ+h3/EdHI0rrxYo=; b=MrOQSmkwu40lFSK0kyz6fBlE3ey+yk+6DX+Fc+UzJibun6f1loJfbJm5IVDoqBiIMoyHZiTwFafthGmGVT7Nla1TlocdlvwBaHQ3o2Vz7bA9Cpm/tqnE9wAgRfp7+xcrq/zc+JVmcps2saSttR8W8Rpr6wPBry0KDOmYIbI2aqvUXDUfjZB+iT6IFs96jN2JRezyXLtY2TZ4Q9CZBsznERbH3f/j2kDhDfO9dzgKSDl4e5l2QuCnjVtPBYFMRNxC+SyQ/uHPfIzAzExlBCdr4tzIpQhNzN8WN59TpnvS1Ps78jsHW66NqdPO9iIU9C0zJGofu2G3IeA6kzmfUk9b3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4025.namprd11.prod.outlook.com (2603:10b6:5:197::31) by SJ1PR11MB6276.namprd11.prod.outlook.com (2603:10b6:a03:455::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 00:26:44 +0000 Received: from DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::6129:7158:18dd:761c]) by DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::6129:7158:18dd:761c%3]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 00:26:44 +0000 From: "Wu, Hao A" To: "He, Jiangang" , "Chang, Abner" , "devel@edk2.groups.io" CC: "Lin, Kuei-Hung (Timothy)" , "Ni, Ray" , "Zeng, Star" , "Sun, Zhikai" , "Kirkendall, Garrett" Subject: Re: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Thread-Topic: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Thread-Index: AQHZEKUNAvIe4DttyUOOke5o6otGBK50xmkAgAERwoCAABm4cA== Date: Tue, 20 Dec 2022 00:26:43 +0000 Message-ID: References: <20221210151240.1548-1-abner.chang@amd.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=13d80729-4da6-44d7-bcc8-e332e37b7689; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-12-15T02:11:41Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR11MB4025:EE_|SJ1PR11MB6276:EE_ x-ms-office365-filtering-correlation-id: c702ac10-f671-44d1-956a-08dae220df4b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MhYngUdCJcFaFHHDyvcBwTFbLTImzOmqMs/ZpQltXNKbYzfX6XzhZeH8YmArLhvqjlrkHeKYEUvb7SYVTf4qxEdVJX0afXP2yZBAcLhwjkMY7qVLEsIIwgL87cwl+lDvxL5gcc2QXsD04CN8IbaECxXZyRoObZrVOr8Upp9VImfUyUI2YhbKRHqVzxB7+mj8J79PRE0dQMh/n5jGLCFF08J1nnj26N3oCQesPCNb/abnBCCdQzcViWnb1VXgizacZHFLG2AOoBIQfQQcCtz605jGSA/o4KfKRsz6+3jsq4lTDhdgrGAgbyGx9Zi9cNJOh031hx2IsB5FOftESQHlSzLfw+989I1sWdCLelg99oRO5blZFjputA008s36iaITTaOwy0r2h6D2Zpa387qG2aveW/wzS8QqQec72KuLU3tPPiCDUbQH6xtB/IjZRb7xZsdXjlTANVV5xmvruVR3wPVJ86C10HRsqsI3/S2EOtRDOLbo5nnT9c3uDai05bwaroA0CVTsKTagn1nBeXWFMsf00zRCIL9KLEcmdEDUXoXjZgxdh/1+wV+AHEbSYwR4Ihhk1zMkYT3P0qexcAlsrjkJqfjgpWxwHSt4lpSNv1x7QJNMrrdUl6ok6yTPgJtLTRvZZVsln6GhvcuIBfud+sXwSweexKseoXuR8F00T6ZVVH+ikwY8a89PN2Cf0sCO6KJckLDaUSM+05f6Lu8Sew== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4025.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(136003)(376002)(396003)(39860400002)(346002)(451199015)(966005)(55016003)(82960400001)(54906003)(38100700002)(45080400002)(122000001)(478600001)(110136005)(2906002)(52536014)(316002)(19627235002)(66556008)(8936002)(5660300002)(64756008)(66446008)(66946007)(86362001)(76116006)(66476007)(4326008)(8676002)(186003)(26005)(83380400001)(38070700005)(71200400001)(33656002)(41300700001)(9686003)(7696005)(6506007)(53546011);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tz6gS2QbOMgMoC8vEnxIEstkCTNEIapRXMVRHI4wHD8GFNq8F7WnRbm1pwga?= =?us-ascii?Q?h4RzcjDzGH2aRR/PwUA+kwN3KgW+XQU3sQU/NSdM2hFu/kBb/BaGq4GvHcFX?= =?us-ascii?Q?IuKiiGDVWyN4sP4EWoOBuJQmxyc2H1JHPF+Y0ftIsA3kFW5keo263/E1Jp4f?= =?us-ascii?Q?3JJPu1uwVw+csGZKh/9/Ks0a7tvVigiN4gaIN7I+GcNY963H7D+wG3MxftzF?= =?us-ascii?Q?JRVkiXzgW2r2hJ9BM/ToXXUKAcXqanaN+/CYEqFecLxQz+02v9Jhurt6iKFl?= =?us-ascii?Q?gdqafg69tdlVCFNnwpQfCmg6LOO3QhnR81xqLbV2Z7oM9+HKTMnhXGg+hyhl?= =?us-ascii?Q?SaMXm2q0ZZNy6zZsfjVWT0iYK+z+DPBjGGcR9ED7gUcUTiL0yOrBhBhJWK0H?= =?us-ascii?Q?z1Z3wV2ZJuuuM3Er75WbLfSjVio+g456kwW4kHVG0dxh0q6ZatKauCWYYKNy?= =?us-ascii?Q?Vf6wyuzkFFVSJ+g5EVCmf7iZniNo+/nzR1/SC+Umhk3mS2zPfjldMDjgwnpG?= =?us-ascii?Q?/TWGwAKdoKObE2SuCbwiLiYsOAKgjJfFor+f+T9BAg3TnhEJmy/+2JNz6jmW?= =?us-ascii?Q?3BX9hhEWlKCsVuyROZ/KGTojMatN8QlgtQzOEF7Q6gqv5epbUFq+X2sGEEwa?= =?us-ascii?Q?yVVXCCRjTqCLd18FmhgjicBiZFDdRHZaUpPyPxNLdV5NrTZlJGYe1u99nssB?= =?us-ascii?Q?3miC0dT+me5J5LPWZsmVNli/6z1+t6QnbCEzuUfGRr5o2Tiq1r0D8Z2AOgFl?= =?us-ascii?Q?rSgUmLuPkX9XVDDzKUhytcUzGRz52lXbcSpjcROAme3oM+mecBwMqWF6lSI+?= =?us-ascii?Q?F+DRccHHxjwLEYz5RsS+CMhQgHxKKmLotW9QkpAtquLK2mBU0P0rBnphj3m6?= =?us-ascii?Q?2xloa4idmfEVWzL90ytPwusc+MZOuL0q4HzzCr4rL4BCktnECx3gSv//QaKG?= =?us-ascii?Q?TeiBCOV2iS4WL5WUy48TWBbCcYlsJ11XTtYqS6eZkx0lOy2SD/q5G1Y6YE12?= =?us-ascii?Q?hPQXIgDb697ZbKS5sxLzm/24IUlKc7XyxMKdyqJV7O+iz3AXmqPNV5eN5glf?= =?us-ascii?Q?Zwf9qgRJ8BE5WkXVobEmSZsYkwN2w2bzXUOOd8hClnMUfXkZmLNNtL6R+0QV?= =?us-ascii?Q?sVUaH37lHv/KBpyec9STpoywf+T0zV0TqCQebGgKZBGTU4r6cC4Ica45y0el?= =?us-ascii?Q?DpdZHN9Wuww3ZJNZqkBSXCrNRA0StTYRZ7UdIZHn17TX2IHuFwgE1lmNC5Fl?= =?us-ascii?Q?umk1FJkc+ODmFlJ0UIqrbXakGelksdiG6k/oobAsm6sTk6Lw+BBARnugGr3w?= =?us-ascii?Q?j/wk8dxsVQNINp3gppO2ElKuHSUMuQPQrqT8lHuF81hyIaM1rNGylYQKeGvT?= =?us-ascii?Q?mmVT7QabiIwa2aCxCXeI/kLYgikxwYheG5/PDeHb/x6jsdSsHjft0zGVmtZ6?= =?us-ascii?Q?xQhwEeD1sosuOhYJWBruvhAvYvI7B45V3/pufuJNtwUmPUQy8JViKMobePRi?= =?us-ascii?Q?h3B1kpWhDu2sAZ+ohg8K7ayLQBLacumcBmp3Pc5Oho650tWyWEkgX4iO5m5N?= =?us-ascii?Q?4hkK4tH/3TxcSZmaCsA+CqREE2PFR82CUgLea+kG?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4025.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c702ac10-f671-44d1-956a-08dae220df4b X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2022 00:26:43.9293 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3Lpi8uHnheU9uDh7X1hfawFnJUUlAeNk7eXS1o4BjtAUi/YguIFrE4x6VltR8ScXg81BFKsj9z6jjyxzIbjiCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR11MB6276 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks. You are right. I agree with you that aligning with XhciDxe is a better reso= lution. Best Regards, Hao Wu > -----Original Message----- > From: He, Jiangang > Sent: Tuesday, December 20, 2022 6:54 AM > To: Wu, Hao A ; Chang, Abner > ; devel@edk2.groups.io > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > ; Zeng, Star ; Sun, Zhikai > ; Kirkendall, Garrett > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > block >=20 > [AMD Official Use Only - General] >=20 > UsbHcFreeMemBlock()->IoMmuFreeBuffer()->mIoMmu->FreeBuffer(), which > may end up calling PeiFreePages() depending on gEdkiiIoMmuPpiGuid > implementation. Surely both will work since UsbHcFreeMemPool() can't be > interrupted by any service call to use the memory just freed. Just for go= od > coding practice reason, I pick the one aligning with XhciDxe. >=20 > Thanks, > Jiangang > -----Original Message----- > From: Wu, Hao A > Sent: Monday, December 19, 2022 12:40 AM > To: He, Jiangang ; Chang, Abner > ; devel@edk2.groups.io > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > ; Zeng, Star ; Sun, Zhikai > ; Kirkendall, Garrett > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > block >=20 > [AMD Official Use Only - General] >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > Hello, >=20 > My take is that unlike in DXE, the UsbHcFreeMemBlock() implementation in > PEI phase does not perform freeing the memory. >=20 > So I think both the solution: > * Provided at > https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2 > .groups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=3D05%7C01%7 > CJiangang.He%40amd.com%7C528424aa303f4a2c9b1808dae18be036%7C3d > d8961fe4884e608e11a82d994e183d%7C0%7C0%7C638070288126779782%7C > Unknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBT > iI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3DuJMNyYXMU22 > UZNjrKtDetyD2BqrvkualuorPZHAV3wg%3D&reserved=3D0, which aligns with > EhciPei > * Mentioned at the end of your previous reply, which aligns with XhciDxe > should work fine. >=20 > I will leave it to you for the final decision. >=20 > Best Regards, > Hao Wu >=20 > > -----Original Message----- > > From: He, Jiangang > > Sent: Friday, December 16, 2022 12:48 AM > > To: Chang, Abner ; Wu, Hao A > > ; devel@edk2.groups.io > > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > > ; Zeng, Star ; Sun, Zhikai > > ; Kirkendall, Garrett > > > > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > > block > > > > [AMD Official Use Only - General] > > > > Yes, it is the same issue discussed in > > > https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2 > > .groups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=3D05%7C01 > %7CJiang > > > ang.He%40amd.com%7C528424aa303f4a2c9b1808dae18be036%7C3dd8961f > e4884e60 > > > 8e11a82d994e183d%7C0%7C0%7C638070288126936018%7CUnknown%7CT > WFpbGZsb3d8 > > > eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3 > D%7C3 > > > 000%7C%7C%7C&sdata=3D58j41QJxKbrQenhyZKYO4dxYj3Sat2kJejQGioZhtu4%3 > D&rese > > rved=3D0 > > > > MdeModulePkg\Bus\Pci\XhciPei\UsbHcMem.c > > > > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Hea= d->Next) { > > // UsbHcUnlinkMemBlock (Pool->Head, Block); > > UsbHcFreeMemBlock (Pool, Block); > > } > > Block =3D Pool->Head->Next never change without calling > > UsbHcUnlinkMemBlock (Pool->Head, Block), therefore dead loop. > > > > Our proposed fix came from dxe version of the equivalent file > > MdeModulePkg\Bus\Pci\XhciDxe\UsbHcMem.c but swapped two routine > call > > order (Now I think it is incorrect as clarified below). > > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Hea= d->Next) { > > UsbHcFreeMemBlock (Pool, Block); > > UsbHcUnlinkMemBlock (Pool->Head, Block); > > } > > > > > https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2 > .groups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=3D05%7C01%7 > CJiangang.He%40amd.com%7C528424aa303f4a2c9b1808dae18be036%7C3d > d8961fe4884e608e11a82d994e183d%7C0%7C0%7C638070288126936018%7C > Unknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBT > iI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3D58j41QJxKbrQen > hyZKYO4dxYj3Sat2kJejQGioZhtu4%3D&reserved=3D0 proposed fix: > > > > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Block ->N= ext) { > > // UsbHcUnlinkMemBlock (Pool->Head, Block); > > UsbHcFreeMemBlock (Pool, Block); > > } > > > > I think it again, both proposals have problem of reading memory > > content in the buffer that has just been freed. > > > > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Hea= d->Next) { > > UsbHcUnlinkMemBlock (Pool->Head, Block); > > UsbHcFreeMemBlock (Pool, Block); > > } > > is right solution and matches dxe version of UsbHcMem.c. > > > > Thanks, > > Jiangang > > > > -----Original Message----- > > From: Chang, Abner > > Sent: Wednesday, December 14, 2022 8:12 PM > > To: Wu, Hao A ; devel@edk2.groups.io > > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > > ; Zeng, Star ; Sun, Zhikai > > ; Kirkendall, Garrett > > ; He, Jiangang > > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > > block > > > > [AMD Official Use Only - General] > > > > Hi Jiangang, > > Could you please provide the context of this patch? > > > > Thanks > > Abner > > > > > -----Original Message----- > > > From: Wu, Hao A > > > Sent: Monday, December 12, 2022 11:27 AM > > > To: Chang, Abner ; devel@edk2.groups.io > > > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > > > ; Zeng, Star ; Sun, Zhikai > > > ; Kirkendall, Garrett > > > > > > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei > > > memory block > > > > > > Caution: This message originated from an External Source. Use proper > > > caution when opening attachments, clicking links, or responding. > > > > > > > > > Sorry for a question, may I know what issue was met that leads to > > > the proposed patch? > > > Could you help to check if it is related with the topic discussed in > > > > > > https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2 > > > .gr > > > > > oups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=3D05%7C0 > > 1%7 > > > > > > Cabner.chang%40amd.com%7Ccac49c2820e741b8c48a08dadbf0cc24%7C3d > > d8 > > > > > 961fe4884e608e11a82d994e183d%7C0%7C0%7C638064124512265992%7C > > Unk > > > > > > nown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6I > > k1h > > > > > > aWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3Dz1Q7NRxN4GMA > > %2 > > > FBxYd2D7Gnkc3aTD23mRnwNF3H5wE0k%3D&reserved=3D0? Thanks > in > > advance. > > > > > > Best Regards, > > > Hao Wu > > > > > > > -----Original Message----- > > > > From: abner.chang@amd.com > > > > Sent: Saturday, December 10, 2022 11:13 PM > > > > To: devel@edk2.groups.io > > > > Cc: Kuei-Hung.Lin@amd.com; Wu, Hao A ; Ni, > Ray > > > > ; Garrett Kirkendall > > > > ; Abner Chang > > > > Subject: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > > > > block > > > > > > > > From: Abner Chang > > > > > > > > In V2: Add AMD copyright. > > > > > > > > Unlink the XhciPei memory block when it has been freed. > > > > > > > > Signed-off-by: Kuei-Hung Lin > > > > Cc: Hao A Wu > > > > Cc: Ray Ni > > > > Cc: Garrett Kirkendall > > > > Cc: Abner Chang > > > > --- > > > > MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 29 > > > > ++++++++++++++++++++++++- > > > > 1 file changed, 28 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > > b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > > index c64b38fcfc8..39ba31b0913 100644 > > > > --- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > > +++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > > @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid > > based > > > > on gPeiUsbControllerPpiGuid which is used to enable recovery > > > > function from USB Drivers. > > > > > > > > Copyright (c) 2014 - 2016, Intel Corporation. All rights > > > > reserved.
> > > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights > > > > +reserved.
> > > > > > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > > > @@ -365,6 +366,32 @@ UsbHcInitMemPool ( > > > > return Pool; > > > > } > > > > > > > > +/** > > > > + Unlink the memory block from the pool's list. > > > > + > > > > + @param Head The block list head of the memory's pool. > > > > + @param BlockToUnlink The memory block to unlink. > > > > + > > > > +**/ > > > > +VOID > > > > +UsbHcUnlinkMemBlock ( > > > > + IN USBHC_MEM_BLOCK *Head, > > > > + IN USBHC_MEM_BLOCK *BlockToUnlink > > > > + ) > > > > +{ > > > > + USBHC_MEM_BLOCK *Block; > > > > + > > > > + ASSERT ((Head !=3D NULL) && (BlockToUnlink !=3D NULL)); > > > > + > > > > + for (Block =3D Head; Block !=3D NULL; Block =3D Block->Next) { > > > > + if (Block->Next =3D=3D BlockToUnlink) { > > > > + Block->Next =3D BlockToUnlink->Next; > > > > + BlockToUnlink->Next =3D NULL; > > > > + break; > > > > + } > > > > + } > > > > +} > > > > + > > > > /** > > > > Release the memory management pool. > > > > > > > > @@ -386,8 +413,8 @@ UsbHcFreeMemPool ( > > > > // first block. > > > > // > > > > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D > > > > Pool->Head->Next) { > > > > - // UsbHcUnlinkMemBlock (Pool->Head, Block); > > > > UsbHcFreeMemBlock (Pool, Block); > > > > + UsbHcUnlinkMemBlock (Pool->Head, Block); > > > > } > > > > > > > > UsbHcFreeMemBlock (Pool, Pool->Head); > > > > -- > > > > 2.37.1.windows.1