[edk2] Question about hotplugging NIC devices to an empty pci-bridge

Yao, Jiewen jiewen.yao at intel.com
Thu Dec 20 21:27:50 PST 2018


You need have a PciHotPlug driver to produce the EFI_PCI_HOT_PLUG_INIT_PROTOCOL

One example:
https://github.com/tianocore/edk2/tree/master/OvmfPkg/PciHotPlugInitDxe
Laszlo added it. He may provide comment on how to use it.

Another example:
https://github.com/tianocore/edk2-platforms/tree/devel-MinPlatform/Platform/Intel/KabylakeOpenBoardPkg/Features/PciHotPlug
This is to add Thunderbolt support in Kabylake platform.

Thank you
Yao Jiewen


> -----Original Message-----
> From: Zhoujian (jay) [mailto:jianjay.zhou at huawei.com]
> Sent: Friday, December 21, 2018 11:04 AM
> To: Yao, Jiewen <jiewen.yao at intel.com>; edk2-devel at lists.01.org;
> lersek at redhat.com
> Cc: Huangweidong (C) <weidong.huang at huawei.com>; liujunjie (A)
> <liujunjie23 at huawei.com>; wangxin (U) <wangxinxin.wang at huawei.com>;
> wujing (O) <wujing42 at huawei.com>; dengkai (A) <dengkai1 at huawei.com>
> Subject: RE: Question about hotplugging NIC devices to an empty pci-bridge
> 
> I've tried to set PcdPciBusHotplugDeviceSupport to be true in
> MdeModulePkg.dec like below:
> gEfiMdeModulePkgTokenSpaceGuid.PcdPciBusHotplugDeviceSupport|TRUE
> |BOOLEAN|0x0001003d
> But the problem still exists. Is there any steps I missed? Or some infos need
> to populate to OVMF by Qemu?
> 
> Could you give me more infos?
> 
> Thanks,
> Jay Zhou
> 
> > -----Original Message-----
> > From: Yao, Jiewen [mailto:jiewen.yao at intel.com]
> > Sent: Thursday, December 20, 2018 8:09 PM
> > To: Zhoujian (jay) <jianjay.zhou at huawei.com>; edk2-devel at lists.01.org
> > Cc: Huangweidong (C) <weidong.huang at huawei.com>; liujunjie (A)
> > <liujunjie23 at huawei.com>; wangxin (U)
> <wangxinxin.wang at huawei.com>; wujing (O)
> > <wujing42 at huawei.com>; dengkai (A) <dengkai1 at huawei.com>
> > Subject: RE: Question about hotplugging NIC devices to an empty
> pci-bridge
> >
> > Maybe you can use EFI_PCI_HOT_PLUG_INIT_PROTOCOL to reserve some
> resource.
> >
> > See MdePkg\Include\Protocol\PciHotPlugInit.h
> >
> > Thank you
> > Yao Jiewen
> >
> > > -----Original Message-----
> > > From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org] On Behalf
> Of
> > > Zhoujian (jay)
> > > Sent: Thursday, December 20, 2018 7:34 PM
> > > To: edk2-devel at lists.01.org
> > > Cc: Huangweidong (C) <weidong.huang at huawei.com>; liujunjie (A)
> > > <liujunjie23 at huawei.com>; wangxin (U)
> <wangxinxin.wang at huawei.com>;
> > > wujing (O) <wujing42 at huawei.com>; dengkai (A)
> <dengkai1 at huawei.com>
> > > Subject: [edk2] Question about hotplugging NIC devices to an empty
> > > pci-bridge
> > >
> > > Hi all,
> > >
> > > The issue occurs when I started a virtual machine in UEFI way by
> > > libvirt on qemu-kvm platform, the vm is configured with 8 pci-bridges
> > > on root bus0. I hotplug a device like virtual nic to an empty
> > > pci-bridge which has no device connected. Login the vm, I can see the
> > > device by "lspci"", but it didn't show by "ifconfig -a". Dmesg shows like
> > below:
> > > pci 0000:04:01.0: BAR 0: no space for [mem size 0x00010000 64bit pref]
> > > pci
> > > 0000:04:01.0: BAR 0: failed to assign [mem size 0x00010000 64bit pref]
> > > pci
> > > 0000:04:01.0: BAR 3: no space for [mem size 0x00004000 64bit pref] pci
> > > 0000:04:01.0: BAR 3: failed to assign [mem size 0x00004000 64bit pref]
> > >
> > > Reboot the vm, everything turns back to normal and I can see the new
> > > hotplugged nic by "ifconfig -a".
> > >
> > > Use the OVMF compiling from latest edk2 source code, the same
> problem
> > > arises.
> > >
> > > So, my questions are:
> > > 1) the generic PCI bus driver in edk2 does not allocate IO and/or MMIO
> > > for a bridge if there is no device behind the bridge that consume that
> > > kind of resource?
> > > 2) What's the purpose of this strategy?
> > > 3) Why don't allocate resource to all bridges like seabios?
> > > 4) Is there any switch for me to turn off this constraint so that
> > > every pci-bridge including empty ones can be assigned IO and memory
> window?
> > > Otherwise, each time I hotplug a device to empty pci-bridge, a reboot
> > > operation should be implemented to use the device?
> > >
> > > Any help will be appreciated, Thanks!
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel at lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel


More information about the edk2-devel mailing list