• L
    Fix exit on 'pci_add' Monitor command · 0148fde5
    Luiz Capitulino 提交于
    If the user issues one of the following commands to the Monitor:
    
    pci_add pci_addr=auto nic model=None
    pci_add pci_addr=auto nic model=?
    
    QEMU will exit, because the function used to perform sanity
    checks (qemu_check_nic_model_list()) exits on error.
    
    This function is used by the startup code, where it makes
    sense to exit on error, but in the Monitor it doesn't.
    
    Changing qemu_check_nic_model_list() to not exit on error
    is not possible though, as it's used by the board init
    code (the PC one), where all board specific code must have
    void return.
    
    The way I've chosen to fix this was to introduce a new function
    called pci_nic_supported(), which checks if the NIC is supported
    and returns true or false accordingly.
    
    The new function is used only by the Monitor, it performs the
    necessary check and returns an error in case the NIC is not
    supported, thus qemu_check_nic_model_list()'s exit is never trigged.
    
    The following should be observed:
    
    1. Only the specified NIC is checked, the default one is assumed
    to be supported
    
    2. The NIC query command (model=?) won't work with pci_add, the
    right way to do this with the Monitor is to add a new command
    Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
    Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
    0148fde5
pci.c 30.5 KB