From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: [PATCH for-4.5 v6 10/16] Add VMware tool's triggers Date: Sat, 20 Sep 2014 14:07:21 -0400 Message-ID: <1411236447-7435-11-git-send-email-dslutz@verizon.com> References: <1411236447-7435-1-git-send-email-dslutz@verizon.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1411236447-7435-1-git-send-email-dslutz@verizon.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Kevin Tian , Keir Fraser , Ian Campbell , Stefano Stabellini , Jun Nakajima , Eddie Dong , Ian Jackson , Don Slutz , Tim Deegan , George Dunlap , Aravind Gopalakrishnan , Jan Beulich , Andrew Cooper , Boris Ostrovsky , Suravee Suthikulpanit List-Id: xen-devel@lists.xenproject.org These are not the same as the PV control interface; they are more like the ACPI power event. For anything to happen when they are used, the domU must be running a VMware tools daemon that is polling for triggers. If the domU is running VMware tools, then the "build version" of the tools is also available via xc_get_HVM_param(). This also enables the use of new triggers that will use the VMware hyper-call to do some limited control of the domU. The most useful are poweroff and reboot. Since a guest process needs to be running for these to work, a tool stack should check that the build version is non zero before assuming these will work. The 2 hvm param's HVM_PARAM_VMPORT_BUILD_NUMBER_TIME and HVM_PARAM_VMPORT_BUILD_NUMBER_VALUE are how "build version" is accessed. These 2 params are only allowed to be set to zero. The HVM_PARAM_VMPORT_BUILD_NUMBER_TIME can be used to track the last time the VMware tools in the guest responded. One such use would be the health of the tools in the guest. The hvm param HVM_PARAM_VMPORT_RESET_TIME controls how often to request them in seconds minus 1. The minus 1 is to handle to 0 case. I.E. the fastest that can be selected is every second. The default is 4 times a minute. XEN_DOMCTL_SENDTRIGGER_VTPING is the same as what is done using HVM_PARAM_VMPORT_RESET_TIME. This trigger allows the tool stack to request a sooner update of HVM_PARAM_VMPORT_BUILD_NUMBER_TIME and HVM_PARAM_VMPORT_BUILD_NUMBER_VALUE. Signed-off-by: Don Slutz --- xen/arch/x86/domctl.c | 34 ++++++++++++++++++++++++++++++++++ xen/include/asm-x86/hvm/vmport.h | 1 + xen/include/public/domctl.h | 3 +++ 3 files changed, 38 insertions(+) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 7a5de43..50596a6 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -579,6 +580,39 @@ long arch_do_domctl( } break; + case XEN_DOMCTL_SENDTRIGGER_VTPOWER: + { + ret = -EINVAL; + if ( is_hvm_domain(d) ) + { + ret = 0; + vmport_ctrl_send(&d->arch.hvm_domain, "OS_Halt"); + } + } + break; + + case XEN_DOMCTL_SENDTRIGGER_VTREBOOT: + { + ret = -EINVAL; + if ( is_hvm_domain(d) ) + { + ret = 0; + vmport_ctrl_send(&d->arch.hvm_domain, "OS_Reboot"); + } + } + break; + + case XEN_DOMCTL_SENDTRIGGER_VTPING: + { + ret = -EINVAL; + if ( is_hvm_domain(d) ) + { + ret = 0; + vmport_ctrl_send(&d->arch.hvm_domain, "ping"); + } + } + break; + default: ret = -ENOSYS; } diff --git a/xen/include/asm-x86/hvm/vmport.h b/xen/include/asm-x86/hvm/vmport.h index f14bdd2..20f7883 100644 --- a/xen/include/asm-x86/hvm/vmport.h +++ b/xen/include/asm-x86/hvm/vmport.h @@ -75,6 +75,7 @@ int vmport_rpc_hvmop_precheck(unsigned long op, struct xen_hvm_vmport_guest_info *a); int vmport_rpc_hvmop_do(struct domain *d, unsigned long op, struct xen_hvm_vmport_guest_info *a); +void vmport_ctrl_send(struct hvm_domain *hd, char *msg); #endif /* ASM_X86_HVM_VMPORT_H__ */ diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 92b50ef..bce8925 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -462,6 +462,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_address_size_t); #define XEN_DOMCTL_SENDTRIGGER_INIT 2 #define XEN_DOMCTL_SENDTRIGGER_POWER 3 #define XEN_DOMCTL_SENDTRIGGER_SLEEP 4 +#define XEN_DOMCTL_SENDTRIGGER_VTPOWER 5 +#define XEN_DOMCTL_SENDTRIGGER_VTREBOOT 6 +#define XEN_DOMCTL_SENDTRIGGER_VTPING 7 struct xen_domctl_sendtrigger { uint32_t trigger; /* IN */ uint32_t vcpu; /* IN */ -- 1.8.4