From patchwork Sun May 29 22:37:05 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: 9140007 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 B80A060757 for ; Sun, 29 May 2016 22:40:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA18B1FFD6 for ; Sun, 29 May 2016 22:40:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9ECE8281CB; Sun, 29 May 2016 22:40:10 +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 BB3E91FFD6 for ; Sun, 29 May 2016 22:40:09 +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 1b79LL-00043p-D1; Sun, 29 May 2016 22:37:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b79LK-00042H-3a for xen-devel@lists.xenproject.org; Sun, 29 May 2016 22:37:58 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 94/44-16590-54F6B475; Sun, 29 May 2016 22:37:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRWlGSWpSXmKPExsVyMfSas65Lvne 4weyTyhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bP5UfZC/76V5zc2sbewHjJrouRi0NIYDqj xJ5JF9hBHAmBflaJ96c/snUxcgA5MRLnfzpAmJUSJ39adDFyAtVrSNy+2cgOYU9kkpizQBzEZ hPQlmh7vYsVxBYRUJK4t2oyE4jNLHCWUeJsnymILSzgINF1/R8LyEgWAVWJ18v8QcK8As4S53 bsARspISAncXn6AzYQm1PAReLN5unMEKucJd4tPsk+gZF/ASPDKkaN4tSistQiXUMzvaSizPS MktzEzBxdQwNTvdzU4uLE9NScxKRiveT83E2MwNBhAIIdjOdPex5ilORgUhLldePwDhfiS8pP qcxILM6ILyrNSS0+xCjDwaEkwWuSB5QTLEpNT61Iy8wBBjFMWoKDR0mE1w8kzVtckJhbnJkOk TrFaMmx5fe1tUwcx+beAJLbpt5byyTEkpeflyolznswF6hBAKQhozQPbhws0i4xykoJ8zICHS jEU5BalJtZgir/ilGcg1FJmDcaZC1PZl4J3NZXQAcxAR1kds4L5KCSRISUVANjvp7eu413Bd6 ess7LvuMjfLzsO1NCqyR/0XKJzhaZNRF5izdflPVr+bcx8MyMb4s5PRYZmfI8EurK2c5s4f+H s8eu4bBmzIYH+jKbqjPzIo6c/P42Vl9wgmFqpV3CieCI3fsvN8+qNf5VELujxeqyX9Nt3h/fd jxwbu5L6PjfO8lHJWPPPGElluKMREMt5qLiRADYOK/ZrwIAAA== X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1464561475!42258198!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.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2671 invoked from network); 29 May 2016 22:37:56 -0000 Received: from mail-it0-f67.google.com (HELO mail-it0-f67.google.com) (209.85.214.67) by server-9.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 May 2016 22:37:56 -0000 Received: by mail-it0-f67.google.com with SMTP id l63so4811889ita.0 for ; Sun, 29 May 2016 15:37:56 -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=zw9N6MvX21zWr40vQABiL8tmpXnKSj0PYGhHLxCn6OQ=; b=MNcQf3wilggrN4ru3z4mP1voKlif4MRplNQH96WmbKDlRaaHf4rwpL7TYw5qQPvbQ9 h1NwLF93XARzGHrvLriyY0F79z+s4kjAbsbKoazKjvj0lhja+Xf2r+ieMYS2UoGBXFjl Pd3B8/RIf+zBM93ayWBFE6YvMbE0SNgjnn26jdyWiEWudr0DOJwwIWq6v/WpPpPdLvEW ZxeLNnPJk+EOwyQYogQ2iqlMrEB+NeqBJUBASfelFVjS/GgF4xKm6thPo/ur9ooVAN4k dR3l83BK5QKt6OmpBxgwPFUGhraF12AiOdqx098nuLJzpTazEJwcqZwAdbRxjL2/7fEe VnVA== X-Gm-Message-State: ALyK8tImVG1l+o1a2Xlff47Qb/MrS59cmOFwl46802b+7MrO8zwnzZlqiH+wYuF4G0/ezA== X-Received: by 10.36.44.200 with SMTP id i191mr5244426iti.99.1464561475038; Sun, 29 May 2016 15:37:55 -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 xo3sm6222165igc.22.2016.05.29.15.37.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 May 2016 15:37:53 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Sun, 29 May 2016 16:37:05 -0600 Message-Id: <1464561430-13465-3-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464561430-13465-1-git-send-email-tamas@tklengyel.com> References: <1464561430-13465-1-git-send-email-tamas@tklengyel.com> Cc: Jun Nakajima , Andrew Cooper , Tamas K Lengyel , Razvan Cojocaru , Jan Beulich Subject: [Xen-devel] [PATCH v4 3/8] 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: Jan Beulich Cc: Andrew Cooper Cc: Razvan Cojocaru 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 7bf6a36..c4089be 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; @@ -3722,7 +3722,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 56c5514..8b41b56 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; struct arch_domain *ad = &curr->domain->arch; @@ -87,8 +88,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; @@ -96,14 +97,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 3acf1ab..081aef1 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 @@ -2477,10 +2477,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); @@ -3393,8 +3393,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 ) { @@ -3721,7 +3721,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: