VMX: don't allow PVH to reach handle_mmio()
PATCH v2 1/1 VMX: don't allow PVH to reach handle_mmio()
PVH guests accessing I/O ports via string ops is not supported yet.
---
v2: handle_pio() is already safe (pointed out by Mukesh), so only refuse
entering handle_mmio().
Note: Only compile tested so far.
xen/arch/x86/hvm/vmx/vmx.c +2 -1
@@ -3086,7 +3086,8 @@ void vmx_vmexit_handler(struct cpu_user_if ( exit_qualification &0x10 ) {/* INS, OUTS */ -if ( !handle_mmio () ) +if (unlikely (is_pvh_vcpu (v))/* PVH fixme */ || + !handle_mmio () )hvm_inject_hw_exception (TRAP_gp_fault,0 ); }else
PVH guests accessing I/O ports via string ops is not supported yet.
---
v2: handle_pio() is already safe (pointed out by Mukesh), so only refuse
entering handle_mmio().
Note: Only compile tested so far.
xen/arch/x86/hvm/vmx/vmx.c +2 -1
@@ -3086,7 +3086,8 @@ void vmx_vmexit_handler(struct cpu_user_if ( exit_qualification &0x10 ) {/* INS, OUTS */ -if ( !handle_mmio () ) +if (unlikely (is_pvh_vcpu (v))/* PVH fixme */ || + !handle_mmio () )hvm_inject_hw_exception (TRAP_gp_fault,0 ); }else
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 16 lines · On Mon, 08 Dec 2014 09:12:37 +0000 "Jan Beulich" <[email protected]> wrote:
PVH guests accessing I/O ports via string ops is not supported yet.
Reported-by Roger Pau Monné<[email protected]>Signed-off-by Jan Beulich <[email protected]>---
v2:handle_pio()is already safe (pointed out by Mukesh), so only refuse enteringhandle_mmio().
Note: Only compile tested so far.---
unstable.orig/xen/arch/x86/hvm/vmx/vmx.c2014-11-27
09:37:27.000000000 +0100 +++unstable/xen/arch/x86/hvm/vmx/vmx.c2014-12-08
10:04:27.000000000 +0100 @@ -3086,7 +3086,8 @@ voidvmx_vmexit_handler(struct cpu_user_ if ( exit_qualification & 0x10 ) { /* INS, OUTS */
xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_ · line 3093
Quoted 6 lines
xen/arch/x86/hvm/vmx/vmx.c +2
-1-if ( !handle_mmio () ) +if (unlikely (is_pvh_vcpu (v))/* PVH fixme */ || + !handle_mmio () )hvm_inject_hw_exception (TRAP_gp_fault,0 ); }else
Good idea, and if needed:
thanks
Mukesh
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
El 08/12/14 a les 10.12, Jan Beulich ha escrit:
Quoted 4 lines
PVH guests accessing I/O ports via string ops is not supported yet.
Reported-by Roger Pau Monné<[email protected]>Signed-off-by Jan Beulich <[email protected]>
This looks fine to me (at least it doesn't break the existing IN/OUT users), and seems the best solution 4.5 wise:
For 4.6 I think we need to start using a different hvm_io_bitmap for PVH Dom0 that allows direct access to the IO ports, bypassing the vmexit and simplifying the code in Xen (this would also fix INS/OUTS). Still not sure what should be done for PVH DomUs, specially when PVH gains support for pci-passthrough.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.12.14 at 18:01, <[email protected]> wrote:
For 4.6 I think we need to start using a different
hvm_io_bitmapfor PVH Dom0 that allows direct access to the IO ports, bypassing the vmexit and simplifying the code in Xen (this would also fix INS/OUTS). Still not sure what should be done for PVH DomUs, specially when PVH gains support for pci-passthrough.
With the difficulty being that for PV the hypervisor intentionally intercepts accesses to some of the ports, so we can't blindly allow PVH access to all the ports its allowed access to.
Jan
El 09/12/14 a les 18.19, Jan Beulich ha escrit:
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.12.14 at 18:01, <[email protected]> wrote:
For 4.6 I think we need to start using a different
hvm_io_bitmapfor PVH Dom0 that allows direct access to the IO ports, bypassing the vmexit and simplifying the code in Xen (this would also fix INS/OUTS). Still not sure what should be done for PVH DomUs, specially when PVH gains support for pci-passthrough.With the difficulty being that for PV the hypervisor intentionally intercepts accesses to some of the ports, so we can't blindly allow PVH access to all the ports its allowed access to.
I assume this is mainly for DomUs but not for Dom0? Or should PVH Dom0 access to the IO space also be filtered and emulated for some ports?
Roger.
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 09.12.14 at 18:49, <[email protected]> wrote:
El 09/12/14 a les 18.19, Jan Beulich ha escrit:
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.12.14 at 18:01, <[email protected]> wrote:
For 4.6 I think we need to start using a different
hvm_io_bitmapfor PVH Dom0 that allows direct access to the IO ports, bypassing the vmexit and simplifying the code in Xen (this would also fix INS/OUTS). Still not sure what should be done for PVH DomUs, specially when PVH gains support for pci-passthrough.
Quoted 6 lines
Quoted 3 lines
With the difficulty being that for PV the hypervisor intentionally intercepts accesses to some of the ports, so we can't blindly allow PVH access to all the ports its allowed access to.
I assume this is mainly for DomUs but not for Dom0? Or should PVH Dom0 access to the IO space also be filtered and emulated for some ports?
It should indeed - just look at guest_io_read() and guest_io_write(). I.e. an eventual PVH specific bitmap would need to be populated based on what admin_io_okay() returns (instead of ioports_access_permitted()), carefully taking into consideration the possible access widths.
Jan
Quoted 10 lines · Roger Pau Monné
El 08/12/14 a les 10.12, Jan Beulich ha escrit:
Quoted 4 lines
PVH guests accessing I/O ports via string ops is not supported yet.
Reported-by Roger Pau Monné<[email protected]>Signed-off-by Jan Beulich <[email protected]>This looks fine to me (at least it doesn't break the existing IN/OUT users), and seems the best solution 4.5 wise:
Acked-by Roger Pau Monné <[email protected]>
Quoted 9 lines
For 4.6 I think we need to start using a different
hvm_io_bitmapfor PVH Dom0 that allows direct access to the IO ports, bypassing the vmexit and simplifying the code in Xen (this would also fix INS/OUTS). Still not sure what should be done for PVH DomUs, specially when PVH gains support for pci-passthrough.Roger.
Quoted 7 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Monday, December 08, 2014 5:13 PMPVH guests accessing I/O ports via string ops is not supported yet.
Reported-by Roger Pau Monné<[email protected]>Signed-off-by Jan Beulich <[email protected]>
Quoted 11 lines
---
v2:handle_pio()is already safe (pointed out by Mukesh), so only refuse
enteringhandle_mmio().
Note: Only compile tested so far.---
unstable.orig/xen/arch/x86/hvm/vmx/vmx.c2014-11-27
09:37:27.000000000 +0100
+++unstable/xen/arch/x86/hvm/vmx/vmx.c2014-12-08
10:04:27.000000000 +0100
xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_ · line 3093
Quoted 9 lines
xen/arch/x86/hvm/vmx/vmx.c +2
-1@@ -3086,7 +3086,8 @@ void vmx_vmexit_handler(struct cpu_user_if ( exit_qualification &0x10 ) {/* INS, OUTS */ -if ( !handle_mmio () ) +if (unlikely (is_pvh_vcpu (v))/* PVH fixme */ || + !handle_mmio () )hvm_inject_hw_exception (TRAP_gp_fault,0 ); }else
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel