[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen/vtd: prevent from assign the device with shared rmrr
commit 6457dae9960bf6f31cef928a6997b6b5b6386a6d Author: Tiejun Chen <tiejun.chen@xxxxxxxxx> AuthorDate: Wed Jul 22 01:39:58 2015 +0000 Commit: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CommitDate: Thu Jul 23 13:45:26 2015 +0100 xen/vtd: prevent from assign the device with shared rmrr Currently we're intending to cover this kind of devices with shared RMRR simply since the case of shared RMRR is a rare case according to our previous experiences. But late we can group these devices which shared rmrr, and then allow all devices within a group to be assigned to same domain. CC: Yang Zhang <yang.z.zhang@xxxxxxxxx> CC: Kevin Tian <kevin.tian@xxxxxxxxx> Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx> Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/drivers/passthrough/vtd/iommu.c | 30 +++++++++++++++++++++++++++--- 1 files changed, 27 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 8a8d763..ce5c295 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2293,13 +2293,37 @@ static int intel_iommu_assign_device( if ( list_empty(&acpi_drhd_units) ) return -ENODEV; + seg = pdev->seg; + bus = pdev->bus; + /* + * In rare cases one given rmrr is shared by multiple devices but + * obviously this would put the security of a system at risk. So + * we should prevent from this sort of device assignment. + * + * TODO: in the future we can introduce group device assignment + * interface to make sure devices sharing RMRR are assigned to the + * same domain together. + */ + for_each_rmrr_device( rmrr, bdf, i ) + { + if ( rmrr->segment == seg && + PCI_BUS(bdf) == bus && + PCI_DEVFN2(bdf) == devfn && + rmrr->scope.devices_cnt > 1 ) + { + printk(XENLOG_G_ERR VTDPREFIX + " cannot assign %04x:%02x:%02x.%u" + " with shared RMRR at %"PRIx64" for Dom%d.\n", + seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), + rmrr->base_address, d->domain_id); + return -EPERM; + } + } + ret = reassign_device_ownership(hardware_domain, d, devfn, pdev); if ( ret ) return ret; - seg = pdev->seg; - bus = pdev->bus; - /* Setup rmrr identity mapping */ for_each_rmrr_device( rmrr, bdf, i ) { -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |