• Edward Cree's avatar
    sfc: Cope with permissions enforcement added to firmware for SR-IOV · 267d9d73
    Edward Cree authored
    * Accept EPERM in some simple cases, the following cases are handled:
    1) efx_mcdi_read_assertion()
    Unprivileged PCI functions aren't allowed to GET_ASSERTS.
    We return success as it's up to the primary PF to deal with asserts.
    2) efx_mcdi_mon_probe() in efx_ef10_probe()
    Unprivileged PCI functions aren't allowed to read sensor info, and
    worrying about sensor data is the primary PF's job.
    3) phy_op->reconfigure() in efx_init_port() and efx_reset_up()
    Unprivileged functions aren't allowed to MC_CMD_SET_LINK, they just have
    to accept the settings (including flow-control, which is what
    efx_init_port() is worried about) they've been given.
    4) Fallback to GET_WORKAROUNDS in efx_ef10_probe()
    Unprivileged PCI functions aren't allowed to set workarounds. So if
    efx_mcdi_set_workaround() fails EPERM, use efx_mcdi_get_workarounds()
    to find out if workaround_35388 is enabled.
    5) If DRV_ATTACH gets EPERM, try without specifying fw-variant
    Unprivileged PCI functions have to use a FIRMWARE_ID of 0xffffffff
    (MC_CMD_FW_DONT_CARE).
    6) Don't try to exit_assertion unless one had fired
    Previously we called efx_mcdi_exit_assertion even if
    efx_mcdi_read_assertion had received MC_CMD_GET_ASSERTS_FLAGS_NO_FAILS.
    This is unnecessary, and the resulting MC_CMD_REBOOT, even if the
    AFTER_ASSERTION flag made it a no-op, would fail EPERM for unprivileged
    PCI functions.
    So make efx_mcdi_read_assertion return whether an assert happened, and only
    call efx_mcdi_exit_assertion if it has.
    Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    267d9d73
efx.c 86 KB