xen/vtd/iommu: permit group devices to passthrough in relaxed mode
PATCH 1/1 xen/vtd/iommu: permit group devices to passthrough in relaxed mode
Currently we don't allow passing through any group devices which are sharing same RMRR entry since it would break security among VMs. And indeed, we expect we can figure out a better way to handle this kind of case completely.
But before the group assignment gets implemented, we might make this permission dependent on our RMRR policy. So, now it would be allowed in the relaxed mode.
--- xen/drivers/passthrough/vtd/iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
xen/drivers/passthrough/vtd/iommu.c +6 -2
@@ -2310,12 +2310,16 @@ static int intel_iommu_assign_device( PCI_DEVFN2(bdf) == devfn && rmrr->scope.devices_cnt > 1 ) { +u32 relaxed = flag &XEN_DOMCTL_DEV_RDM_RELAXED ; + printk(XENLOG_G_ERR VTDPREFIX -" cannot assign %04x:%02x:%02x.%u" +" Currently its %s to assign %04x:%02x:%02x.%u" " with shared RMRR at %" PRIx64" for Dom%d.\n" , + relaxed ?"risky" :"disallowed" , seg, bus,PCI_SLOT (devfn),PCI_FUNC (devfn), rmrr->base_address, d->domain_id); -return -EPERM ; +if ( !relaxed ) +return -EPERM ; } }
Signature · 1 line
1.9.1
Quoted 9 lines · Tiejun Chen
Currently we don't allow passing through any group devices which are sharing same RMRR entry since it would break security among VMs. And indeed, we expect we can figure out a better way to handle this kind of case completely.
But before the group assignment gets implemented, we might make this permission dependent on our RMRR policy. So, now it would be allowed in the relaxed mode.
Is this targeting 4.6? I think so.
xen/drivers/passthrough/vtd/iommu.c static int intel_iommu_assign_device(
Quoted 13 lines
CC Yang Zhang <[email protected]>CC Kevin Tian <[email protected]>CC Jan Beulich <[email protected]>Signed-off-by Tiejun Chen <[email protected]>--- xen/drivers/passthrough/vtd/iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)xen/drivers/passthrough/vtd/iommu.c +0
-0@@ -2310,12 +2310,16 @@ static int intel_iommu_assign_device(
FWIW the comment before this hunk also needs to be updated.
xen/drivers/passthrough/vtd/iommu.c static int intel_iommu_assign_device( · line 2316
Quoted 8 lines
xen/drivers/passthrough/vtd/iommu.c +3
-1PCI_DEVFN2(bdf) == devfn && rmrr->scope.devices_cnt > 1 ) { +u32 relaxed = flag &XEN_DOMCTL_DEV_RDM_RELAXED ; + printk(XENLOG_G_ERR VTDPREFIX -" cannot assign %04x:%02x:%02x.%u" +" Currently its %s to assign %04x:%02x:%02x.%u"
"it's" or "it is"
Quoted 18 lines
xen/drivers/passthrough/vtd/iommu.c +3
-1" with shared RMRR at %" PRIx64" for Dom%d.\n" , + relaxed ?"risky" :"disallowed" , seg, bus,PCI_SLOT (devfn),PCI_FUNC (devfn), rmrr->base_address, d->domain_id); -return -EPERM ; +if ( !relaxed ) +return -EPERM ; } }Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 08.09.15 at 02:57, <[email protected]> wrote:
Currently we don't allow passing through any group devices which are sharing same RMRR entry since it would break security among VMs. And indeed, we expect we can figure out a better way to handle this kind of case completely.
But before the group assignment gets implemented, we might make this permission dependent on our RMRR policy. So, now it would be allowed in the relaxed mode.
CC Yang Zhang <[email protected]>CC Kevin Tian <[email protected]>CC Jan Beulich <[email protected]>Signed-off-by Tiejun Chen <[email protected]>--- xen/drivers/passthrough/vtd/iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)xen/drivers/passthrough/vtd/iommu.c +0
-0
xen/drivers/passthrough/vtd/iommu.c static int intel_iommu_assign_device( · line 2313
Quoted 4 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -2310,12 +2310,16 @@ static int intel_iommu_assign_device( PCI_DEVFN2(bdf) == devfn && rmrr->scope.devices_cnt > 1 ) { +u32 relaxed = flag &XEN_DOMCTL_DEV_RDM_RELAXED ;
Conventionally this ought to be a bool_t.
xen/drivers/passthrough/vtd/iommu.c static int intel_iommu_assign_device( · line 2316
Quoted 3 lines
xen/drivers/passthrough/vtd/iommu.c +1
-1printk(XENLOG_G_ERR VTDPREFIX -" cannot assign %04x:%02x:%02x.%u" +" Currently its %s to assign %04x:%02x:%02x.%u"
In addition to what Wei said - what meaning is "currently" supposed to have here? To a reader of the resulting log it might look as if (s)he'd need to reconfigure the hypervisor (via some command line option perhaps), while acceptance / refusal solely depends on the arguments the caller provides.
Apart from that in the relaxed case the message level should be XENLOG_G_WARNING, not XENLOG_G_ERR.
Jan