scf: SCF device tree and configuration documentation
RFC 1/1 scf: SCF device tree and configuration documentation
From: Andrii Anisov <[email protected]>
Description of SCF specific device tree properties and SCF configuration using device tree.
---
Dear All,
I would like to present a concept of SCF [1] configuration using device tree. The idea is that the framework configuration is too complex to get it passed using xen command line (for Dom0) or configuration file (for DomU). So the configuration will be done using device tree with special properties which will mark a device to be shared by the framework, or a node to describe a virtual coprocessor.
Please notice that the partial device tree which is used for DomU configuration is passed to the hypervisor as a binary blob in order to be processed by SCF.
[1] - Shared coprocessor framework https://lists.xenproject.org/archives/html/xen-devel/2016-10/msg01966.html
--- docs/misc/arm/device-tree/scf.txt | 16 +++ docs/misc/arm/scf.txt | 250 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 266 insertions(+) create mode 100644 docs/misc/arm/device-tree/scf.txt create mode 100644 docs/misc/arm/scf.txt
docs/misc/arm/device-tree/scf.txt new file +16 -0
@@ -0,0 +1,16 @@ +Shared coprocessor framework configuration +========================================== + +Any device with the property "xen,coproc" set will be owned by SCF and will not +be directly exposed to Dom0. "xen,coproc" property is only meaningful for a +system device tree which is passed to XEN. + +Any device with the property "xen,vcoproc" will be processed by SCF to create +a virtual coprocessor. If succeed, the device will be injected in the domain's +device tree with that property wiped. The property value is a stringified path +or an alias (from a system device tree) of a physical coproc device the virtual +coprocessor will run on. That physical coprocessor device node has to be marked +with "xen,coproc" property. +"xen,vcoproc" property is meaningful both for a system device tree and a partial +device tree for DomU. +
docs/misc/arm/scf.txt new file +250 -0
250 lines not on this page · raw message
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Dear All,
During the topic implementation I faced a nasty issue with a DomU vgic configuration. Originally I planned that the partial device tree for DomU is being passed to the hypervisor from libxl__arch_domain_create, but it is too late to set vgic configuration at this time. The DomU’s vgic is configured from libxl_arch_domain_prepare_config, and now it seems it is a proper place to send device_tree to a hypervisor as a part of configuration. Provided that I need the device tree blob even later, during device tree creation for domU (in libxl_prepare_dtb) I would like to have it read from a file once and keep it during guest domain creation process.
My problem is that domain creation functions stack mainly operates with auto generated structures. For my current understanding it means that I have to introduce another libxl type (f.e. File) which will read device tree file and operate with a binary blob.
Understanding the complexity of such a change I would like to hear comments about the SCF configuration concept and feasibility of passing device tree blob from toolstack to hypervisor as a part of domain configuration.
*Andrii Anisov*
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 1 line · Andrii Anisov
Dear All,
Hi Andrii,
Quoted 11 lines
During the topic implementation I faced a nasty issue with a DomU vgic configuration.
Originally I planned that the partial device tree for DomU is being passed to the
hypervisor fromlibxl__arch_domain_create, but it is too late to set vgic configuration
at this time. The DomU’s vgic is configured fromlibxl_arch_domain_prepare_config, and
now it seems it is a proper place to senddevice_treeto a hypervisor as a part of
configuration.
I am not going to comment on the binding itself, but the idea of sending a device_tree to the hypervisor as part of configuration.
As you may have seen in the description of the option "device_tree", it is complex to verify the partial device tree because of the libfdt design. So without fully auditing libfdt and fixing the holes, this suggestion would be a vector attack to the hypervisor.
Whilst I do agree that this could be an interface between the user and the toolstack, we shall look into introducing a series of DOMCTL for the toolstack <-> hypervisor. What would be the issue to do that?
Cheers,
Quoted 22 lines
Provided that I need the device tree blob even later, during device
tree creation for domU (inlibxl_prepare_dtb) I would like to have it read from a file
once and keep it during guest domain creation process.My problem is that domain creation functions stack mainly operates with auto generated
structures. For my current understanding it means that I have to introduce another
libxl type (f.e. File) which will read device tree file and operate with a binary blob.Understanding the complexity of such a change I would like to hear comments about the
SCF configuration concept and feasibility of passing device tree blob from toolstack
to hypervisor as a part of domain configuration.*Andrii Anisov*
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hello Julien,
Thank you for your comments.
Quoted 1 line
As you may have seen in the description of the option "
device_tree", it is complex to verify the partial device tree because of the libfdt design. So without fully auditing libfdt and fixing the holes, this suggestion would be a vector attack to the hypervisor.
I understand these concerns, but not sure should we be scared of attack from a domain privileged enough to run domains?
It seems to me that system hypervisor attack through libfdt is the less valuable benefit from compromised dom0.
About a system stability issues due to libfdt holes I've just got a crazy idea: let us put a fdt unflatenning code into a generic EL0 application :)
Quoted 1 line
Whilst I do agree that this could be an interface between the user and the toolstack, we shall look into introducing a series of DOMCTL for the toolstack <-> hypervisor. What would be the issue to do that?
There were two reasons turned me to using device tree as a configuration:
- I did not come up with a clear and flexible enough format to describe a SCF configuration. Any format which would allow us describe a complex virtual coprocessor with several mmios and irqs, and would allow describe breeding for a domain several virtual coprocessors running on one physical coprocessor will turn to a device tree node or something similar. This could fit somehow the DomU configuration file, but not XEN command line.
- The idea to reuse the same SCF configuration code both for Dom0 and DomU got me.
All said above is pretty true for me, but recently I have concerned that once we would like to spread SCF to x86 or systems configured through ACPI we will have to reconsider SCF configuration again.
Signature · 7 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 1 line · Andrii Anisov
Hello Julien,
Hi Andrii,
Quoted 8 lines
Thank you for your comments.
Quoted 4 lines
As you may have seen in the description of the option "
device_tree", it is complex to verify the partial device tree because of the libfdt design. So without fully auditing libfdt and fixing the holes, this suggestion would be a vector attack to the hypervisor.I understand these concerns, but not sure should we be scared of attack from a domain privileged enough to run domains?
Whilst the domain is privileged enough to run domains, the configuration can be provided by a user (for instance in cloud environment). So you cannot trust what the user provided and any missing invalidation would lead to a security issue (see XSA-95 [1] for instance).
That's why we specifically said only trusted device tree should be used with the option "device_tree".
Quoted 2 lines
It seems to me that system hypervisor attack through libfdt is the less valuable benefit from compromised dom0.
It is much more valuable, DOM0 may still have limited access to functionally whilst the hypervisor has access to everything.
Quoted 18 lines
About a system stability issues due to libfdt holes I've just got a crazy idea: let us put a fdt unflatenning code into a generic EL0 application :)
Quoted 3 lines
Whilst I do agree that this could be an interface between the user and the toolstack, we shall look into introducing a series of DOMCTL for the toolstack <-> hypervisor. What would be the issue to do that?
There were two reasons turned me to using device tree as a configuration:
- I did not come up with a clear and flexible enough format to describe a SCF configuration. Any format which would allow us describe a complex virtual coprocessor with several mmios and irqs, and would allow describe breeding for a domain several virtual coprocessors running on one physical coprocessor will turn to a device tree node or something similar. This could fit somehow the DomU configuration file, but not XEN command line.
- The idea to reuse the same SCF configuration code both for Dom0 and DomU got me.
Quoted 3 lines
All said above is pretty true for me, but recently I have concerned that once we would like to spread SCF to x86 or systems configured through ACPI we will have to reconsider SCF configuration again.
This is another point of the problem. Also, I do believe that the domain creation should be limited to create the domain and not configuring the devices other than the strict necessary. For anything else (UART, co-processor), this should be done later on.
What I would like to understand is what are the information that the hypervisors as to know for sharing co-processor? So far I have:
- MMIOs
- Interrupts
Anything else?
Cheers,
[1] https://xenbits.xen.org/xsa/advisory-95.html
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Julien,
Quoted 6 lines
What I would like to understand is what are the information that the hypervisors as to know for sharing co-processor? So far I have:
- MMIOs
- InterruptsAnything else?
IOMMU bindings.
This knowledge enough to get the physical coprocessor shared.
In order to spawn a virtual coprocessor (vcoproc) for some domain you have to provide additional configuration information:
- Which physical coprocessor this vcoproc should represent to a
domain ( a SoC could have several physical coprocs shared through the framework)
- IRQ(s) (provided that no IRQ remapping is implemented in XEN)
could be omitted (or used for verification only)
- IOMEM ranges correspondence between this vcoproc instance and a
physical coprocessor.
The latest point in the configuration is the most complex.
Let me explain a use case we faced now:
- a GPU has two different firmwares implementing OpenGL and OpenCL
- we need both GL and CL in the same domain working simultaneously
(actually concurrently, but the concurrency should be transparent for domain, GPU drivers and firmwares)
In current case we are lucky, the GPU has a single mmio range.
We can implement such system using SCF: spawn two vcoprocs for a domain. Those vcoprocs will have own mmio range within the domain. In a hypervisor those mmio ranges would be served by the same handler, but must be associated with the own vcoproc context.
In case a coprocessor has several mmio ranges things are getting worse.
In a device tree configuration concept I explicitly link vcoproc to pcoproc and keep mmio ranges correspondency with names. I'm not sure how to keep this coincidence in a simple way.
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 1 line · Andrii Anisov
Julien,
Hi Andrii,
Quoted 20 lines
Quoted 7 lines
What I would like to understand is what are the information that the hypervisors as to know for sharing co-processor? So far I have:
- MMIOs
- InterruptsAnything else?
IOMMU bindings.
This knowledge enough to get the physical coprocessor shared.In order to spawn a virtual coprocessor (vcoproc) for some domain you have to provide additional configuration information:
- Which physical coprocessor this vcoproc should represent to a
domain ( a SoC could have several physical coprocs shared through the framework)
- IRQ(s) (provided that no IRQ remapping is implemented in XEN)
could be omitted (or used for verification only)
- IOMEM ranges correspondence between this vcoproc instance and a
physical coprocessor.
Quoted 11 lines
The latest point in the configuration is the most complex. Let me explain a use case we faced now:
- a GPU has two different firmwares implementing OpenGL and OpenCL
- we need both GL and CL in the same domain working simultaneously
(actually concurrently, but the concurrency should be transparent for domain, GPU drivers and firmwares)
In current case we are lucky, the GPU has a single mmio range. We can implement such system using SCF: spawn two vcoprocs for a domain. Those vcoprocs will have own mmio range within the domain. In a hypervisor those mmio ranges would be served by the same handler, but must be associated with the own vcoproc context.
I have CCed Ian and Wei to comment on the difficult to describe a such interface in libxl. They may have insights how to do this properly.
@Ian @Wei: Andrii is suggesting to use Device-Tree for describing virtual co-processor as it seems it would be very difficult to do the same with the configuration file. See the suggested binding in [1].
Quoted 7 lines
In case a coprocessor has several mmio ranges things are getting worse.
In a device tree configuration concept I explicitly link vcoproc to pcoproc and keep mmio ranges correspondency with names. I'm not sure how to keep this coincidence in a simple way.
Cheers,
[1] https://www.mail-archive.com/[email protected]/msg106924.html
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Julien Grall writes ("Re: [RFC] scf: SCF device tree and configuration documentation"):
Quoted 2 lines
I have CCed Ian and Wei to comment on the difficult to describe a such interface in libxl. They may have insights how to do this properly.
Hi.
Quoted 3 lines
@Ian @Wei: Andrii is suggesting to use Device-Tree for describing virtual co-processor as it seems it would be very difficult to do the same with the configuration file. See the suggested binding in [1].
Firstly, I should say that I'm starting fresh on this ARM coprocessor topic. So forgive me if I make any obvious mistakes.
Quoted 1 line
[1] https://www.mail-archive.com/[email protected]/msg106924.html
I read this proposal.
I agree that putting all the details (interrupts, mmio, etc.) in the libxl config file is probably undesirable.
AFAICT, there, a particularly coprocessor can be identified as a portion of the host's DT. Is that right ? The plan seems to be to take one such thing (or perhaps, several) and pass it through to "the guest".
If these regions of the DT can be marked by this "xen,coproc" property, can't we instead identify them (eg in the libxl domain configuration) by their DT path ? So then you could say "please pass through coprocessor /aliases/soc/coproc0" or something.
Also, the proposal there does not seem to provide any way to say which guest should get any particular coprocessor. It talks about "the domain" (implicitly, "the" guest) - as if there could only be one. Surely this is wrong ?
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hello Ian,
Quoted 10 lines · Ian Jackson
I read this proposal.
I agree that putting all the details (interrupts, mmio, etc.) in the libxl config file is probably undesirable.
AFAICT, there, a particularly coprocessor can be identified as a portion of the host's DT. Is that right ? The plan seems to be to take one such thing (or perhaps, several) and pass it through to "the guest".
Quoted 4 lines
If these regions of the DT can be marked by this "xen,coproc" property, can't we instead identify them (eg in the libxl domain configuration) by their DT path ? So then you could say "please pass through coprocessor /aliases/soc/coproc0" or something.
Yep, exactly this approach worked for us when there were no requirement to spawn for one guest domain several vcoprocs from one physical coprocessor.
That requirement leads to a need of mapping "second" vcoproc mmio ranges to different addresses and potentially using another IRQ, in order to let a domain treat those devices separately.
Quoted 2 lines
Also, the proposal there does not seem to provide any way to say which guest should get any particular coprocessor.
No, its not about getting (owning) a coprocessor for some domain, but get a virtual coprocessor (vcoproc). Actually a vcoproc abstraction is inspired by vcpu abstraction, maybe such view would help to get an idea. Please also refer [1] to get the high level overview of the topic.
Quoted 3 lines
It talks about "the
domain" (implicitly, "the" guest) - as if there could only be one. Surely this is wrong ?
Yep, several domains (domU) could be created using the same partial device tree describing a configuration of virtual coprocessors.
[1] https://lists.xenproject.org/archives/html/xen-devel/2016-10/msg01966.html
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Andrii Anisov writes ("Re: [RFC] scf: SCF device tree and configuration documentation"):
Quoted 6 lines · Ian Jackson
Quoted 4 lines
If these regions of the DT can be marked by this "xen,coproc" property, can't we instead identify them (eg in the libxl domain configuration) by their DT path ? So then you could say "please pass through coprocessor /aliases/soc/coproc0" or something.
Quoted 6 lines
Yep, exactly this approach worked for us when there were no requirement to spawn for one guest domain several vcoprocs from one physical coprocessor.
That requirement leads to a need of mapping "second" vcoproc mmio ranges to different addresses and potentially using another IRQ, in order to let a domain treat those devices separately.
Why wouldn't the toolstack simply choose appropriate irqs/mmio ranges ? I would expect the virtual irqs/mmio ranges to not necessarily match the physical ones anyway. Is choosing these ranges complicated ?
Quoted 7 lines
Quoted 2 lines
Also, the proposal there does not seem to provide any way to say which guest should get any particular coprocessor.
No, its not about getting (owning) a coprocessor for some domain, but get a virtual coprocessor (vcoproc).
Actually a vcoproc abstraction is inspired by vcpu abstraction, maybe such view would help to get an idea.
Please also refer [1] to get the high level overview of the topic.
Thanks. I still feel like I am labouring under some misapprehensions. I hope you'll clear them up as they become evident...
What I mean is that your previous proposal doesn't provide any way to say which guest(s) should get instances of this virtual coprocessor. Some guests should get none; some one; etc.
Also, I am perplexed by your suggestion that a single physical coproc might be presented to a guest as two vcoprocs. If your sharing strategy is context-switching, is this not going to result in a lot of context-switching, whenever the guest (which thinks it has two coprocs) touches one and then the other ?
Obviously there are many things I still don't understand here.
Regards,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hello Ian,
Quoted 4 lines · Ian Jackson
Why wouldn't the toolstack simply choose appropriate irqs/mmio ranges ? I would expect the virtual irqs/mmio ranges to not necessarily match the physical ones anyway. Is choosing these ranges complicated ?
This could make sense. Choosing ranges should not be really complicated. The point here is that we need these ranges both for hypervisor and domU device tree generation, and we should keep the accordance. Moreover, we need a coprocessor device tree node for domU. Because it could describe some specifics beyond an iomem/irq presentation of the coprocessor.
Quoted 3 lines
What I mean is that your previous proposal doesn't provide any way to say which guest(s) should get instances of this virtual coprocessor. Some guests should get none; some one; etc.
I think those guests which are configured to have a virtual coprocessor(s) will have some. Those which are not configured to have - will not.
I would not set any specific limitations here. Shall I?
Quoted 5 lines
Also, I am perplexed by your suggestion that a single physical coproc might be presented to a guest as two vcoprocs. If your sharing strategy is context-switching, is this not going to result in a lot of context-switching, whenever the guest (which thinks it has two coprocs) touches one and then the other ?
I would not treat this case too specific. Any touches of the scheduled out virtual coprocessor would be handled by IO access emulation mechanism, and it is not necessary to evoke the context switch at the moment. So the number of context switches is rather matter of the scheduling algorithm I guess.
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Andrii Anisov writes ("Re: [RFC] scf: SCF device tree and configuration documentation"):
Quoted 9 lines · Ian Jackson
Quoted 4 lines
Why wouldn't the toolstack simply choose appropriate irqs/mmio ranges ? I would expect the virtual irqs/mmio ranges to not necessarily match the physical ones anyway. Is choosing these ranges complicated ?
This could make sense. Choosing ranges should not be really complicated. The point here is that we need these ranges both for hypervisor and domU device tree generation, and we should keep the accordance.
Obviously I am still confused, because this doesn't seem to make sense to me. I was imagining the toolstack generating virtual irqs/mmio ranges which the guest would see. It would then arrange for Xen to program the hardware appropriately, to direct those ranges to the physical hardware (when the coproc is exposed to the guest).
And I don't see why the physical address ranges used by Xen to manipulate the coproc would have to be the same as the guest pseudophysical addresses used by the guest.
As for device tree generation, any kind of passthrough of a DT device is going to involve filtering/processing/amending the DT information for the device: something is going to have to take the information from the physical DT (as provided to Xen), find the relevant parts (the parts which relate to the particular device), and substitute addresses etc., and insert the result into the guest DT.
Quoted 6 lines
Quoted 3 lines
What I mean is that your previous proposal doesn't provide any way to say which guest(s) should get instances of this virtual coprocessor. Some guests should get none; some one; etc.
I think those guests which are configured to have a virtual coprocessor(s) will have some.
So this will be done by something in the domain configuration ?
Quoted 2 lines
Those which are not configured to have - will not. I would not set any specific limitations here. Shall I?
Err, no. At least, I don't think so. That's not what I was asking for.
Quoted 10 lines
Quoted 5 lines
Also, I am perplexed by your suggestion that a single physical coproc might be presented to a guest as two vcoprocs. If your sharing strategy is context-switching, is this not going to result in a lot of context-switching, whenever the guest (which thinks it has two coprocs) touches one and then the other ?
I would not treat this case too specific. Any touches of the scheduled out virtual coprocessor would be handled by IO access emulation mechanism, and it is not necessary to evoke the context switch at the moment.
The IO access emulation just directs the access to somewhere where it can be emulated. Does that mean you intend for there to be a software emulation of the vcoproc, as well as hardware passthrough (with context switching) ?
Ian.
(still rather baffled, I'm afraid)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 4 lines · Ian Jackson
The IO access emulation just directs the access to somewhere where it can be emulated. Does that mean you intend for there to be a software emulation of the vcoproc, as well as hardware passthrough (with context switching) ?
The concept of an "access emulation" is not about emulating a coproc functionality, its only about reacting on mmio accesses appropriately from the user (domain) point of view. Basically on a register read - return shadowed value; on writes - stack them, to replay them to the HW once this vcoproc context is scheduled in.
I do realize that this part could be the most complex part of some specific coprocessor SCF support code.
Quoted 6 lines
Obviously I am still confused, because this doesn't seem to make sense to me. I was imagining the toolstack generating virtual irqs/mmio ranges which the guest would see. It would then arrange for Xen to program the hardware appropriately, to direct those ranges to the physical hardware (when the coproc is exposed to the guest).
While you are virtualizing a coprocessor, you can not map those address ranges for the domain permanently. At least during the period a vcoproc is scheduled out, ranges should be unmapped and accesses should be handled by access emulation mmio handlers.
Quoted 3 lines
And I don't see why the physical address ranges used by Xen to manipulate the coproc would have to be the same as the guest pseudophysical addresses used by the guest.
No need to keep ranges the same. But for proper access emulation functionality you have to identify specific address ranges in order to assign appropriate mmio handlers.
Quoted 6 lines
As for device tree generation, any kind of passthrough of a DT device is going to involve filtering/processing/amending the DT information for the device: something is going to have to take the information from the physical DT (as provided to Xen), find the relevant parts (the parts which relate to the particular device), and substitute addresses etc., and insert the result into the guest DT.
Something like this is done now, except taking the info from the physical DT. Now it is assumed that the pfdt OK, if the SCF is able to be configured with this pfdt. Not brilliant, but works for me this far.
Quoted 1 line
So this will be done by something in the domain configuration ?
Yes, sure. I think the domain configuration file should have the needed config options.
But so far I did not realize the appropriate config format, so I keep the configuration in a device tree both for Dom0 and DomU. For DomU the partial device tree option only is used so far. Toolstack does parse the pfdt, in case nodes with "xen,vcoproc" are found, actions to configure SCF are taken.
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Julien,
Quoted 7 lines · Julien Grall
Quoted 3 lines
I understand these concerns, but not sure should we be scared of attack from a domain privileged enough to run domains?
Whilst the domain is privileged enough to run domains, the configuration can be provided by a user (for instance in cloud environment). So you cannot trust what the user provided and any missing invalidation would lead to a security issue (see XSA-95 [1] for instance).
That's why we specifically said only trusted device tree should be used with the option "
device_tree".
I see. But I also could state the same.
Quoted 4 lines
Quoted 2 lines
It seems to me that system hypervisor attack through libfdt is the less valuable benefit from compromised dom0.
It is much more valuable, DOM0 may still have limited access to functionally whilst the hypervisor has access to everything.
Well, from dom0 you could start/stop any domain you want, grant access to any hardware, but only from hypervisor you could map another domain memory to access some runtime data. Is my understanding correct?
Quoted 1 line
Also, I do believe that the domain creation should be limited to create the domain and not configuring the devices other than the strict necessary. For anything else (UART, co-processor),
But vgic is configured at the earliest stages of the domain creation. So we have to know at the moment which IRQs would be injected into the domain. And that is my current problem.
Quoted 1 line
this should be done later on.
What is the proper moment to spawn virtual coprocessors for guest domains from your point of view?
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
(CC tools maintainers)
Quoted 1 line · Andrii Anisov
Julien,
Hi Andrii,
Quoted 12 lines · Julien Grall
Quoted 10 lines
Quoted 3 lines
I understand these concerns, but not sure should we be scared of attack from a domain privileged enough to run domains?
Whilst the domain is privileged enough to run domains, the configuration can be provided by a user (for instance in cloud environment). So you cannot trust what the user provided and any missing invalidation would lead to a security issue (see XSA-95 [1] for instance).
Quoted 3 lines
Quoted 2 lines
That's why we specifically said only trusted device tree should be used with the option "
device_tree".I see. But I also could state the same.
I would rather avoid to take this approach until we explored all the possibility.
We took this approach for platform device passthrough because we considered it would only be used for embedded platform where everything will be under control.
In the case of virtual co-processor, I can see a usage beyond embedded so we would need to deal with non-trusted input.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
It seems to me that system hypervisor attack through libfdt is the less valuable benefit from compromised dom0.
It is much more valuable, DOM0 may still have limited access to functionally whilst the hypervisor has access to everything.
Well, from dom0 you could start/stop any domain you want, grant access to any hardware, but only from hypervisor you could map another domain memory to access some runtime data. Is my understanding correct?
The tools are here to provide a nice and comprehensible interface between Xen and the user. At the end the hypervisor is in charge of creating a domain, handling the memory...
Dom0 may have restrict access to the guest, but the hypervisor does not have such restriction. So if you compromise the hypervisor you compromise the whole platform.
Quoted 7 lines
Quoted 4 lines
Also, I do believe that the domain creation should be limited to create the domain and not configuring the devices other than the strict necessary. For anything else (UART, co-processor),
But vgic is configured at the earliest stages of the domain creation. So we have to know at the moment which IRQs would be injected into the domain. And that is my current problem.
No, the vGIC only needs to know the maximum number of interrupts it can handle. You don't need to route them at that time.
Currently, the toolstack is deciding on the number of spis supported (give a look at nr_spis).
IHMO, the toolstack should be able to figure out the number of interrupts required by the virtual co-processors and then update nr_spis accordingly.
Quoted 4 lines
Quoted 2 lines
this should be done later on.
What is the proper moment to spawn virtual coprocessors for guest domains from your point of view?
The DOMCTL createdomain does not scale for things like co-processors. It is only here to initialize the bare minimum for a domain. You could create new DOMCTL to handle co-processors and call them afterwards from libxl__arch_domain_create.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hello Julien,
Quoted 20 lines · Julien Grall
(CC tools maintainers)
Quoted 1 line · Andrii Anisov
Julien,
Hi Andrii,
Quoted 12 lines · Julien Grall
Quoted 10 lines
Quoted 3 lines
I understand these concerns, but not sure should we be scared of attack from a domain privileged enough to run domains?
Whilst the domain is privileged enough to run domains, the configuration can be provided by a user (for instance in cloud environment). So you cannot trust what the user provided and any missing invalidation would lead to a security issue (see XSA-95 [1] for instance).
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
That's why we specifically said only trusted device tree should be used with the option "
device_tree".I see. But I also could state the same.
I would rather avoid to take this approach until we explored all the possibility.
We took this approach for platform device passthrough because we considered it would only be used for embedded platform where everything will be under control.
In the case of virtual co-processor, I can see a usage beyond embedded so we would need to deal with non-trusted input.
Yep, it's one of our targets to spread SCF beyond the embedded world.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Also, I do believe that the domain creation should be limited to create the domain and not configuring the devices other than the strict necessary. For anything else (UART, co-processor),
But vgic is configured at the earliest stages of the domain creation. So we have to know at the moment which IRQs would be injected into the domain. And that is my current problem.
Quoted 5 lines
No, the vGIC only needs to know the maximum number of interrupts it can handle. You don't need to route them at that time.
Currently, the toolstack is deciding on the number of spis supported (give a look at
nr_spis).IHMO, the toolstack should be able to figure out the number of interrupts required by the virtual co-processors and then update
nr_spisaccordingly.
This will lead to the need of parse (and maybe reads dtb file) first here. Then one more time on DomU device tree generation.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
this should be done later on.
What is the proper moment to spawn virtual coprocessors for guest domains from your point of view?
The DOMCTL createdomain does not scale for things like co-processors. It is only here to initialize the bare minimum for a domain. You could create new DOMCTL to handle co-processors and call them afterwards from
libxl__arch_domain_create.
It is done in such way now. From libxl__arch_domain_create another domctl sends a pfdt blob to hypervisor for SCF configuration.
Signature · 10 lines
*Andrii Anisov* * * _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 47 lines · Andrii Anisov
Hello Julien,
Quoted 27 lines · Julien Grall
(CC tools maintainers)
Quoted 1 line · Andrii Anisov
Julien,
Hi Andrii,
Quoted 13 lines · Julien Grall
Quoted 11 lines
Quoted 4 lines
I understand these concerns, but not sure should we be scared of attack
from a domain privileged enough to run domains?Whilst the domain is privileged enough to run domains, the configuration can be provided by a user (for instance in cloud environment). So you cannot trust what the user provided and any missing invalidation would lead to a security issue (see XSA-95 [1] for instance).
Quoted 3 lines
Quoted 2 lines
That's why we specifically said only trusted device tree should be used with the option "
device_tree".I see. But I also could state the same.
I would rather avoid to take this approach until we explored all the possibility.
Quoted 6 lines
We took this approach for platform device passthrough because we considered it would only be used for embedded platform where everything will be under control.
In the case of virtual co-processor, I can see a usage beyond embedded so we would need to deal with non-trusted input.
Yep, it's one of our targets to spread SCF beyond the embedded world.
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Also, I do believe that the domain creation should be limited to create the domain and not configuring the devices other than the strict necessary. For anything else (UART, co-processor),
But vgic is configured at the earliest stages of the domain creation. So we have to know at the moment which IRQs would be injected into the domain. And that is my current problem.
No, the vGIC only needs to know the maximum number of interrupts it can handle. You don't need to route them at that time.
Quoted 8 lines
Quoted 6 lines
Currently, the toolstack is deciding on the number of spis supported (give a look at
nr_spis).IHMO, the toolstack should be able to figure out the number of interrupts required by the virtual co-processors and then update
nr_spisaccordingly.This will lead to the need of parse (and maybe reads dtb file) first here. Then one more time on DomU device tree generation.
The code is not set in stone. It can be reworked to avoid that.
Quoted 6 lines
Quoted 4 lines
The DOMCTL createdomain does not scale for things like co-processors. It is only here to initialize the bare minimum for a domain. You could create new DOMCTL to handle co-processors and call them afterwards from
libxl__arch_domain_create.It is done in such way now. From
libxl__arch_domain_createanother domctl sends a pfdt blob to hypervisor for SCF configuration.
Passing an fdt blob to the hypervisor should be used at the last resort. Whilst I agree it would be difficult to get a suitable interface between the user and the toolstack, C allows a lot of freedom to create suitable structure. So I still don't understand why you want to use a device tree between the toolstack and the hypervisor.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Julien,
Quoted 1 line · Julien Grall
The code is not set in stone. It can be reworked to avoid that.
Yep.
I would like to not introduce changes related to dtb into libxl_create.c, keep as much as possible in libxl_arm.c . The only common data structure between libxl__arch_domain_prepare_config() and libxl__arch_domain_create() is an autogenerated libxl_domain_config structure. The option I see now is to introduce kind of auto type "File" which will read and manage file blob within libxl_domain_config structure. Honestly, I do not like this option. Any suggestions?
Quoted 1 line
So I still don't understand why you want to use a device tree between the toolstack and the hypervisor.
It has a functional (except vgic settings) implementation now.
But as you said the code is not set in stone. I'm here to hear your valuable opinion, discuss options and see what ideas will come up.
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 1 line · Andrii Anisov
Julien,
Hi Andrii,
Quoted 13 lines · Julien Grall
Quoted 2 lines
The code is not set in stone. It can be reworked to avoid that.
Yep.
I would like to not introduce changes related to dtb intolibxl_create.c, keep as much as possible inlibxl_arm.c. The only common data structure betweenlibxl__arch_domain_prepare_config()andlibxl__arch_domain_create()is an autogeneratedlibxl_domain_configstructure.
The option I see now is to introduce kind of auto type "File" which will read and manage file blob withinlibxl_domain_configstructure. Honestly, I do not like this option. Any suggestions?
I don't know much the toolstack, I will leave Ian and Wei commenting on this.
Quoted 6 lines
Quoted 3 lines
So I still don't understand why you want to use a device tree between the toolstack and the hypervisor.
It has a functional (except vgic settings) implementation now. But as you said the code is not set in stone. I'm here to hear your valuable opinion, discuss options and see what ideas will come up.
Have you tried to define an interface using C structure? If not, my suggestion would be to first do that so we can discuss on other alternative.
This could be part of a new version of the design document to get all the context.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hello Julien,
Quoted 1 line · Julien Grall
Have you tried to define an interface using C structure?
Not yet.
Quoted 1 line
If not, my suggestion would be to first do that so we can discuss on other alternative.
Going to take this action soon.
Signature · 8 lines
*Andrii Anisov* _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel