On Mon, Sep 12, 2016 at 01:08:05PM +0300, David Kiarie wrote:
[...]
> @@ -2252,14 +2250,17 @@ static MemTxResult vtd_mem_ir_write(void *opaque,
> hwaddr addr,
> {
> int ret = 0;
> MSIMessage from = {}, to = {};
> - uint16_t sid = X86_IOMMU_SID_INVALID;
> + VTDAddressSpace *as = opaque;
> + uint16_t sid = PCI_BUILD_BDF(pci_bus_num(as->bus), as->devfn);
I remembered to have commented on this... PCI_BUILD_BDF() should be
problematic. SID may not be built that way when with PCI bridges (or
say, I think current code won't work with PCI bridges). Please see
commit:
commit 4a94b3aa6d97dfa67a20c7a0315c9773352f0e8e
Author: Peter Xu <[email protected]>
Date: Tue May 17 19:26:10 2016 +0800
pci: fix pci_requester_id()
That's why we explicitly differenciate BDF and SID.
I would suggest to make it simpler: we just do not do this extra
check, and pass attrs.requester_id to vtd_interrupt_remap_msi()
directly.
Thanks,
-- peterx