DomD: passthroughing an arbitrary device
Hi, all!
We have a use-case where we want to passthrough and arbitrary device to driver domain, e.g. GPIO controller or the like (doesn't do any DMA).
I know that for device to be pass throughed it must be tied to an IOMMU, but in my case the controller doesn’t have any. The problem is that it not only has MMIO range, but also has its own interrupt controller, so I have to passthrough IRQs as well. Here comes the limitation I face: as the controller doesn’t have any IOMMU I can’t passthrough its IRQ.
Possible solutions I see could be:
1. Make it possible that Xen allows passing through devices without IOMMU assigned:
the problem here is that one can hack Xen then by saying that her device is not MMU protected and writing/reading arbitrary memory then.
2. Make driver domain be marked somehow as a privileged one, so Xen can trust it and allow passing devices without IOMMU.
Q: What if we need to pass this device to DomU?
3. Workaround by introducing a dummy IOMMU for such devices, but it still doesn’t solve the problem with memory protection.
I'm hoping to hear any possible solutions/suggestions which will not break security and allow passing devices at the same time.
Thank you for your time,
Oleksandr
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 1 line · Oleksandr Andrushchenko
Hi, all!
Hello,
Quoted 2 lines
We have a use-case where we want to passthrough and arbitrary device to driver domain, e.g. GPIO controller or the like (doesn't do any DMA).
I will assume you are speaking about Xen Arm and not Xen x86. Please correct if my assumption is wrong.
Quoted 5 lines
I know that for device to be pass throughed it must be tied to an IOMMU, but in my case the controller doesn’t have any. The problem is that it not only has MMIO range, but also has its own interrupt controller, so I have to passthrough IRQs as well. Here comes the limitation I face: as the controller doesn’t have any IOMMU I can’t passthrough its IRQ.
I guess you are saying that when you use "dtdev" it will deny guest creation.
At the moment, the only purpose of "dtdev" is to setup the SMMU correctly. If your device is not protected by an SMMU, then it is not necessary. You only need to specific "irqs" and "mmios".
If you wonder why the documentation does not advertise it. It is because I consider that any device not protected by an SMMU should not be pass-through unless the user really knows what he is doing.
Quoted 11 lines
Possible solutions I see could be:
1. Make it possible that Xen allows passing through devices without IOMMU assigned:
the problem here is that one can hack Xen then by saying that her device is not MMU protected and writing/reading arbitrary memory then.2. Make driver domain be marked somehow as a privileged one, so Xen can trust it and allow passing devices without IOMMU.
Q: What if we need to pass this device to DomU?
Quoted 5 lines
3. Workaround by introducing a dummy IOMMU for such devices, but it still doesn’t solve the problem with memory protection.
I'm hoping to hear any possible solutions/suggestions which will not break security and allow passing devices at the same time.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 12 lines · Julien Grall
Quoted 1 line · Oleksandr Andrushchenko
Hi, all!
Hello,
Quoted 2 lines
We have a use-case where we want to passthrough and arbitrary device to driver domain, e.g. GPIO controller or the like (doesn't do any DMA).
I will assume you are speaking about Xen Arm and not Xen x86. Please correct if my assumption is wrong.
you are right, sorry for not being precise enough
Quoted 8 lines
Quoted 5 lines
I know that for device to be pass throughed it must be tied to an IOMMU, but in my case the controller doesn’t have any. The problem is that it not only has MMIO range, but also has its own interrupt controller, so I have to passthrough IRQs as well. Here comes the limitation I face: as the controller doesn’t have any IOMMU I can’t passthrough its IRQ.
I guess you are saying that when you use "dtdev" it will deny guest creation.
at least I used/experimented with dtdev as of now and didn't think it is possible not to fill in dtdev's, but still request IRQs
Quoted 2 lines
At the moment, the only purpose of "dtdev" is to setup the SMMU correctly. If your device is not protected by an SMMU, then it is not necessary. You only need to specific "irqs" and "mmios".
ah, good to know,
could you please confirm that my understanding is correct:
if I put "xen,passthrough" property in guest's device tree node which has IRQ(s) and/or MMIO range(s) it is enough to get that "passive" device passed through?
Quoted 2 lines
If you wonder why the documentation does not advertise it. It is because I consider that any device not protected by an SMMU should not be pass-through unless the user really knows what he is doing.
as they say "the best documentation is the source code itself", I should have looked more careful
Quoted 11 lines
Quoted 11 lines
Possible solutions I see could be:
1. Make it possible that Xen allows passing through devices without IOMMU assigned:
the problem here is that one can hack Xen then by saying that her device is not MMU protected and writing/reading arbitrary memory then.2. Make driver domain be marked somehow as a privileged one, so Xen can trust it and allow passing devices without IOMMU.
Q: What if we need to pass this device to DomU?
Quoted 8 lines
Quoted 5 lines
3. Workaround by introducing a dummy IOMMU for such devices, but it still doesn’t solve the problem with memory protection.
I'm hoping to hear any possible solutions/suggestions which will not break security and allow passing devices at the same time.
Cheers,
Thank you,
Oleksandr
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
sorry, pressed send too fast
Quoted 23 lines · Oleksandr Andrushchenko
Quoted 12 lines · Julien Grall
Quoted 1 line · Oleksandr Andrushchenko
Hi, all!
Hello,
Quoted 2 lines
We have a use-case where we want to passthrough and arbitrary device to driver domain, e.g. GPIO controller or the like (doesn't do any DMA).
I will assume you are speaking about Xen Arm and not Xen x86. Please correct if my assumption is wrong.
you are right, sorry for not being precise enough
Quoted 8 lines
Quoted 5 lines
I know that for device to be pass throughed it must be tied to an IOMMU, but in my case the controller doesn’t have any. The problem is that it not only has MMIO range, but also has its own interrupt controller, so I have to passthrough IRQs as well. Here comes the limitation I face: as the controller doesn’t have any IOMMU I can’t passthrough its IRQ.
I guess you are saying that when you use "dtdev" it will deny guest creation.
Quoted 9 lines
at least I used/experimented with dtdev as of now and didn't think it is possible not to fill in dtdev's, but still request IRQs
Quoted 2 lines
At the moment, the only purpose of "dtdev" is to setup the SMMU correctly. If your device is not protected by an SMMU, then it is not necessary. You only need to specific "irqs" and "mmios".
ah, good to know,
could you please confirm that my understanding is correct:
if I put "xen,passthrough" property in guest's device tree node which has IRQ(s) and/or MMIO range(s) it is enough to get that "passive" device passed through?
should be
If "xen,passthrough" property in a Dom0 device tree node *together* with IRQ(s) and MMIO range(s) in a *guest config* file is enough to get "passive" device passed through
Quoted 17 lines
Quoted 2 lines
If you wonder why the documentation does not advertise it. It is because I consider that any device not protected by an SMMU should not be pass-through unless the user really knows what he is doing.
as they say "the best documentation is the source code itself", I should have looked more careful
Quoted 14 lines
Quoted 14 lines
Possible solutions I see could be:
1. Make it possible that Xen allows passing through devices without IOMMU assigned:
the problem here is that one can hack Xen then by saying that her device is not MMU protected and writing/reading arbitrary memory then.2. Make driver domain be marked somehow as a privileged one, so Xen can trust it and allow passing devices without IOMMU.
Q: What if we need to pass this device to DomU?3. Workaround by introducing a dummy IOMMU for such devices, but it still doesn’t solve the problem with memory protection.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I'm hoping to hear any possible solutions/suggestions which will not break security and allow passing devices at the same time.
Cheers,
Thank you,
Oleksandr
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi,
Quoted 33 lines · Oleksandr Andrushchenko
sorry, pressed send too fast
Quoted 31 lines · Oleksandr Andrushchenko
Quoted 12 lines · Julien Grall
Quoted 1 line · Oleksandr Andrushchenko
Hi, all!
Hello,
Quoted 2 lines
We have a use-case where we want to passthrough and arbitrary device to driver domain, e.g. GPIO controller or the like (doesn't do any DMA).
I will assume you are speaking about Xen Arm and not Xen x86. Please correct if my assumption is wrong.
you are right, sorry for not being precise enough
Quoted 8 lines
Quoted 5 lines
I know that for device to be pass throughed it must be tied to an IOMMU, but in my case the controller doesn’t have any. The problem is that it not only has MMIO range, but also has its own interrupt controller, so I have to passthrough IRQs as well. Here comes the limitation I face: as the controller doesn’t have any IOMMU I can’t passthrough its IRQ.
I guess you are saying that when you use "dtdev" it will deny guest creation.
at least I used/experimented with dtdev as of now and didn't think it is possible not to fill in dtdev's, but still request IRQs
Quoted 2 lines
At the moment, the only purpose of "dtdev" is to setup the SMMU correctly. If your device is not protected by an SMMU, then it is not necessary. You only need to specific "irqs" and "mmios".
ah, good to know,
could you please confirm that my understanding is correct:
if I put "xen,passthrough" property in guest's device tree node which has IRQ(s) and/or MMIO range(s) it is enough to get that "passive" device passed through?
yes, device will not be hidden from Dom0 and free to be used by any other domains.
However, you have to ensure it will not be shared between multiple domains (this check was done by "dtdev" you don't use here).
Quoted 29 lines
Quoted 1 line
should be
If "xen,passthrough" property in a Dom0 device tree node *together* with IRQ(s) and MMIO range(s) in a *guest config* file is enough to get "passive" device passed throughQuoted 24 lines
Quoted 2 lines
If you wonder why the documentation does not advertise it. It is because I consider that any device not protected by an SMMU should not be pass-through unless the user really knows what he is doing.
as they say "the best documentation is the source code itself", I should have looked more careful
Quoted 11 lines
Quoted 11 lines
Possible solutions I see could be:
1. Make it possible that Xen allows passing through devices without IOMMU assigned:
the problem here is that one can hack Xen then by saying that her device is not MMU protected and writing/reading arbitrary memory then.2. Make driver domain be marked somehow as a privileged one, so Xen can trust it and allow passing devices without IOMMU.
Q: What if we need to pass this device to DomU?Quoted 8 lines
Quoted 5 lines
3. Workaround by introducing a dummy IOMMU for such devices, but it still doesn’t solve the problem with memory protection.
I'm hoping to hear any possible solutions/suggestions which will not break security and allow passing devices at the same time.
Cheers,
Thank you,
Oleksandr
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 30 lines · Julien Grall
Hi,
Quoted 27 lines · Oleksandr Andrushchenko
sorry, pressed send too fast
Quoted 25 lines · Oleksandr Andrushchenko
Quoted 12 lines · Julien Grall
Quoted 1 line · Oleksandr Andrushchenko
Hi, all!
Hello,
Quoted 2 lines
We have a use-case where we want to passthrough and arbitrary device to driver domain, e.g. GPIO controller or the like (doesn't do any DMA).
I will assume you are speaking about Xen Arm and not Xen x86. Please correct if my assumption is wrong.
you are right, sorry for not being precise enough
Quoted 8 lines
Quoted 5 lines
I know that for device to be pass throughed it must be tied to an IOMMU, but in my case the controller doesn’t have any. The problem is that it not only has MMIO range, but also has its own interrupt controller, so I have to passthrough IRQs as well. Here comes the limitation I face: as the controller doesn’t have any IOMMU I can’t passthrough its IRQ.
I guess you are saying that when you use "dtdev" it will deny guest creation.
at least I used/experimented with dtdev as of now and didn't think it is possible not to fill in dtdev's, but still request IRQs
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
At the moment, the only purpose of "dtdev" is to setup the SMMU correctly. If your device is not protected by an SMMU, then it is not necessary. You only need to specific "irqs" and "mmios".
ah, good to know,
could you please confirm that my understanding is correct:
if I put "xen,passthrough" property in guest's device tree node which has IRQ(s) and/or MMIO range(s) it is enough to get that "passive" device passed through?yes, device will not be hidden from Dom0 and free to be used by any other domains.
this does work, thank you
Quoted 3 lines
However, you have to ensure it will not be shared between multiple domains (this check was done by "dtdev" you don't use here).
yes, for embedded use-cases this shouldn't be a problem
Quoted 24 lines
Quoted 24 lines
Quoted 1 line
should be
If "xen,passthrough" property in a Dom0 device tree node *together* with IRQ(s) and MMIO range(s) in a *guest config* file is enough to get "passive" device passed throughQuoted 20 lines
Quoted 2 lines
If you wonder why the documentation does not advertise it. It is because I consider that any device not protected by an SMMU should not be pass-through unless the user really knows what he is doing.
as they say "the best documentation is the source code itself", I should have looked more careful
Quoted 17 lines
Quoted 16 lines
Possible solutions I see could be:
1. Make it possible that Xen allows passing through devices without IOMMU assigned:
the problem here is that one can hack Xen then by saying that her device is not MMU protected and writing/reading arbitrary memory then.2. Make driver domain be marked somehow as a privileged one, so Xen can trust it and allow passing devices without IOMMU.
Q: What if we need to pass this device to DomU?3. Workaround by introducing a dummy IOMMU for such devices, but it still doesn’t solve the problem with memory protection.
I'm hoping to hear any possible solutions/suggestions which will not break security and allow passing devices at the same time.
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Cheers,
Thank you,
OleksandrCheers,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel