From patchwork Fri Apr 29 18:07:29 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: 8984501 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ECDFBBF29F for ; Fri, 29 Apr 2016 18:10:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E367A201CE for ; Fri, 29 Apr 2016 18:10:03 +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 C6EAE201E4 for ; Fri, 29 Apr 2016 18:10:02 +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 1awCpK-0005M3-PX; Fri, 29 Apr 2016 18:07:42 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1awCpJ-0005Lx-8T for xen-devel@lists.xenproject.org; Fri, 29 Apr 2016 18:07:41 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id 91/5B-02869-CE2A3275; Fri, 29 Apr 2016 18:07:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeJIrShJLcpLzFFi42K5GHp/g+7rRcr hBsePaFl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBm7+g+xFvwyqJi56yZzA+Nd9S5GLg4hgVmM EmfmtLOAOBIC71gkuibMYexi5ARyYiRWrG9kgbCrJR697gGzhQQ0JG7fbGSH6J7EJHFr13E2k ASbgLZE2+tdrCC2iICSxL1Vk5lAipgF5jJJ9O0/DjZVWMBTYtHyG2CTWARUJfpfTWEGsXkFnC XWnbkNtVlO4vL0B2wTGHkXMDKsYtQoTi0qSy3SNTTRSyrKTM8oyU3MzNE1BHJzU4uLE9NTcxK TivWS83M3MQKDop6BgXEH4/fTnocYJTmYlER5r+oqhwvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS 4J2zECgnWJSanlqRlpkDDE+YtAQHj5II7zeQNG9xQWJucWY6ROoUozHHlt/X1jJxbJt6by2TE Etefl6qlDjvZ5BSAZDSjNI8uEGwuLnEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZj3GsgUns y8Erh9r4BOYQI6RWCTIsgpJYkIKakGxkNzzi5WXbSrV2J7i9ZiD5+LuhbqK7nvno/c7mJxzGr /ahHVFrUQz6f1PNOCL5/Oyd7p/3tJ+kXlklM95o4PDn3OSL9uE3uwK++NyLt1b9axyzrlT85T sJCcHye4LpYlq+PEhuO5b6cb6/Kts5Nq9VmSdzbj2Y/UL4ueWjgtCjn1QETxSZylsBJLcUaio RZzUXEiANbllkeWAgAA X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1461953258!34974213!1 X-Originating-IP: [209.85.223.176] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59725 invoked from network); 29 Apr 2016 18:07:39 -0000 Received: from mail-io0-f176.google.com (HELO mail-io0-f176.google.com) (209.85.223.176) by server-8.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Apr 2016 18:07:39 -0000 Received: by mail-io0-f176.google.com with SMTP id d62so115452451iof.2 for ; Fri, 29 Apr 2016 11:07:39 -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; bh=jO57xk5zW5IpVMF9NbqCfsx2sLvdY3JZwq4bNC+6zAs=; b=PW1uaqQXe47gX37JPIOu1y2+DAnzdUQHGoKS6ovdgnua6mTcNiPN10AvsvFQ4S7maM Ay31Ms4iyrX+cNA5paSnvnBj/3y+yjInSRwUuUOpAGpTbxKV9xGjHS1m9QFAfBKBBWyz KfYI5LaesNH4+PpXlDcAcUFyfhHNdmUrZhSknZnWFr4ouz8WP3O0+3o6AMGBGttvktCW nPtYDEhjNSTWYu3ddCut3nJg6tsIXDkT6pE6fcDUvmttocE9JDcr4upL6rzNFK4Tp/vI hP11fpB8Gy8QWwUTYW02vMVidql9388//FD8oCD4uj5V8TzQr30Zp5ti16REf4zdwaw4 NQQQ== X-Gm-Message-State: AOPr4FU/TOB1DXd0CCQc9dRoZZiQ3qeEVwJAhfQaI3y46e3yyxv3SEuB+pWFEo1CqLDNZw== X-Received: by 10.107.131.136 with SMTP id n8mr26992809ioi.132.1461953258153; Fri, 29 Apr 2016 11:07:38 -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 k33sm10721589iod.44.2016.04.29.11.07.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Apr 2016 11:07:36 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Fri, 29 Apr 2016 12:07:29 -0600 Message-Id: <1461953253-32043-1-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 Cc: Tamas K Lengyel , Keir Fraser , Razvan Cojocaru , Andrew Cooper , Julien Grall , Stefano Stabellini , Jan Beulich Subject: [Xen-devel] [PATCH v2 1/5] 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-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 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 --- Cc: Razvan Cojocaru Cc: Keir Fraser Cc: Jan Beulich Cc: Andrew Cooper 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 0954b59..446b2af 100644 --- a/xen/include/asm-x86/monitor.h +++ b/xen/include/asm-x86/monitor.h @@ -50,4 +50,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__ */