monitor: Rename vm_event_monitor_get_capabilities to arch_monitor_get_capabilities
PATCH 1/1 monitor: Rename vm_event_monitor_get_capabilities to arch_monitor_get_capabilities
The monitor_get_capabilities check actually belongs to the monitor subsystem so relocating and renaming it to sanitize the code's name and location.
--- xen/arch/x86/monitor.c | 2 +- xen/common/monitor.c | 5 ++--- xen/include/asm-arm/monitor.h | 11 ++++++++++- xen/include/asm-arm/vm_event.h | 9 --------- xen/include/asm-x86/monitor.h | 23 +++++++++++++++++++++++ xen/include/asm-x86/vm_event.h | 23 ----------------------- 6 files changed, 36 insertions(+), 37 deletions(-)
xen/arch/x86/monitor.c +1 -1
@@ -126,7 +126,7 @@ int arch_monitor_domctl_event(struct domain *d,default :/* -* Should not be reached unless vm_event_monitor_get_capabilities() is +* Should not be reached unless arch_monitor_get_capabilities() is * not properly implemented. */ ASSERT_UNREACHABLE ();
xen/common/monitor.c +2 -3
@@ -24,7 +24,6 @@#include <xsm/xsm.h> #include <public/domctl.h> #include <asm/monitor.h> -#include <asm/vm_event.h> int monitor_domctl (struct domain *d,struct xen_domctl_monitor_op *mop) {
@@ -48,12 +47,12 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)if (unlikely (mop->event >31 ) )return -EINVAL ;/* Check if event type is available. */ -if (unlikely (!(vm_event_monitor_get_capabilities (d) & (1U << mop->event))) ) +if (unlikely (!(arch_monitor_get_capabilities (d) & (1U << mop->event))) )return -EOPNOTSUPP ;break ;case XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES : - mop->event =vm_event_monitor_get_capabilities (d); + mop->event =arch_monitor_get_capabilities (d);return 0 ;default :
xen/include/asm-arm/monitor.h +10 -1
@@ -39,11 +39,20 @@ int arch_monitor_domctl_event(struct domain *d,/* * No arch-specific monitor vm-events on ARM. * -* Should not be reached unless vm_event_monitor_get_capabilities() is not +* Should not be reached unless arch_monitor_get_capabilities() is not * properly implemented. */ ASSERT_UNREACHABLE (); return -EOPNOTSUPP; } +static inline uint32_t arch_monitor_get_capabilities (struct domain *d) +{ +uint32_t capabilities =0 ; + + capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + +return capabilities; +} +#endif /* __ASM_ARM_MONITOR_H__ */
xen/include/asm-arm/vm_event.h +0 -9
@@ -59,13 +59,4 @@ static inline void vm_event_fill_regs(vm_event_request_t *req) /* Not supported on ARM. */ } -static inline uint32_t vm_event_monitor_get_capabilities (struct domain *d) -{ -uint32_t capabilities =0 ; - - capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); - -return capabilities; -} -#endif /* __ASM_ARM_VM_EVENT_H__ */
xen/include/asm-x86/monitor.h +23 -0
@@ -50,4 +50,27 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)int arch_monitor_domctl_event (struct domain *d,struct xen_domctl_monitor_op *mop); +static inline uint32_t arch_monitor_get_capabilities (struct domain *d) +{ +uint32_t capabilities =0 ; + +/* +* At the moment only Intel HVM domains are supported. However, event +* delivery could be extended to AMD and PV domains. +*/ +if ( !is_hvm_domain (d) || !cpu_has_vmx ) +return capabilities; + + capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + +/* Since we know this is on VMX, we can just call the hvm func */ +if (hvm_is_singlestep_supported () ) + capabilities |= (1U <<XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP ); + +return capabilities; +} +#endif /* __ASM_X86_MONITOR_H__ */
xen/include/asm-x86/vm_event.h +0 -23
@@ -44,27 +44,4 @@ void vm_event_set_registers(struct vcpu *v, vm_event_response_t *rsp);void vm_event_fill_regs (vm_event_request_t *req); -static inline uint32_t vm_event_monitor_get_capabilities (struct domain *d) -{ -uint32_t capabilities =0 ; - -/* -* At the moment only Intel HVM domains are supported. However, event -* delivery could be extended to AMD and PV domains. -*/ -if ( !is_hvm_domain (d) || !cpu_has_vmx ) -return capabilities; - - capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG ) | - (1U <<XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR ) | - (1U <<XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT ) | - (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); - -/* Since we know this is on VMX, we can just call the hvm func */ -if (hvm_is_singlestep_supported () ) - capabilities |= (1U <<XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP ); - -return capabilities; -} -#endif /* __ASM_X86_VM_EVENT_H__ */
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 10 lines · Tamas K Lengyel
The
monitor_get_capabilitiescheck actually belongs to the monitor subsystem so relocating and renaming it to sanitize the code's name and location.Signed-off-by Tamas K Lengyel <[email protected]>Cc Razvan Cojocaru <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>
Looks sensible. Acked-by: Andrew Cooper <[email protected]>
However, this is definitely 4.8 material at this point.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 13 lines · Andrew Cooper
Quoted 1 line · Tamas K Lengyel
The
monitor_get_capabilitiescheck actually belongs to the monitorsubsystem so
Quoted 9 lines
relocating and renaming it to sanitize the code's name and location.
Signed-off-by Tamas K Lengyel <[email protected]>Cc Razvan Cojocaru <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>
Quoted 4 lines
Looks sensible. Acked-by: Andrew Cooper <[email protected]>
However, this is definitely 4.8 material at this point.
Certainly, all my patches at this point are for 4.8.
Thanks,
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Tamas K Lengyel
The
monitor_get_capabilitiescheck actually belongs to the monitor subsystem so relocating and renaming it to sanitize the code's name and location.Signed-off-by Tamas K Lengyel <[email protected]>Cc Razvan Cojocaru <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Hello Tamas,
Quoted 10 lines · Tamas K Lengyel
The
monitor_get_capabilitiescheck actually belongs to the monitor subsystem so relocating and renaming it to sanitize the code's name and location.Signed-off-by Tamas K Lengyel <[email protected]>Cc Razvan Cojocaru <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>
For the ARM bits:
Regards,
Quoted 158 lines
--- xen/arch/x86/monitor.c | 2 +- xen/common/monitor.c | 5 ++--- xen/include/asm-arm/monitor.h | 11 ++++++++++- xen/include/asm-arm/vm_event.h | 9 --------- xen/include/asm-x86/monitor.h | 23 +++++++++++++++++++++++ xen/include/asm-x86/vm_event.h | 23 ----------------------- 6 files changed, 36 insertions(+), 37 deletions(-)xen/arch/x86/monitor.c +1
-1@@ -126,7 +126,7 @@ int arch_monitor_domctl_event(struct domain *d,default :/* -* Should not be reached unless vm_event_monitor_get_capabilities() is +* Should not be reached unless arch_monitor_get_capabilities() is * not properly implemented. */ ASSERT_UNREACHABLE ();xen/common/monitor.c +2
-3@@ -24,7 +24,6 @@#include <xsm/xsm.h> #include <public/domctl.h> #include <asm/monitor.h> -#include <asm/vm_event.h> int monitor_domctl (struct domain *d,struct xen_domctl_monitor_op *mop) {@@ -48,12 +47,12 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)if (unlikely (mop->event >31 ) )return -EINVAL ;/* Check if event type is available. */ -if (unlikely (!(vm_event_monitor_get_capabilities (d) & (1U << mop->event))) ) +if (unlikely (!(arch_monitor_get_capabilities (d) & (1U << mop->event))) )return -EOPNOTSUPP ;break ;case XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES : - mop->event =vm_event_monitor_get_capabilities (d); + mop->event =arch_monitor_get_capabilities (d);return 0 ;default :xen/include/asm-arm/monitor.h +10
-1@@ -39,11 +39,20 @@ int arch_monitor_domctl_event(struct domain *d,/* * No arch-specific monitor vm-events on ARM. * -* Should not be reached unless vm_event_monitor_get_capabilities() is not +* Should not be reached unless arch_monitor_get_capabilities() is not * properly implemented. */ ASSERT_UNREACHABLE (); return -EOPNOTSUPP; } +static inline uint32_t arch_monitor_get_capabilities (struct domain *d) +{ +uint32_t capabilities =0 ; + + capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + +return capabilities; +} +#endif /* __ASM_ARM_MONITOR_H__ */ xen/include/asm-arm/vm_event.h +0
-9@@ -59,13 +59,4 @@ static inline void vm_event_fill_regs(vm_event_request_t *req) /* Not supported on ARM. */ } -static inline uint32_t vm_event_monitor_get_capabilities (struct domain *d) -{ -uint32_t capabilities =0 ; - - capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); - -return capabilities; -} -#endif /* __ASM_ARM_VM_EVENT_H__ */ xen/include/asm-x86/monitor.h +23
-0@@ -50,4 +50,27 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)int arch_monitor_domctl_event (struct domain *d,struct xen_domctl_monitor_op *mop); +static inline uint32_t arch_monitor_get_capabilities (struct domain *d) +{ +uint32_t capabilities =0 ; + +/* +* At the moment only Intel HVM domains are supported. However, event +* delivery could be extended to AMD and PV domains. +*/ +if ( !is_hvm_domain (d) || !cpu_has_vmx ) +return capabilities; + + capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + +/* Since we know this is on VMX, we can just call the hvm func */ +if (hvm_is_singlestep_supported () ) + capabilities |= (1U <<XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP ); + +return capabilities; +} +#endif /* __ASM_X86_MONITOR_H__ */ xen/include/asm-x86/vm_event.h +0
-23@@ -44,27 +44,4 @@ void vm_event_set_registers(struct vcpu *v, vm_event_response_t *rsp);void vm_event_fill_regs (vm_event_request_t *req); -static inline uint32_t vm_event_monitor_get_capabilities (struct domain *d) -{ -uint32_t capabilities =0 ; - -/* -* At the moment only Intel HVM domains are supported. However, event -* delivery could be extended to AMD and PV domains. -*/ -if ( !is_hvm_domain (d) || !cpu_has_vmx ) -return capabilities; - - capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG ) | - (1U <<XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR ) | - (1U <<XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT ) | - (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); - -/* Since we know this is on VMX, we can just call the hvm func */ -if (hvm_is_singlestep_supported () ) - capabilities |= (1U <<XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP ); - -return capabilities; -} -#endif /* __ASM_X86_VM_EVENT_H__ */
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
xen/include/asm-arm/monitor.h int arch_monitor_domctl_event(struct domain *d, · line 51
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Tamas K Lengyel <[email protected]> 04/14/16 6:34 PM >>>
xen/include/asm-arm/monitor.h +3
-0+static inline uint32_t arch_monitor_get_capabilities (struct domain *d) +{ +uint32_t capabilities =0 ;
Pointless initializer.
xen/include/asm-arm/monitor.h int arch_monitor_domctl_event(struct domain *d, · line 56
Quoted 4 lines
xen/include/asm-arm/monitor.h +4
-0+ capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + +return capabilities; +}
Even more - the entire function body could be just a single return statement.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Hi Jan,
Quoted 7 lines · Jan Beulich
xen/include/asm-arm/monitor.h int arch_monitor_domctl_event(struct domain *d, · line 51
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Tamas K Lengyel <[email protected]> 04/14/16 6:34 PM >>>
xen/include/asm-arm/monitor.h +3
-0+static inline uint32_t arch_monitor_get_capabilities (struct domain *d) +{ +uint32_t capabilities =0 ;Pointless initializer.
Quoted 6 lines
xen/include/asm-arm/monitor.h int arch_monitor_domctl_event(struct domain *d, · line 56
Quoted 4 lines
xen/include/asm-arm/monitor.h +4
-0+ capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + +return capabilities; +}Even more - the entire function body could be just a single return statement.
Your comments are valid, however this patch is only code movements. If you want the code to be fixed, then it should be a separate patch.
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel