From patchwork Thu Jun 2 22:52:19 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: 9151225 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 7B83960751 for ; Thu, 2 Jun 2016 22:54:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E08026D19 for ; Thu, 2 Jun 2016 22:54:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62F2328330; Thu, 2 Jun 2016 22:54:53 +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 CA2AD26D19 for ; Thu, 2 Jun 2016 22:54:52 +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 1b8bTg-0008T7-TZ; Thu, 02 Jun 2016 22:52:36 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8bTf-0008T1-HV for xen-devel@lists.xenproject.org; Thu, 02 Jun 2016 22:52:35 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 53/C8-03501-2B8B0575; Thu, 02 Jun 2016 22:52:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRWlGSWpSXmKPExsVyMfSas+6mHQH hBm//M1t83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBn/bt1jLPimX3H/wFa2Bsanal2MXBxCAjMY JS5MeMgM4kgI9LNKnDl+nqmLkRPIiZH41DgDyi6TWL18NyuILSSgIXH7ZiM7RPdEJomrp9ewg STYBLQl2l7vAisSEVCSuLdqMhNIEbPAfEaJb0fXsYMkhAU8JV63r2YEsVkEVCV2H13CAmLzCj hLzOm9xAqxTU7i8vQHYEM5BVwk7ndcgtrsLLHw6XXGCYz8CxgZVjGqF6cWlaUW6RrrJRVlpme U5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEhhADEOxg3PvP6RCjJAeTkigvY2xAuBBfUn5K ZUZicUZ8UWlOavEhRhkODiUJXtHtQDnBotT01Iq0zBxgMMOkJTh4lER4m7cBpXmLCxJzizPTI VKnGI05tvy+tpaJY9vUe2uZhFjy8vNSpcR5z4KUCoCUZpTmwQ2CRdklRlkpYV5GoNOEeApSi3 IzS1DlXzGKczAqCfOKgNzDk5lXArfvFdApTECnFDzyBzmlJBEhJdXAOL3+okao3Z2PsS0rO70 PHDBdc2N2k/S7vAw/9bIdXA+/Hrcuc/6r8j3GKti54Drr7y3thmzzVe983mlSda585VORaZPL z/7K2naAefevx5nTz66/mVo7fd77/U2X3X+H/06er2RQqdzwyzo70WuZZs3+BR6dk5se6K1a1 tdauNA3W/V29drrE5VYijMSDbWYi4oTAZqIDcetAgAA X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1464907952!42997846!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 46594 invoked from network); 2 Jun 2016 22:52:33 -0000 Received: from mail-it0-f67.google.com (HELO mail-it0-f67.google.com) (209.85.214.67) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 2 Jun 2016 22:52:33 -0000 Received: by mail-it0-f67.google.com with SMTP id z123so4600341itg.2 for ; Thu, 02 Jun 2016 15:52:33 -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=u2uJWIVKUShplE57//uIhvkMSA/+Lx6gARHqYdimPmo=; b=WkPI8Lfcl4z7a58Gfv+2PYsVqf5jWB1DmKgFjADAMDu/8wexBzVtJfM7XhEX3qQZ/w dDDNoJf/BN6L4ciV4sQI3d2xNxNPZdBvNxH4u4losGoOkqDAVOtkTbdvidwZp4UUFudZ OrY+reVsKFKcxmlRTugUo6YZS5fR/Y9kIhkt2MVl5s7FZb59Xu4bAJD+CKRKwPFVPNZi /U0ubllHjkPUHric9jryb+sQ/Fj7SVBdH/Pfhur+fqKKBSadqulXFd+9XCszlthu9hZy 3qVj85YUb39vmldebyzNxV4dL9624DdSeHOH56njjJV+7eSNc2ZZUiUDWlDUrMdCAbeJ ORiQ== X-Gm-Message-State: ALyK8tLSLroiXcBa2MSAiEodlXB3cwLTZKr/gUg4njHU+BKg1DO3s9o13wgf2SUuwkFWXg== X-Received: by 10.36.19.16 with SMTP id 16mr1435370itz.76.1464907952569; Thu, 02 Jun 2016 15:52:32 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 15:52:31 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Thu, 2 Jun 2016 16:52:19 -0600 Message-Id: <1464907946-19242-2-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: Julien Grall , Tamas K Lengyel , Stefano Stabellini , Jan Beulich Subject: [Xen-devel] [PATCH v5 2/9] monitor: Rename vm_event_monitor_get_capabilities 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 The monitor_get_capabilities check actually belongs to the monitor subsystem so relocating and renaming it to sanitize the code's name and location. Mechanical patch, no code changes introduced. Signed-off-by: Tamas K Lengyel Acked-by: Andrew Cooper Acked-by: Razvan Cojocaru Acked-by: Julien Grall --- Cc: Jan Beulich Cc: Stefano Stabellini Cc: Julien Grall --- xen/arch/x86/monitor.c | 2 +- xen/common/monitor.c | 5 ++--- xen/include/asm-arm/monitor.h | 11 ++++++++++- xen/include/asm-arm/vm_event.h | 9 --------- xen/include/asm-x86/monitor.h | 23 +++++++++++++++++++++++ xen/include/asm-x86/vm_event.h | 23 ----------------------- 6 files changed, 36 insertions(+), 37 deletions(-) diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c index 1fec412..621f91a 100644 --- a/xen/arch/x86/monitor.c +++ b/xen/arch/x86/monitor.c @@ -126,7 +126,7 @@ int arch_monitor_domctl_event(struct domain *d, default: /* - * Should not be reached unless vm_event_monitor_get_capabilities() is + * Should not be reached unless arch_monitor_get_capabilities() is * not properly implemented. */ ASSERT_UNREACHABLE(); diff --git a/xen/common/monitor.c b/xen/common/monitor.c index d950a7c..7c3d1c8 100644 --- a/xen/common/monitor.c +++ b/xen/common/monitor.c @@ -24,7 +24,6 @@ #include #include #include -#include int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) { @@ -48,12 +47,12 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) if ( unlikely(mop->event > 31) ) return -EINVAL; /* Check if event type is available. */ - if ( unlikely(!(vm_event_monitor_get_capabilities(d) & (1U << mop->event))) ) + if ( unlikely(!(arch_monitor_get_capabilities(d) & (1U << mop->event))) ) return -EOPNOTSUPP; break; case XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES: - mop->event = vm_event_monitor_get_capabilities(d); + mop->event = arch_monitor_get_capabilities(d); return 0; default: diff --git a/xen/include/asm-arm/monitor.h b/xen/include/asm-arm/monitor.h index 6e36e99..3fd3c9d 100644 --- a/xen/include/asm-arm/monitor.h +++ b/xen/include/asm-arm/monitor.h @@ -39,11 +39,20 @@ int arch_monitor_domctl_event(struct domain *d, /* * No arch-specific monitor vm-events on ARM. * - * Should not be reached unless vm_event_monitor_get_capabilities() is not + * Should not be reached unless arch_monitor_get_capabilities() is not * properly implemented. */ ASSERT_UNREACHABLE(); return -EOPNOTSUPP; } +static inline uint32_t arch_monitor_get_capabilities(struct domain *d) +{ + uint32_t capabilities = 0; + + capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST); + + return capabilities; +} + #endif /* __ASM_ARM_MONITOR_H__ */ diff --git a/xen/include/asm-arm/vm_event.h b/xen/include/asm-arm/vm_event.h index 014d9ba..a3fc4ce 100644 --- a/xen/include/asm-arm/vm_event.h +++ b/xen/include/asm-arm/vm_event.h @@ -59,13 +59,4 @@ static inline void vm_event_fill_regs(vm_event_request_t *req) /* Not supported on ARM. */ } -static inline uint32_t vm_event_monitor_get_capabilities(struct domain *d) -{ - uint32_t capabilities = 0; - - capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST); - - return capabilities; -} - #endif /* __ASM_ARM_VM_EVENT_H__ */ diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h index d367099..0fee750 100644 --- a/xen/include/asm-x86/monitor.h +++ b/xen/include/asm-x86/monitor.h @@ -60,4 +60,27 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop) int arch_monitor_domctl_event(struct domain *d, struct xen_domctl_monitor_op *mop); +static inline uint32_t arch_monitor_get_capabilities(struct domain *d) +{ + uint32_t capabilities = 0; + + /* + * At the moment only Intel HVM domains are supported. However, event + * delivery could be extended to AMD and PV domains. + */ + if ( !is_hvm_domain(d) || !cpu_has_vmx ) + return capabilities; + + capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) | + (1U << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) | + (1U << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) | + (1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST); + + /* Since we know this is on VMX, we can just call the hvm func */ + if ( hvm_is_singlestep_supported() ) + capabilities |= (1U << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP); + + return capabilities; +} + #endif /* __ASM_X86_MONITOR_H__ */ diff --git a/xen/include/asm-x86/vm_event.h b/xen/include/asm-x86/vm_event.h index 0470240..026f42e 100644 --- a/xen/include/asm-x86/vm_event.h +++ b/xen/include/asm-x86/vm_event.h @@ -44,27 +44,4 @@ void vm_event_set_registers(struct vcpu *v, vm_event_response_t *rsp); void vm_event_fill_regs(vm_event_request_t *req); -static inline uint32_t vm_event_monitor_get_capabilities(struct domain *d) -{ - uint32_t capabilities = 0; - - /* - * At the moment only Intel HVM domains are supported. However, event - * delivery could be extended to AMD and PV domains. - */ - if ( !is_hvm_domain(d) || !cpu_has_vmx ) - return capabilities; - - capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) | - (1U << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) | - (1U << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) | - (1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST); - - /* Since we know this is on VMX, we can just call the hvm func */ - if ( hvm_is_singlestep_supported() ) - capabilities |= (1U << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP); - - return capabilities; -} - #endif /* __ASM_X86_VM_EVENT_H__ */