From patchwork Tue Aug 1 09:46:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Stefan ISAILA X-Patchwork-Id: 9874025 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 7F03B60365 for ; Tue, 1 Aug 2017 09:55:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66F2428675 for ; Tue, 1 Aug 2017 09:55:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BCB528699; Tue, 1 Aug 2017 09:55:42 +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 EB2B628695 for ; Tue, 1 Aug 2017 09:55:41 +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 1dcTrb-0004Kv-HW; Tue, 01 Aug 2017 09:53:19 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcTku-0003Rs-St for xen-devel@lists.xen.org; Tue, 01 Aug 2017 09:46:25 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id B0/9F-02181-0FD40895; Tue, 01 Aug 2017 09:46:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkkeJIrShJLcpLzFFi42KJPp7RqvvetyH S4MRHVYslHxezODB6HN39mymAMYo1My8pvyKBNWPrkXusBc1cFT2Xp7I0MD5g72Lk5GAWsJbo /dfM2MXIxcEi0Mwi0bqukQ3C+cks8evhZjaQKiEBd4lZ23eAVQkJzGeU6H+8jgUi4SaxbcptF ojEUkaJD0e+MIIk2AQMJF59/QZmiwhIS1z7fJkRYl+cxJnGa8wgtrBAgMSR00+YQGwWAVWJ15 9+gA3lBdq2ZuVLsBoJATmJm+c6mScw8i1gZFjFqFGcWlSWWqRrZKCXVJSZnlGSm5iZo2toYKy Xm1pcnJiempOYVKyXnJ+7iREYLPUMDIw7GJtP+B1ilORgUhLlVeypjxTiS8pPqcxILM6ILyrN SS0+xCjDwaEkwXvFpyFSSLAoNT21Ii0zBxi2MGkJDh4lEV5LkDRvcUFibnFmOkTqFKMux6sJ/ 78xCbHk5eelSonzHgcpEgApyijNgxsBi6FLjLJSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5j4 JM4cnMK4Hb9AroCCagIyRLa0GOKElESEk1MKocZ5gyVYNPPfOS78btAlc/LVVlPH/SV8ct6Zb NLf1HdZs2yt65WpByyrl257r9cy8LLWedI5ck//tgwKaccu/wuYcS1s9ofb/1H1eF6M1zLyW8 S18uY3qTH6J+7ocZt7N/zGWDR8nc3K7/zRt59UW41VZe+Hp2eqd97pqzrjpWLeHfRW48PaTEU pyRaKjFXFScCACtnyqgnAIAAA== X-Env-Sender: aisaila@bitdefender.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1501580783!108054354!1 X-Originating-IP: [91.199.104.133] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36050 invoked from network); 1 Aug 2017 09:46:23 -0000 Received: from mx02.bbu.dsd.mx.bitdefender.com (HELO mx02.buh.bitdefender.com) (91.199.104.133) by server-3.tower-31.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 1 Aug 2017 09:46:23 -0000 Comment: DomainKeys? See http://domainkeys.sourceforge.net/ DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=cqvPspgMXURyIR2xWoSiRMxofj6s3XPcyhTsZlqXknszMIFNGXcOYTZ3vPdaP+pxjpoaSg7GB2vpNAi2kG5xDX/KZemFLAEnoRNvSMKhKDmH3wohKJMmgYmTs5z2XZ/0HJi3uBS/D+4gJLbdKNAcVFXZFlJ4z2zU/uXBFe/qavoZ+emaJBedq+vpX1B9pkZpIpt0FVBOSqaYteKzXvnSkqrTj+5pbCpvhxPgCM9BaRY6NyUSJ1GUCjrtr2JXPrRBCmCYgksgut+kW81S+fKKDeoUKrjh+gVCMmbLyK+JZc/XBE6ZhaQSFPwIltARKLtAIFs5KZ6VOw7Wu/51HSiH4w==; h=Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer; DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bitdefender.com; h=from:to :cc:subject:date:message-id; s=default; bh=CDjsq9Jd70bRfmBduTYYG Rm27Gc=; b=AADZ5rmc8obAYDN9AH55pBwLLpZ3rZyD20FeunuBUlW9qb+gXh3m6 gV0+ZMydmlUDl1oXUTt1NKwCQEHLMJUHhujIMmqflnyTWBqGXikTftR+FaNo+MBp Gdpb8vHdngfa6i5Zq9NHIXfT4KfWky2VaQsst6up7+f6iN0QNsN/hMEcLKfq+qvI WJBkNsLV47pf9Pk3FjSq/hgXGkGbD75GLJDxMtNDus6FHRnz+MZI+jEg4fcJ6fRg A6xlEnWRNBNtm+Sj2sUiDz9C5Y0dVAm7Pqa2/HwMfDXfgyR3sL1/4gBRJmP/HPt0 SBP26AyKWuOMMKNzniiRuYi7q1FYIy8vQ== Received: (qmail 24845 invoked from network); 1 Aug 2017 12:46:22 +0300 Received: from mx01robo.bbu.dsd.mx.bitdefender.com (10.17.80.60) by mx02.buh.bitdefender.com with AES128-GCM-SHA256 encrypted SMTP; 1 Aug 2017 12:46:22 +0300 Received: (qmail 4781 invoked from network); 1 Aug 2017 12:46:22 +0300 Received: from unknown (HELO aisaila-Latitude-E5570.dsd.bitdefender.biz) (10.10.195.54) by mx01robo.bbu.dsd.mx.bitdefender.com with SMTP; 1 Aug 2017 12:46:22 +0300 From: Alexandru Isaila To: xen-devel@lists.xen.org Date: Tue, 1 Aug 2017 12:46:16 +0300 Message-Id: <1501580776-13404-1-git-send-email-aisaila@bitdefender.com> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Tue, 01 Aug 2017 09:53:18 +0000 Cc: Alexandru Isaila , andrew.cooper3@citrix.com, jbeulich@suse.com Subject: [Xen-devel] [PATCH v2] x86/hvm: Allow guest_request vm_events coming from userspace 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 Allow guest userspace code to request that a vm_event be sent out via VMCALL. This functionality seems to be handy for a number of Xen developers, as stated on the mailing list (thread "[Xen-devel] HVMOP_guest_request_vm_event only works from guest in ring0"). This is a use case in communication between a userspace application in the guest and the introspection application in dom0. Signed-off-by: Alexandru Isaila --- Changes since V1: - Added Fallthrough check on mode == 2 --- xen/arch/x86/hvm/hypercall.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index e7238ce..1c067c3 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -152,9 +152,15 @@ int hvm_hypercall(struct cpu_user_regs *regs) { case 8: eax = regs->rax; + if ( eax == __HYPERVISOR_hvm_op && + regs->rdi == HVMOP_guest_request_vm_event ) + break; /* Fallthrough to permission check. */ case 4: case 2: + if ( mode != 8 && eax == __HYPERVISOR_hvm_op && + regs->ebx == HVMOP_guest_request_vm_event ) + break; if ( unlikely(hvm_get_cpl(curr)) ) { default: