[Bug 222996] FreeBSD 11.1-12 on Hyper-V with PCI Express Pass Through

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Jan 14 09:40:06 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222996

--- Comment #16 from Wei Hu <weh at microsoft.com> ---
There are two issues. 

1. For FreeBSD R12 and current head branch, the passthrough support on Hyper-V
Gen VM was broken by commit r330113. No devices work on these releases. I have
informed Andrew at freebsd.org to take a look of this problem.

2. On 11.2 and earlier releases, passthrough generally works on Gen 2 FreeBSD
VMs. I have checked one Intel NIC with using ig driver which works fine.
However, Dmitry reported it doesn't work with Intel 82583v NIC, which uses em
driver on FreeBSD. I don't have such NIC so I am using a VM that that Dmitry
provided to debug this issue. Looks it fails in the routine reading NIC's MDI
control register:

/**
 *  e1000_read_phy_reg_mdic - Read MDI control register
 *  @hw: pointer to the HW structure
 *  @offset: register offset to be read
 *  @data: pointer to the read data
 *
 *  Reads the MDI control register in the PHY at offset and stores the
 *  information read to data.
 **/
s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
{
        struct e1000_phy_info *phy = &hw->phy;
        u32 i, mdic = 0;

        ...
        /* Poll the ready bit to see if the MDI read completed
         * Increasing the time out as testing showed failures with
         * the lower time out
         */
        for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 10); i++) {
                usec_delay_irq(50);
                mdic = E1000_READ_REG(hw, E1000_MDIC);
                if (mdic & E1000_MDIC_READY)
                        break;
        }
        if (!(mdic & E1000_MDIC_READY)) {
                DEBUGOUT("MDI Read did not complete\n");        <--- saw this
message when driver's debug flag is on.
                return -E1000_ERR_PHY;
        }
        ...
}

Looks the register status never turned ready. Here is some dmesg output when
the debug flag is on:

em0: Lazy allocation of 0x20000 bytes rid 0x10 type 3 at 0xf8000000
em0: in em_allocate_pci_resource, bus tag is 0x1, handle is 0xfffff800f8000000
e1000_set_mac_type
e1000_init_mac_ops_generic
e1000_init_phy_ops_generic
e1000_init_nvm_ops_generic
e1000_init_function_pointers_82571
e1000_init_mac_params_82571
e1000_init_nvm_params_82571
e1000_init_phy_params_82571
e1000_get_phy_id_82571
e1000_read_phy_reg_bm2
e1000_get_hw_semaphore_82574
e1000_get_hw_semaphore_82573
e1000_read_phy_reg_mdic
MDI Read did not complete             <-- 
e1000_put_hw_semaphore_82574
e1000_put_hw_semaphore_82573
Error getting PHY ID

Will update more.

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


More information about the freebsd-virtualization mailing list