From patchwork Thu Jun 2 22:52:26 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: 9151223 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 B304C60751 for ; Thu, 2 Jun 2016 22:54:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5CF526D19 for ; Thu, 2 Jun 2016 22:54:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A92A28330; Thu, 2 Jun 2016 22:54:52 +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 D90C626D19 for ; Thu, 2 Jun 2016 22:54:51 +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 1b8bTv-00007t-19; Thu, 02 Jun 2016 22:52:51 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8bTt-00006R-P1 for xen-devel@lists.xenproject.org; Thu, 02 Jun 2016 22:52:49 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 56/5C-30266-1C8B0575; Thu, 02 Jun 2016 22:52:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGIsWRWlGSWpSXmKPExsVyMfSak+6BHQH hBkc/s1h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkrOnuYCx5JVFzf0sHewLhGoIuRi0NIYDqj xK1PW5m7GDk5JAT6WSWOHBeDsGMkPp7bxQJhV0psW/mAFcQWEtCQuH2zkR3CnsgkcWRqDYjNJ qAt0fZ6F1iNiICSxL1Vk5m6GDk4mAWCJfr+cIKEhQWcJW4/nQhWwiKgKnFo4V2w8bxA8UmbX0 CdICdxefoDNhCbU8BF4n7HJai1zhILn15nnMDIv4CRYRWjenFqUVlqka6RXlJRZnpGSW5iZo6 uoYGZXm5qcXFiempOYlKxXnJ+7iZGYOgwAMEOxmV/nQ4xSnIwKYnyMsYGhAvxJeWnVGYkFmfE F5XmpBYfYpTh4FCS4A3cDpQTLEpNT61Iy8wBBjFMWoKDR0mEt3kbUJq3uCAxtzgzHSJ1itGYY 8vva2uZOLZNvbeWSYglLz8vVUqc1wZkkgBIaUZpHtwgWHRdYpSVEuZlBDpNiKcgtSg3swRV/h WjOAejkjCvCMgUnsy8Erh9r4BOYQI6peCRP8gpJYkIKakGRo/+j6Hehx1ux9T7RggYSJmo7Eo 84/siKPHoxbsrk/tkuVJZ8p49m/XobPHnPf/FWKxYlvDNC1ugH9K0Kuplh7bYNa1rV4NuHDbU +Ovst0Dy1NP41YuiLvZ1NbrWHdjHe7nHXOG8SVXM/V/mhxpOty/xOJkh4d3+ZPfqBfNCuGyZO f5vKPhposRSnJFoqMVcVJwIAHADnnapAgAA X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1464907967!17132016!1 X-Originating-IP: [209.85.214.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7881 invoked from network); 2 Jun 2016 22:52:47 -0000 Received: from mail-it0-f66.google.com (HELO mail-it0-f66.google.com) (209.85.214.66) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 2 Jun 2016 22:52:47 -0000 Received: by mail-it0-f66.google.com with SMTP id k76so5711895ita.1 for ; Thu, 02 Jun 2016 15:52:47 -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=4yfO2lT3hb8XKEZZtSEkR3R0YBUvPHgJ+t+x8RMugYA=; b=Eq90QpVkkyuMX2hlD5WbKu99TAp2NqMlnl2pqmsZvXHvvJahpfnv/BCoSm0S6DvbJf Kj1pHyzwixnJe7WNP7tB5zTNldxjOk7I9mCfEe/tMuzEG0CpBP06W82bbrrmW1uF8o+F 0Tc8jn0UcPCKUpZigYdxR6cCfYahgU09bb6z6UBOSTR35J/3IBb2lYjkFqIIb0tEV7AM ReaqptE9CvWqCld1tMPidE7rnX4ceYJn30qx8d6YtJoVZkcPm2AO/kdRUtySlJtx5gXm PFnx8pDW9EzZQEutnlUSJssrv2lqQgrGU19tSLaUPrpi4QOt9+gEdX+QRgZlc6bpDXM8 +H+w== X-Gm-Message-State: ALyK8tK8dgu1xNTKhV0JMpjhzXi2AnfWLrvNnd0SOTJLd8Y1ef8+KtzuQzV8iBL2oFIlzw== X-Received: by 10.36.33.196 with SMTP id e187mr6248554ita.30.1464907966681; Thu, 02 Jun 2016 15:52:46 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 15:52:45 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Thu, 2 Jun 2016 16:52:26 -0600 Message-Id: <1464907946-19242-9-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: Tamas K Lengyel , Ian Jackson Subject: [Xen-devel] [PATCH v5 9/9] 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 e615476..e467c48 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); }