From patchwork Thu Jun 2 22:52:21 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: 9151229 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 A237360751 for ; Thu, 2 Jun 2016 22:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 941CD26D19 for ; Thu, 2 Jun 2016 22:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87CCC28332; Thu, 2 Jun 2016 22:54:58 +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 BB6E626D19 for ; Thu, 2 Jun 2016 22:54:57 +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 1b8bTl-0008UL-Ft; Thu, 02 Jun 2016 22:52:41 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8bTj-0008Tp-KN for xen-devel@lists.xenproject.org; Thu, 02 Jun 2016 22:52:39 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 81/05-15969-6B8B0575; Thu, 02 Jun 2016 22:52:38 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsVyMfSao+62HQH hBvdXcFt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnrNmoV/PavaHgzgamB8bJdFyMXh5DAdEaJ f6u/soM4EgL9rBL7D71i62LkBHJiJJYdmc0EYVdINJ/bzwJiCwloSNy+2cgO0T2RSeJg+1tmk ASbgLZE2+tdrCC2iICSxL1Vk8GamQVqJVZvnMgOYgsLOEhs3X8azGYRUJVovdgGVs8r4CyxrO U51DI5icvTH4AdwSngInG/4xIrxGJniYVPrzNOYORfwMiwilGjOLWoLLVI19BYL6koMz2jJDc xM0fX0MBYLze1uDgxPTUnMalYLzk/dxMjMIAYgGAH47btnocYJTmYlER5GWMDwoX4kvJTKjMS izPii0pzUosPMcpwcChJ8IpuB8oJFqWmp1akZeYAQxkmLcHBoyTC27wNKM1bXJCYW5yZDpE6x WjJseX3tbVMHMfm3gCS26beW8skxJKXn5cqJc5rAzJPAKQhozQPbhws3i4xykoJ8zICHSjEU5 BalJtZgir/ilGcg1FJmFcEZApPZl4J3NZXQAcxAR1U8Mgf5KCSRISUVAOjxUSPupB/D37x/D2 6Z+H/wnRD/0u7rz6WXvjjVgRr8KZY/gBJkZBjaspr5LZ7B2vOXn+ygSmsoC2D+2qKnJng7CKH RcGLP99ZsP6H0UtlM31ftZJV/vJLyxcqmwV+irDxKW5MXK3vWZHkIvBIT5P7vorXzLW7+Ray7 otTNMm5opBls/9AtoMSS3FGoqEWc1FxIgDpB2/fsgIAAA== X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1464907956!6818091!1 X-Originating-IP: [209.85.214.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24520 invoked from network); 2 Jun 2016 22:52:37 -0000 Received: from mail-it0-f65.google.com (HELO mail-it0-f65.google.com) (209.85.214.65) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 2 Jun 2016 22:52:37 -0000 Received: by mail-it0-f65.google.com with SMTP id k76so5711543ita.1 for ; Thu, 02 Jun 2016 15:52: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=XStV84ZRrxC3PCzMhJK6WXdXu57/QuA4zd9PHHUANZE=; b=JbmvZ4RJPFjBS3T5m6zUkD6JkVuFHj75PXM+xwmYL6tYVGGeJfuTeX1EXTpAj/SCXe y/DUZjxFC06kC1UA1AgfDgpfoDzvMxMQUl5ei5j15C/pzD7tpJ9Sdh0uc2i+BEzufqdq gcI/zHIfL9LIGDbgi4E3Nt8YbfWF/15IcTzR2uTXa8OYIHUa0eNO4AGnhvvQKQnwwWXi GIiOARgPOuNMVr41G7ImW0wYh+G4i6swopwI06tXWwVHQaMQ8Wj47l2ZTyKQSvMkDoKH FtrJa4La5xpn/K1HPC5X0VpzxE3w4VgQaJ9SXu6QDciYB9WidhOEd35Z8ypPrUbav7u+ RWAA== X-Gm-Message-State: ALyK8tKkk5zcXhumoOlxGEd5SCLiSouPN+RSVPCKW3d1G+iKphrlXcJfOT6i7S9J/DJgvA== X-Received: by 10.36.65.138 with SMTP id b10mr6336014itd.77.1464907956493; Thu, 02 Jun 2016 15:52: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 t91sm1484649ioi.26.2016.06.02.15.52.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 15:52:35 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Thu, 2 Jun 2016 16:52:21 -0600 Message-Id: <1464907946-19242-4-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464907946-19242-1-git-send-email-tamas@tklengyel.com> References: <1464907946-19242-1-git-send-email-tamas@tklengyel.com> Cc: Andrew Cooper , Tamas K Lengyel , Jun Nakajima Subject: [Xen-devel] [PATCH v5 4/9] 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 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 5772c6b..764c3e8 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 097d97c..4981574 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 rc = - hvm_event_breakpoint(regs->eip, - HVM_EVENT_SOFTWARE_BREAKPOINT); + hvm_monitor_breakpoint(regs->eip, + HVM_MONITOR_SOFTWARE_BREAKPOINT); if ( !rc ) { @@ -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: