[Bug 271785] [PCI][HotPlug] No BAR mapping after attaching a virtual function to the VM.

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 02 Jun 2023 13:12:46 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271785

            Bug ID: 271785
           Summary: [PCI][HotPlug] No BAR mapping after attaching a
                    virtual function to the VM.
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: michalx.gulbicki@intel.com

During VF hotplug handling, the following routine is executed.

        pci_add_map() at pci_add_map+0x81/frame 0xfffffe00e50a6c70
        pci_add_resources() at pci_add_resources+0x31d/frame 0xfffffe00e50a6cf0
        pci_add_child() at pci_add_child+0x71/frame 0xfffffe00e50a6d40
        pci_rescan_method() at pci_rescan_method+0x454/frame 0xfffffe00e50a6dc0
        acpi_pci_device_notify_handler() at
acpi_pci_device_notify_handler+0x63/frame 0xfffffe00e50a6e00
        AcpiEvNotifyDispatch() at AcpiEvNotifyDispatch+0x40/frame
0xfffffe00e50a6e20

Function pci_add_map calls pci_read_bar to get base and mapsize. While
procedure 
(based on PCI Local Bus Specification Revision 3.0 - section 6.2.5.1. Address
Maps) of extracting map size gives the same results as during system boot, base
map is not set (during system both base and size are set correctly). lspci
shows incorrect bar mappings:

        Memory at <unassigned> (64-bit, non-prefetchable) [disabled]
        Memory at <unassigned> (64-bit, non-prefetchable) [disabled]
        Memory at <unassigned> (64-bit, non-prefetchable) [disabled]

Some experiments have shown that hardwiring from zeros to "1" and re-reading
BAR in case of empty base (in pci_read_bar) results in restoring the base to
the correct value, and hotplug succeeds. lspci shows correct bar mappings:

        Memory at fe600000 (64-bit, non-prefetchable)
        Memory at fe608000 (64-bit, non-prefetchable)
        Memory at fe610000 (64-bit, non-prefetchable)

-- 
You are receiving this mail because:
You are the assignee for the bug.