From patchwork Thu Jun 23 17:07:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 9195623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 846186075F for ; Thu, 23 Jun 2016 17:10:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C4BC27C26 for ; Thu, 23 Jun 2016 17:10:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6112A28463; Thu, 23 Jun 2016 17:10:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3999027C26 for ; Thu, 23 Jun 2016 17:10:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG86O-0005I5-Ul; Thu, 23 Jun 2016 17:07:40 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG86N-0005GY-Ee for xen-devel@lists.xenproject.org; Thu, 23 Jun 2016 17:07:39 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id C9/13-09256-A571C675; Thu, 23 Jun 2016 17:07:38 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsVyMfSas26UeE6 4wdEZjBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bcR0/YCu74V8xc+5WpgXGrXRcjF4eQwExG ieOvH7GAOBIC/awSV1susnUxcgI5MRIXZr2FsiskzpxaAmYLCWhI3L7ZyA7R3c8kcfP6SlaQB JuAtkTb611gtoiAksS9VZOZQGxmgVqJ1RsnsoPYwgIOEgd+TmUEsVkEVCW2rNnPDGLzCjhL9L zsZIdYJidxefoDsGWcAi4S22afYYJY7Cxx5s4/tgmM/AsYGVYxqhenFpWlFuka6SUVZaZnlOQ mZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBAYQAxDsYFz21+kQoyQHk5Ior5FYTrgQX1J+SmVG YnFGfFFpTmrxIUYZDg4lCV5/kJxgUWp6akVaZg4wlGHSEhw8SiK8HSBp3uKCxNzizHSI1ClGS 44tv6+tZeI4NvcGkNw29d5aJiGWvPy8VClx3haQBgGQhozSPLhxsHi7xCgrJczLCHSgEE9Bal FuZgmq/CtGcQ5GJWHeNJApPJl5JXBbXwEdxAR00N3+bJCDShIRUlINjLqamxcrfX+4/ajclQO ea+5qHDDwdJ3f/TaC//fixrRu/Z7f7wwerDA2SJs12UHqe+4HA9vsoBcx0rKT/0YmPwkrk+iL v2uz0e1j/J5715ifrr4+baIFzxT+c6sZbwk85kx7JfAmMedwycwZ4jPKmx4n/pzVFaZ+y+Kc2 BnpVsGg97rzJKzPPlJiKc5INNRiLipOBAAx0yVksgIAAA== X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1466701656!20479471!1 X-Originating-IP: [209.85.214.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16942 invoked from network); 23 Jun 2016 17:07:37 -0000 Received: from mail-it0-f67.google.com (HELO mail-it0-f67.google.com) (209.85.214.67) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 23 Jun 2016 17:07:37 -0000 Received: by mail-it0-f67.google.com with SMTP id g127so12261309ith.2 for ; Thu, 23 Jun 2016 10:07:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=epFoDZ7ql4dYiV66u2qFgIGTG6T4xKfc2cy1Sh4XuiQ=; b=mm/R/pA65n9BIE8YlXcNFyOPACDdYUkJaIsBEF9TEiflMQlzqazvKKSaPWZ2pSEoIA DrTfpM2tjcWv4sS+e8tgthLPbsw1m1qX52tRzpDo3H3jeRiTiXIzjbBytLLMqFO27KFd 5/Kv56W9vg+p0sAIGkovzLpszMceRvRSskAfRlJCtYQMWAl65yXlPrulpDfj5mturHBe 8IvGuhJPFmwC5VllbAzeSSZGAGX4K2FLnR98hvBd5maptD2UEJGpx8opMIQBvfmkQqpH xadmzM11JVGGE9SQUIYPqX/KBRqn04RbbFcLs/9nI+wU7iuYLRGnnc4LXlABOOIL2nco 0eKA== X-Gm-Message-State: ALyK8tIwRxYZefEHN8HiQVFvX15Z9VXyEcgl0Oo2CguoSWNT2vY+n7bbOs/Dmf/Q/Y4lig== X-Received: by 10.36.78.20 with SMTP id r20mr22105783ita.20.1466701656244; Thu, 23 Jun 2016 10:07:36 -0700 (PDT) Received: from l1.lan (c-73-14-35-59.hsd1.co.comcast.net. [73.14.35.59]) by smtp.gmail.com with ESMTPSA id e91sm725356itd.8.2016.06.23.10.07.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2016 10:07:34 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Thu, 23 Jun 2016 11:07:25 -0600 Message-Id: <1466701647-21733-3-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1466701647-21733-1-git-send-email-tamas@tklengyel.com> References: <1466701647-21733-1-git-send-email-tamas@tklengyel.com> Cc: Andrew Cooper , Tamas K Lengyel , Jun Nakajima Subject: [Xen-devel] [PATCH v6 3/5] monitor: Rename hvm/event to hvm/monitor X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Mechanical renaming to better describe that the code in hvm/event is part of the monitor subsystem. Signed-off-by: Tamas K Lengyel Acked-by: Kevin Tian Acked-by: Razvan Cojocaru Acked-by: Jan Beulich --- Cc: Andrew Cooper Cc: Jun Nakajima --- xen/arch/x86/hvm/Makefile | 2 +- xen/arch/x86/hvm/hvm.c | 12 +++++------ xen/arch/x86/hvm/{event.c => monitor.c} | 17 ++++++++------- xen/arch/x86/hvm/vmx/vmx.c | 13 +++++------ xen/include/asm-x86/hvm/{event.h => monitor.h} | 30 +++++++++++++------------- 5 files changed, 38 insertions(+), 36 deletions(-) rename xen/arch/x86/hvm/{event.c => monitor.c} (88%) rename xen/include/asm-x86/hvm/{event.h => monitor.h} (59%) diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile index 8bc55a9..f750d13 100644 --- a/xen/arch/x86/hvm/Makefile +++ b/xen/arch/x86/hvm/Makefile @@ -3,7 +3,6 @@ subdir-y += vmx obj-y += asid.o obj-y += emulate.o -obj-y += event.o obj-y += hpet.o obj-y += hvm.o obj-y += i8254.o @@ -11,6 +10,7 @@ obj-y += intercept.o obj-y += io.o obj-y += ioreq.o obj-y += irq.o +obj-y += monitor.o obj-y += mtrr.o obj-y += nestedhvm.o obj-y += pmtimer.o diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 337a119..ef18949 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -60,7 +60,7 @@ #include #include #include -#include +#include #include #include #include @@ -1961,7 +1961,7 @@ int hvm_handle_xsetbv(u32 index, u64 new_bv) { int rc; - hvm_event_crX(XCR0, new_bv, current->arch.xcr0); + hvm_monitor_crX(XCR0, new_bv, current->arch.xcr0); rc = handle_xsetbv(index, new_bv); if ( rc ) @@ -2197,7 +2197,7 @@ int hvm_set_cr0(unsigned long value, bool_t may_defer) { ASSERT(v->arch.vm_event); - if ( hvm_event_crX(CR0, value, old_value) ) + if ( hvm_monitor_crX(CR0, value, old_value) ) { /* The actual write will occur in hvm_do_resume(), if permitted. */ v->arch.vm_event->write_data.do_write.cr0 = 1; @@ -2299,7 +2299,7 @@ int hvm_set_cr3(unsigned long value, bool_t may_defer) { ASSERT(v->arch.vm_event); - if ( hvm_event_crX(CR3, value, old) ) + if ( hvm_monitor_crX(CR3, value, old) ) { /* The actual write will occur in hvm_do_resume(), if permitted. */ v->arch.vm_event->write_data.do_write.cr3 = 1; @@ -2379,7 +2379,7 @@ int hvm_set_cr4(unsigned long value, bool_t may_defer) { ASSERT(v->arch.vm_event); - if ( hvm_event_crX(CR4, value, old_cr) ) + if ( hvm_monitor_crX(CR4, value, old_cr) ) { /* The actual write will occur in hvm_do_resume(), if permitted. */ v->arch.vm_event->write_data.do_write.cr4 = 1; @@ -3765,7 +3765,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, v->arch.vm_event->write_data.msr = msr; v->arch.vm_event->write_data.value = msr_content; - hvm_event_msr(msr, msr_content); + hvm_monitor_msr(msr, msr_content); return X86EMUL_OKAY; } diff --git a/xen/arch/x86/hvm/event.c b/xen/arch/x86/hvm/monitor.c similarity index 88% rename from xen/arch/x86/hvm/event.c rename to xen/arch/x86/hvm/monitor.c index 8fdb6f5..f0ab33a 100644 --- a/xen/arch/x86/hvm/event.c +++ b/xen/arch/x86/hvm/monitor.c @@ -1,5 +1,5 @@ /* - * arch/x86/hvm/event.c + * arch/x86/hvm/monitor.c * * Arch-specific hardware virtual machine event abstractions. * @@ -7,6 +7,7 @@ * Copyright (c) 2005, International Business Machines Corporation. * Copyright (c) 2008, Citrix Systems, Inc. * Copyright (c) 2016, Bitdefender S.R.L. + * Copyright (c) 2016, Tamas K Lengyel (tamas@tklengyel.com) * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -22,12 +23,12 @@ */ #include -#include +#include #include #include #include -bool_t hvm_event_cr(unsigned int index, unsigned long value, unsigned long old) +bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old) { struct vcpu *curr = current; struct arch_domain *ad = &curr->domain->arch; @@ -54,7 +55,7 @@ bool_t hvm_event_cr(unsigned int index, unsigned long value, unsigned long old) return 0; } -void hvm_event_msr(unsigned int msr, uint64_t value) +void hvm_monitor_msr(unsigned int msr, uint64_t value) { struct vcpu *curr = current; @@ -86,8 +87,8 @@ static inline unsigned long gfn_of_rip(unsigned long rip) return paging_gva_to_gfn(curr, sreg.base + rip, &pfec); } -int hvm_event_breakpoint(unsigned long rip, - enum hvm_event_breakpoint_type type) +int hvm_monitor_breakpoint(unsigned long rip, + enum hvm_monitor_breakpoint_type type) { struct vcpu *curr = current; struct arch_domain *ad = &curr->domain->arch; @@ -95,14 +96,14 @@ int hvm_event_breakpoint(unsigned long rip, switch ( type ) { - case HVM_EVENT_SOFTWARE_BREAKPOINT: + case HVM_MONITOR_SOFTWARE_BREAKPOINT: if ( !ad->monitor.software_breakpoint_enabled ) return 0; req.reason = VM_EVENT_REASON_SOFTWARE_BREAKPOINT; req.u.software_breakpoint.gfn = gfn_of_rip(rip); break; - case HVM_EVENT_SINGLESTEP_BREAKPOINT: + case HVM_MONITOR_SINGLESTEP_BREAKPOINT: if ( !ad->monitor.singlestep_enabled ) return 0; req.reason = VM_EVENT_REASON_SINGLESTEP; diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 4edf283..a56926c 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include #include @@ -2473,10 +2473,10 @@ static int vmx_cr_access(unsigned long exit_qualification) /* * Special case unlikely to be interesting to a - * VM_EVENT_FLAG_DENY-capable application, so the hvm_event_crX() + * VM_EVENT_FLAG_DENY-capable application, so the hvm_monitor_crX() * return value is ignored for now. */ - hvm_event_crX(CR0, value, old); + hvm_monitor_crX(CR0, value, old); curr->arch.hvm_vcpu.guest_cr[0] = value; vmx_update_guest_cr(curr, 0); HVMTRACE_0D(CLTS); @@ -3389,8 +3389,8 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) } else { int handled = - hvm_event_breakpoint(regs->eip, - HVM_EVENT_SOFTWARE_BREAKPOINT); + hvm_monitor_breakpoint(regs->eip, + HVM_MONITOR_SOFTWARE_BREAKPOINT); if ( handled < 0 ) { @@ -3717,7 +3717,8 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) vmx_update_cpu_exec_control(v); if ( v->arch.hvm_vcpu.single_step ) { - hvm_event_breakpoint(regs->eip, HVM_EVENT_SINGLESTEP_BREAKPOINT); + hvm_monitor_breakpoint(regs->eip, + HVM_MONITOR_SINGLESTEP_BREAKPOINT); if ( v->domain->debugger_attached ) domain_pause_for_debugger(); } diff --git a/xen/include/asm-x86/hvm/event.h b/xen/include/asm-x86/hvm/monitor.h similarity index 59% rename from xen/include/asm-x86/hvm/event.h rename to xen/include/asm-x86/hvm/monitor.h index 03f7fee..55d435e 100644 --- a/xen/include/asm-x86/hvm/event.h +++ b/xen/include/asm-x86/hvm/monitor.h @@ -1,7 +1,7 @@ /* - * include/asm-x86/hvm/event.h + * include/asm-x86/hvm/monitor.h * - * Arch-specific hardware virtual machine event abstractions. + * Arch-specific hardware virtual machine monitor abstractions. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -16,17 +16,17 @@ * this program; If not, see . */ -#ifndef __ASM_X86_HVM_EVENT_H__ -#define __ASM_X86_HVM_EVENT_H__ +#ifndef __ASM_X86_HVM_MONITOR_H__ +#define __ASM_X86_HVM_MONITOR_H__ #include #include #include -enum hvm_event_breakpoint_type +enum hvm_monitor_breakpoint_type { - HVM_EVENT_SOFTWARE_BREAKPOINT, - HVM_EVENT_SINGLESTEP_BREAKPOINT, + HVM_MONITOR_SOFTWARE_BREAKPOINT, + HVM_MONITOR_SINGLESTEP_BREAKPOINT, }; /* @@ -34,15 +34,15 @@ enum hvm_event_breakpoint_type * The event might not fire if the client has subscribed to it in onchangeonly * mode, hence the bool_t return type for control register write events. */ -bool_t hvm_event_cr(unsigned int index, unsigned long value, - unsigned long old); -#define hvm_event_crX(cr, new, old) \ - hvm_event_cr(VM_EVENT_X86_##cr, new, old) -void hvm_event_msr(unsigned int msr, uint64_t value); -int hvm_event_breakpoint(unsigned long rip, - enum hvm_event_breakpoint_type type); +bool_t hvm_monitor_cr(unsigned int index, unsigned long value, + unsigned long old); +#define hvm_monitor_crX(cr, new, old) \ + hvm_monitor_cr(VM_EVENT_X86_##cr, new, old) +void hvm_monitor_msr(unsigned int msr, uint64_t value); +int hvm_monitor_breakpoint(unsigned long rip, + enum hvm_monitor_breakpoint_type type); -#endif /* __ASM_X86_HVM_EVENT_H__ */ +#endif /* __ASM_X86_HVM_MONITOR_H__ */ /* * Local variables: