From patchwork Sun May 29 22:37:03 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: 9139999 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 14C7760757 for ; Sun, 29 May 2016 22:40:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 077D11FF29 for ; Sun, 29 May 2016 22:40:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F04D228188; Sun, 29 May 2016 22:40:03 +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 786581FF29 for ; Sun, 29 May 2016 22:40:03 +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 1b79LF-000411-UP; Sun, 29 May 2016 22:37:53 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b79LE-00040v-LO for xen-devel@lists.xenproject.org; Sun, 29 May 2016 22:37:52 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id DF/E0-19610-F3F6B475; Sun, 29 May 2016 22:37:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeJIrShJLcpLzFFi42K5GHr1oK59vne 4wd6/rBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a/W/cYC77pV9w/sJWtgfGpWhcjJ4eQwAxG idd/8roYuTgkBN6xSKx+to8RJCEhECPxYOdeNgi7QuLkhW9MEA0aErdvNrKDNAgJTGSSOD73A ytIgk1AW6Lt9S4wW0RASeLeqslMIEXMAvMZJb4dXccOkhAW8JT4OeMxC4jNIqAqceLXObA4r4 CzRFt/BzPENjmJy9MfsE1g5F3AyLCKUb04tagstUjXUC+pKDM9oyQ3MTNH19DQRC83tbg4MT0 1JzGpWC85P3cTIzAgGIBgB+PRTudDjJIcTEqivG4c3uFCfEn5KZUZicUZ8UWlOanFhxhlODiU JHiv5QLlBItS01Mr0jJzgKEJk5bg4FES4eXPA0rzFhck5hZnpkOkTjEac2z5fW0tE8e2qffWM gmx5OXnpUqJ8x4EmSQAUppRmgc3CBYzlxhlpYR5GYFOE+IpSC3KzSxBlX/FKM7BqCTM+whkCk 9mXgncvldApzABnWJ2zgvklJJEhJRUA2NHJfO92ybcx079bXvsxTUzK5FDPnuDdmLPv/+rRIw dDTd8VO9uP6Gp0S563tHyv9abCrV7jx0WCX9nffjxs5VN0Q3TggXyKwqFpkjlnvW7vmWPu0Nr 3ZakWV7HLFujbkYqyz73fSwZ/yhuUZ/u8sS8L2KPbhV8UmJ32K2+ftauqSwVq2TvOCmxFGckG moxFxUnAgBwXLJ2lAIAAA== X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1464561469!44589330!1 X-Originating-IP: [209.85.213.193] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28848 invoked from network); 29 May 2016 22:37:50 -0000 Received: from mail-ig0-f193.google.com (HELO mail-ig0-f193.google.com) (209.85.213.193) by server-13.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 May 2016 22:37:50 -0000 Received: by mail-ig0-f193.google.com with SMTP id l10so4457283igk.0 for ; Sun, 29 May 2016 15:37:50 -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=u2uJWIVKUShplE57//uIhvkMSA/+Lx6gARHqYdimPmo=; b=Hw5CaVSnkdPTOIgq4uxBcBiTUA8NYV0wo7pviKr+0qPrWZCFKTqS/m3CTnwSuGD6rl Ouznao/rlVaebkqSmkwC9IqBjnYOjNkKB3mkQeNWb2Z5oxeNJKuOsVaHwFYfzYR0ll/1 vSPVzFFroaigiRwXIHuCkKFonVICp1d3hlhNFFDZYAhTAONufw4tgXyIoLQQ24RrCvr5 W62QJrQhSdSHAgFqjF3gsG9xGF7sYLet189kjCdRrs9U5mSgBT0gX7hYx7Fsy2LvzojV 8u+XzS6d0XxEOmkSjXR7u9Qxpa6k9pDclq7OCU3kKLhrBUcHxQQzH7a039HonIoywaCg EYkw== X-Gm-Message-State: ALyK8tK5VQOEj4OPhSGtMX2VdeFtrDYpPrSYB9+JvZUSXel5JoDJt39bhFNdklW4kOvczg== X-Received: by 10.50.118.97 with SMTP id kl1mr3394447igb.29.1464561469604; Sun, 29 May 2016 15:37:49 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 May 2016 15:37:48 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Sun, 29 May 2016 16:37:03 -0600 Message-Id: <1464561430-13465-1-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 Cc: Julien Grall , Tamas K Lengyel , Stefano Stabellini , Jan Beulich Subject: [Xen-devel] [PATCH v4 1/8] 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 --- 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__ */