From patchwork Wed May 4 14:51:12 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: 9015461 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 CBB47BF29F for ; Wed, 4 May 2016 14:53:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF4A3203A0 for ; Wed, 4 May 2016 14:53:36 +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 765F4203A1 for ; Wed, 4 May 2016 14:53:35 +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 1axy9C-000378-FD; Wed, 04 May 2016 14:51:30 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axy9A-000371-JN for xen-devel@lists.xenproject.org; Wed, 04 May 2016 14:51:28 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id F2/2F-07120-F6C0A275; Wed, 04 May 2016 14:51:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsVyMfT+Ft18Hq1 wg0MXRS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozmuwcZC17pV6zffoy9gfGOWhcjF4eQwExG iRPXjrGCOBIC71gkfm04ytLFyAnkxEg87m1khrCrJZrv7WMCsYUENCRu32xkh7AnMkn8PF8EY rMJaEu0vd7FCmKLCChJ3Fs1GayeWUBTou39a7C4sICnRMfe/YxdjBwcLAKqEida00FMXgFniU NLfSE2yUlcnv6AbQIj7wJGhlWM6sWpRWWpRbpGeklFmekZJbmJmTm6hgZmermpxcWJ6ak5iUn Fesn5uZsYgaHAAAQ7GJf9dTrEKMnBpCTKu+qLZrgQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd4I bq1wIcGi1PTUirTMHGBQwqQlOHiURHi5QdK8xQWJucWZ6RCpU4zGHFt+X1vLxLFt6r21TEIse fl5qVLivMYgpQIgpRmleXCDYNFyiVFWSpiXEeg0IZ6C1KLczBJU+VeM4hyMSsK8MSBTeDLzSu D2vQI6hQnolPdzNUFOKUlESEk1MC5/8uPvH0m38NyPVx7k/lRTWrAlSfisbbhZeansVpWXfT3 74k1TlZcVv7TylLimE2HIVHrU9tY5lmbWuklSryUMa6w/dsf6xDs9PnCQlev4v7Dvx5tPn3lW HX71efyCBRyXgnJbxJaXrWy5lvSSbceaL0lRIlv1a48oJj7WcJxdGaURVKfhocRSnJFoqMVcV JwIAClrecSRAgAA X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1462373486!12583269!1 X-Originating-IP: [209.85.223.180] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10946 invoked from network); 4 May 2016 14:51:27 -0000 Received: from mail-io0-f180.google.com (HELO mail-io0-f180.google.com) (209.85.223.180) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 May 2016 14:51:27 -0000 Received: by mail-io0-f180.google.com with SMTP id d62so56241883iof.2 for ; Wed, 04 May 2016 07:51:27 -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=v+8JKClLTH7w/YR/9dd6VdAyZEflRJzSRV+dlYvBL74=; b=mt+W/yHzGJ3SnkBM063O44w9VhHnvJocGJpnBV9l+LUsrC69utUPked+qsXrbq5ll3 d0z1ccvCdSghhH22NcfVCq5zxtJkfJsfZymVGM7wAjEaaV71UAVMzFLU4w4DbRrxp9Gx luk9yzgHGg81umbYXkz5TwZHR9JLgnnrxECpKrO767nMxOW8FOQYXzj890fkHAhA1hx3 nrGNFp0VZy2mA3JUzHK1ZP/+PjKaN8I+/r9TO5K7CuJwv+BbcqyHgt6ry4edUYbDmCBA EuJ5LZyCuKz42s636gLXFcQmStZdLENgal2yhCaJggx5rr8tnIcbcc2aZ4DbaMhOi1BY Jdvw== X-Gm-Message-State: AOPr4FWXJpwgk2+gyfomM3uj57kX7zfKy50wkkO5G33qe5yce2t/I4PJatbNUw+9ItBTvw== X-Received: by 10.107.131.12 with SMTP id f12mr11338319iod.126.1462373485911; Wed, 04 May 2016 07:51:25 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 07:51:24 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Wed, 4 May 2016 08:51:12 -0600 Message-Id: <1462373480-20206-1-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 Cc: Tamas K Lengyel Subject: [Xen-devel] [PATCH v3 1/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-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 --- Jan Beulich Stefano Stabellini 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__ */