virtio: fix overwritten driver flags
authorJianfeng Tan <jianfeng.tan@intel.com>
Mon, 9 May 2016 16:35:57 +0000 (09:35 -0700)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Tue, 10 May 2016 17:57:10 +0000 (10:57 -0700)
commit62a785a68ebf710eba22b70b46a970a4e4e1cec7
tree839e4f6bf37e049d1ff6dde57177c1d8727a317a
parente928fd0bb0118387f04811970b11504b199b5ed1
virtio: fix overwritten driver flags

The "drv_flags" is set with device as the input, which means different
device (say, modern vs legacy) could end up with a different value. And
the fact that "drv_flags" is shared by all devices means that every time
we add a new device, it simply overwrites the value configured from the
last device.

Therefore, when two virtio devices have different flags, it may lead to
wrong result, such as virtio would set irq config when it's not supported.

Making the flag per device (using "dev->data->dev_flags") could let us
have different value for each device, which would avoid the above issue.

Fixes: da978dfdc43 ("virtio: use port IO to get PCI resource")

Reported-by: David Marchand <david.marchand@6wind.com>
Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_pci.c
drivers/net/virtio/virtio_pci.h