Mike, Do you think that maybe just raising to TPL_NOTIFY is enough for PCI BAR probing? Though the timer interrupt still triggers, all callbacks are suspended in TPL_NOTIFY.
Thanks, Ray > -----Original Message----- > From: edk2-devel [mailto:[email protected]] On Behalf Of Nikita > Leshenko > Sent: Friday, September 7, 2018 3:09 AM > To: [email protected] > Cc: Liran Alon <[email protected]> > Subject: [edk2] PciBusDxe: PCI-Express bug with dynamic > PcdPciExpressBaseAddress > > Hi, > > We ran into a bug in EDK2 relating to PCI-Express in PciBusDxe. Here's the > flow > of the bug: > > 1. PciBusDxe/PciEnumeratorSupport.c: Function BarExisted probes a BAR. It > raises > TPL to TPL_HIGH_LEVEL to avoid timer interrupts while probing the BAR and > calls PciIo->Pci.Write. > 2. BasePciExpressLib/PciExpressLib.c: The write reaches PciExpressWrite32, > which > calls GetPciExpressBaseAddress. > 3. GetPciExpressBaseAddress retrieves the address from > PcdPciExpressBaseAddress. > 4. Reading the PCD calls DxePcdGet64 -> GetWorker -> > EfiAcquireLock(&mPcdDatabaseLock), which is at TPL_NOTIFY level. This > crashes > the firmware because step 1 raised the TPL to TPL_HIGH_LEVEL. > > This doesn't happen when PcdPciExpressBaseAddress is fixed at build (because > then the read is optimized to a static global variable), but when the PCD is > dynamic PCI-Express is broken. > > Does anybody have a suggestion for fixing it? > > Options we thought about: > - Change mPcdDatabaseLock.Tpl to TPL_HIGH_LEVEL > - Don't use a PCD for the base address, put it in a static global variable and > create functions to set and retrieve it. > > Thanks, > Nikita > _______________________________________________ > edk2-devel mailing list > [email protected] > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

