From patchwork Tue Jul 5 18:37:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas Lengyel X-Patchwork-Id: 9215077 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 11BF260752 for ; Tue, 5 Jul 2016 18:40:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 073CC28119 for ; Tue, 5 Jul 2016 18:40:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFC3128179; Tue, 5 Jul 2016 18:40:18 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 87B6628119 for ; Tue, 5 Jul 2016 18:40:18 +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 1bKVET-0001AZ-LO; Tue, 05 Jul 2016 18:38:05 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKVER-00017V-NT for xen-devel@lists.xenproject.org; Tue, 05 Jul 2016 18:38:03 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id 0C/C0-30629-B8EFB775; Tue, 05 Jul 2016 18:38:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRWlGSWpSXmKPExsVyMfSai27Xv+p wg6m3ZS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyX/U+YC15KVLTcn8nUwLhZoIuRi0NIYCaj xMw9i5lBHBaBZlaJKX/esIA4EgL9rBJLnr5h7GLkBHJiJLauWMIGYVdKLD38DswWEtCUOLjhD DPEqElMEue/H2UCSbAJGElcvdoDViQioCRxb9VksDizQJTE5G/fWEFsYQFnifO/X4DFWQRUJU 68ADmDk4NXwFNi87SHUMvkJC5PfwBmcwp4SRxZ/wtqsafEnW33mScwCixgZFjFqFGcWlSWWqR rZKSXVJSZnlGSm5iZo2toaKKXm1pcnJiempOYVKyXnJ+7iREYXPUMDIw7GG9f8jvEKMnBpCTK y/KtOlyILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG/bX6CcYFFqempFWmYOMMxh0hIcPEoivIEga d7igsTc4sx0iNQpRmOOLb+vrWXi2Db13lomIZa8/LxUKXFeeZBSAZDSjNI8uEGw+LvEKCslzM vIwMAgxFOQWpSbWYIq/4pRnINRSZhXG2QKT2ZeCdy+V0CnMAGd8tMF7JSSRISUVAPjJpaV3+5 /Vd4deuab40dlS4WUFQ/Tdx6ZZc//YvFh038TLf9O2tRlumKpndyfyxdk1h3kUPmfeIb9QvFD BiZLv8XHCwzOV3R+EZ6REFTNo/IhYkfYoYIT709dn7nJiVfq9q2I5JsT3i/b/Wfira4DVfr7o s+ni9hbJxlKyP2MY5gUNivo/Wr7B0osxRmJhlrMRcWJAGaKSVy6AgAA X-Env-Sender: tamas.lengyel@zentific.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1467743881!41646639!1 X-Originating-IP: [209.85.214.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22959 invoked from network); 5 Jul 2016 18:38:02 -0000 Received: from mail-it0-f68.google.com (HELO mail-it0-f68.google.com) (209.85.214.68) by server-8.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 5 Jul 2016 18:38:02 -0000 Received: by mail-it0-f68.google.com with SMTP id h190so12430791ith.3 for ; Tue, 05 Jul 2016 11:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zentific-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5cTzS+GR5+CDHyKcqpXB5FK1V9WEHpa+fTeSW3eZxWE=; b=ju0nR3RkSqzgHEsKCM/eDI3ZwAU6kURbrSnjW8s1s7nBytaFKSbldQbfyznnoAa+Wl urF6VDI8j2TqOqZwo1HlB2V2Ciu+q8/PU3dVlNZIRgZ4g+vSoFPrkqWE225/BRpsaao1 RDBcaIGESccWY8LiKWybvnOXDcDGE9kY+x3A6R5wm7kWKGrPMlUHm8fHqLECXVyiuEBc xvQ2lwA2nJflRor0BIQDUKqaQtlkHKhFgzyDtlszKGIZoQ2PQ5t7By8QOOCUZu7Ymbde vfACdC0k/awH/KhPQ2+zO7HVpvztb07HvQYH8uckdkK5qnb+f2CpdOm3LHlxOk+eUO91 /yww== 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=5cTzS+GR5+CDHyKcqpXB5FK1V9WEHpa+fTeSW3eZxWE=; b=fc46gz4DlLlKVtPUWl2vZyi8u8qUtYsOCDq/7gKCwNmFxJiFwrBlIlk7pOgJOr+TGj vZM0bSVmcyFYkznpcaCGInG0lw/l9eeWKz52S73HbpBrZGoRxhBo64dV/a2NtmS9ofLk iMloHqcNppcg3Pt9l0fVrs+od20aF1TeZoaD48iA8K7vzRuD3D5nqwvmH8+wE07RMRqv huBbybQrFy3eP+no+8ThgOl78kPdg8SaQp4hrzGI6E6VVhEWxUFhNwji3KSwsWLz+Hy4 ajXpF0QWlfPqyb6EM7XjN34IpYFcV9LmJ0O4oFZlBR4SG+tIC/br/zhZyQyGAV0xalhU 3JIQ== X-Gm-Message-State: ALyK8tIV4aLLwEMMMrPFzpBqtL8XB7L0joy/dOUhZCf8LMq8MJWWaRunCtoW7NHYKDWSPA== X-Received: by 10.36.17.131 with SMTP id 125mr16245437itf.94.1467743880814; Tue, 05 Jul 2016 11:38:00 -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 o133sm2083760ioo.10.2016.07.05.11.37.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jul 2016 11:38:00 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Tue, 5 Jul 2016 12:37:51 -0600 Message-Id: <1467743871-9644-6-git-send-email-tamas.lengyel@zentific.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1467743871-9644-1-git-send-email-tamas.lengyel@zentific.com> References: <1467743871-9644-1-git-send-email-tamas.lengyel@zentific.com> Cc: Tamas K Lengyel , Ian Jackson Subject: [Xen-devel] [PATCH v8 6/6] tools/xen-access: add test-case for ARM SMC 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 Signed-off-by: Tamas K Lengyel Acked-by: Razvan Cojocaru Acked-by: Wei Liu --- Cc: Ian Jackson --- tools/tests/xen-access/xen-access.c | 45 ++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c index 02655d5..a04dbff 100644 --- a/tools/tests/xen-access/xen-access.c +++ b/tools/tests/xen-access/xen-access.c @@ -338,6 +338,8 @@ void usage(char* progname) fprintf(stderr, "Usage: %s [-m] write|exec", progname); #if defined(__i386__) || defined(__x86_64__) fprintf(stderr, "|breakpoint|altp2m_write|altp2m_exec|debug"); +#elif defined(__arm__) || defined(__aarch64__) + fprintf(stderr, "|privcall"); #endif fprintf(stderr, "\n" @@ -426,6 +428,11 @@ int main(int argc, char *argv[]) { debug = 1; } +#elif defined(__arm__) || defined(__aarch64__) + else if ( !strcmp(argv[0], "privcall") ) + { + privcall = 1; + } #endif else { @@ -548,6 +555,16 @@ int main(int argc, char *argv[]) } } + if ( privcall ) + { + rc = xc_monitor_privileged_call(xch, domain_id, 1); + if ( rc < 0 ) + { + ERROR("Error %d setting privileged call trapping with vm_event\n", rc); + goto exit; + } + } + /* Wait for access */ for (;;) { @@ -560,7 +577,8 @@ int main(int argc, char *argv[]) rc = xc_monitor_software_breakpoint(xch, domain_id, 0); if ( debug ) rc = xc_monitor_debug_exceptions(xch, domain_id, 0, 0); - + if ( privcall ) + rc = xc_monitor_privileged_call(xch, domain_id, 0); if ( altp2m ) { rc = xc_altp2m_switch_to_view( xch, domain_id, 0 ); @@ -716,6 +734,31 @@ int main(int argc, char *argv[]) } break; +#if defined(__arm__) || defined(__aarch64__) + case VM_EVENT_REASON_PRIVILEGED_CALL: + { + const struct vm_event_regs_arm *in_regs = &req.data.regs.arm; + struct vm_event_regs_arm *out_regs = &rsp.data.regs.arm; + bool is32bit = !!(in_regs->cpsr & PSR_MODE_BIT); + uint64_t pc; + + *out_regs = *in_regs; + + if ( is32bit ) { + pc = in_regs->arch.arm32.pc; + out_regs->arch.arm32.pc += 4; + } else { + pc = in_regs->arch.arm64.pc; + out_regs->arch.arm64.pc += 8; + } + + printf("Privileged call: pc=%016"PRIx64" (vcpu %d)\n", + pc, req.vcpu_id); + + rsp.flags |= VM_EVENT_FLAG_SET_REGISTERS; + } + break; +#endif default: fprintf(stderr, "UNKNOWN REASON CODE %d\n", req.reason); }