From patchwork Wed May 4 14:51:18 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: 9015601 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2095F9F30C for ; Wed, 4 May 2016 14:54:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE2DC203A1 for ; Wed, 4 May 2016 14:54:50 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 885BC203A0 for ; Wed, 4 May 2016 14:54:49 +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 1axyAS-0003ai-SB; Wed, 04 May 2016 14:52:48 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axyAR-0003aL-2V for xen-devel@lists.xenproject.org; Wed, 04 May 2016 14:52:47 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 31/CA-17285-EBC0A275; Wed, 04 May 2016 14:52:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsVyMfTqGt0qHq1 wgzevtC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owjExYwFTz3r+jZPpOtgfGSXRcjF4eQwCxG iavdk5hBHAmBflaJb9u/AzmcQE6MxIHZKxgh7EqJHzNes4PYQgIaErdvNrJDdE9kkljSupUNJ MEmoC3R9noXK4gtIqAkcW/VZCYQm1ngLKPE2T5TEFtYwEFi/e9tYENZBFQlHu25zwJi8wo4S0 yavw1qsZzE5ekPwGZyCrhINB1oZoNY7Cyxa+4T5gmM/AsYGVYxqhenFpWlFuma6CUVZaZnlOQ mZuboGhqY6uWmFhcnpqfmJCYV6yXn525iBAYQAxDsYLzV53yIUZKDSUmUd9UXzXAhvqT8lMqM xOKM+KLSnNTiQ4wyHBxKErwR3FrhQoJFqempFWmZOcBQhklLcPAoifByg6R5iwsSc4sz0yFSp xgtObb8vraWiePY3BtActvUe2uZhFjy8vNSpcR5jUEaBEAaMkrz4MbB4u0So6yUMC8j0IFCPA WpRbmZJajyrxjFORiVhHljQKbwZOaVwG19BXQQE9BB7+dqghxUkoiQkmpg1F3bV+pqsTtI8XR Ac2PBufhrzfxMs5flKTum/JStv9nKt3ficqdZK6feyL3afq9+U+SvCe6veWzNJl14oZ+lnrjl eopyv+2PDUwW/sq94p9WeufZsbOq7uD7LKT4/OXhL9nbisMjMs36t79aFM93WOH2SuuZz/eXL DYrcm38+ERe08u9QWKfEktxRqKhFnNRcSIACAVMsrICAAA= X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1462373497!37964434!1 X-Originating-IP: [209.85.213.172] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 65493 invoked from network); 4 May 2016 14:51:38 -0000 Received: from mail-ig0-f172.google.com (HELO mail-ig0-f172.google.com) (209.85.213.172) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 May 2016 14:51:38 -0000 Received: by mail-ig0-f172.google.com with SMTP id u10so149880040igr.1 for ; Wed, 04 May 2016 07:51:38 -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=bTJUburXBPMKFzj8Rl3JByzKSods8n5ifeE5mO1XGP4=; b=L/KzhAYeD07S0RRH3oWo4Gx0+4p/kcYVZRM2ojh4NGtGF/fgDGAL0fZmlIMKABab98 knj1204z1RJYKeTl4xlCQ9IGABgjV0N8WKgi8rIyTExnm9tHxVMTlWfy8NkiHMIBHlec RQfj0TYnJ3KMNoC5vtRLVxlD9+m7zXyYxVHaws6GMzGIQawGudfz+YoKf8ClJ/GR+TQI 5EZuqgZf7OyzDv2AQjJW32VaC2yGDHqQmBhOvatStfsyVKdUGl7MgwQrsaOTwjctaERp 7Io3bwO7wfhlEvgGUfZkStQQJfGekOvNFaHzZ7SO39RyohadTT8fS/ejWKfyHKXcwDVH 5mew== X-Gm-Message-State: AOPr4FVwpl49tsNwsMihaKN3qID6kfc1o86/tjWKLqis7TXIOz5RsUgXUhFFoGLjZaw89Q== X-Received: by 10.50.40.234 with SMTP id a10mr35435088igl.37.1462373497387; Wed, 04 May 2016 07:51:37 -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 u187sm1563597iod.3.2016.05.04.07.51.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 07:51:36 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Wed, 4 May 2016 08:51:18 -0600 Message-Id: <1462373480-20206-7-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1462373480-20206-1-git-send-email-tamas@tklengyel.com> References: <1462373480-20206-1-git-send-email-tamas@tklengyel.com> Cc: Jun Nakajima , Andrew Cooper , Tamas K Lengyel , Razvan Cojocaru , Jan Beulich Subject: [Xen-devel] [PATCH v3 7/9] x86/hvm: 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 --- 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} (60%) 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 5d740f7..2689378 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; @@ -3712,7 +3712,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 73d0a26..19048f4 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; @@ -55,7 +56,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; @@ -89,8 +90,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; @@ -98,14 +99,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 bc4410f..476a606 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 60% rename from xen/include/asm-x86/hvm/event.h rename to xen/include/asm-x86/hvm/monitor.h index 03f7fee..1d3c668 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: