From patchwork Tue Feb 21 11:25:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 94253 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp396412qgi; Tue, 21 Feb 2017 03:28:07 -0800 (PST) X-Received: by 10.36.216.213 with SMTP id b204mr7463701itg.66.1487676487666; Tue, 21 Feb 2017 03:28:07 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id b20si20007380ioe.107.2017.02.21.03.28.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Feb 2017 03:28:07 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cg8aQ-0002if-1a; Tue, 21 Feb 2017 11:26:26 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cg8aO-0002hu-KJ for xen-devel@lists.xenproject.org; Tue, 21 Feb 2017 11:26:24 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id D2/C9-31146-FD32CA85; Tue, 21 Feb 2017 11:26:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLIsWRWlGSWpSXmKPExsXiVRusq3tfeU2 EwcGP4hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8astsuMBT3SFT0v3jE1MO4W7mLk4hASmMko 0b2xmQ3EYRGYxyzx9OgH9i5GTg4JgX5Wie5PvBB2jMT8WT9ZIexKiQdL9jKB2EICWhJHT81mh ZjUyiTx5egXoGYODjYBE4lZHRIgNSICShL3Vk0Gq2cWCJX496wNrERYIFbi9vo6kDCLgKpEx9 3NYCW8At4Sn7p2MkGskpO4ea6TGcTmFPCR+LvvJTvEWm+JaXdWsE1gFFjAyLCKUb04tagstUj XUC+pKDM9oyQ3MTNH19DATC83tbg4MT01JzGpWC85P3cTIzCoGIBgB+PO506HGCU5mJREebOl 1kQI8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCdowSUEyxKTU+tSMvMAYY3TFqCg0dJhPeIIlCat 7ggMbc4Mx0idYpRl2PXrssvmYRY8vLzUqXEectAZgiAFGWU5sGNgMXaJUZZKWFeRqCjhHgKUo tyM0tQ5V8xinMwKgnzdoJM4cnMK4Hb9AroCCagI256rAQ5oiQRISXVwDijPWf79n8L3s+p9sn p2nZAYMmD3z2bVD92RC5SFG978k3WfwZj6ckb0k/FjSs8KhbUvzzceynsECO7Tv6vG78FL15v vTRFyt/XVE44bbVwwf8lB4w9UkP2fjM+/OW0o4Z93rTjWWdX6U5LKU9Js3hf8WnRkTlVinvcU oo26Rv3lq9/duS8xSolluKMREMt5qLiRAARvmJ+sAIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-27.messagelabs.com!1487676382!78611974!1 X-Originating-IP: [74.125.83.45] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25797 invoked from network); 21 Feb 2017 11:26:23 -0000 Received: from mail-pg0-f45.google.com (HELO mail-pg0-f45.google.com) (74.125.83.45) by server-13.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 21 Feb 2017 11:26:23 -0000 Received: by mail-pg0-f45.google.com with SMTP id b129so34936775pgc.2 for ; Tue, 21 Feb 2017 03:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dVUyLnPmFnonoRCkCBBUBs+RnEM6ldsiNXVN8oZne5I=; b=ZhzBjK+/vvAxXicAh0wCNPfc3WUzRVJ5Cg01DGmZ1LwbW2UhQH+KPVpT7WQvuzK8jw o8ZLzt9699/3MiAWV1ao+LDm932HWyxI5CnX3kocDv4f7ifs7QZIxqu17nxnzFAvzk3K YYzYN1UYaJDhfK8vVZXlPSpFqtzfDqkmoejmc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dVUyLnPmFnonoRCkCBBUBs+RnEM6ldsiNXVN8oZne5I=; b=j/MbsvyTVeRp4IecvO12IDRpyBBr/11uRpHlIoWTPqx06ykUk9Ua3y31i9hkuTNYEY UZdkk/1fB+oCXRfeCku8Cgam8yDmRFmE8ed069xQECQyrFTpeO4CppsMiqQCJkNk+dMH uczqF5Ul+iU6Kib2uAXoSyo5SzSjIIc6Kx6/JOJFcAE37TSFQY2bnV5KMYkXXgxzSjzz ZWLNZ5nqRPHIUDIm3bphragDQXST0oAnvY9T+jbVweC+j2eKsdmwSd/J87FQ05ND7thp NFR5m+Juao/Q6IyhumBWmidUx5gAD+61JxJ0X84w7CTbN3s/aGAC+LVSte2+dSkPd4XL sBaQ== X-Gm-Message-State: AMke39klsXaPYv1yH0KakAC5LL7EFYpPRAVdLHw+CZoh+NZY6dYs14cZ6u2J9iLfq25MNazE X-Received: by 10.99.175.67 with SMTP id s3mr12651064pgo.185.1487676381704; Tue, 21 Feb 2017 03:26:21 -0800 (PST) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p66sm40508627pfb.88.2017.02.21.03.26.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Feb 2017 03:26:21 -0800 (PST) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 21 Feb 2017 16:55:59 +0530 Message-Id: <1487676368-22356-3-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487676368-22356-1-git-send-email-bhupinder.thakur@linaro.org> References: <1487676368-22356-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 02/11] xen/arm: vpl011: Add new hvm params in Xen for ring buffer/event setup 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" Three new HVM param handlers added for: - allocating a new VIRQ and return to the toolstack - allocating a new event channel for sending/receiving events from Xen and return to the toolstack - mapping the PFN allocted by the toolstack to be used as IN/OUT ring buffers Signed-off-by: Bhupinder Thakur --- xen/arch/arm/hvm.c | 39 +++++++++++++++++++++++++++++++++++++++ xen/include/public/hvm/params.h | 10 +++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c index d999bde..f3b9eb1 100644 --- a/xen/arch/arm/hvm.c +++ b/xen/arch/arm/hvm.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include @@ -31,6 +33,7 @@ #include #include +#include "vpl011.h" long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) { @@ -61,9 +64,45 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) if ( op == HVMOP_set_param ) { d->arch.hvm_domain.params[a.index] = a.value; + +#ifdef CONFIG_VPL011_CONSOLE + /* + * if it is a vpl011 console pfn then map it to its + * own address space + */ + if ( a.index == HVM_PARAM_VPL011_CONSOLE_PFN ) + { + vpl011_map_guest_page(d); + } +#else + /* + * if VPL011 is not compiled in then disallow setting of any + * related HVM params + */ + if ( a.index == HVM_PARAM_VPL011_CONSOLE_PFN || + a.index == HVM_PARAM_VPL011_CONSOLE_EVTCHN || + a.index == HVM_PARAM_VPL011_VIRQ ) + { + rc = -1; + goto param_fail; + } +#endif } else { +#ifndef CONFIG_VPL011_CONSOLE + /* + * if VPL011 is not compiled in then disallow setting of any + * related HVM params + */ + if ( a.index == HVM_PARAM_VPL011_CONSOLE_PFN || + a.index == HVM_PARAM_VPL011_CONSOLE_EVTCHN || + a.index == HVM_PARAM_VPL011_VIRQ ) + { + rc = -1; + goto param_fail; + } +#endif a.value = d->arch.hvm_domain.params[a.index]; rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0; } diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index 3f54a49..13bf719 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -203,10 +203,17 @@ */ #define HVM_PARAM_ACPI_IOPORTS_LOCATION 19 -/* Deprecated */ +#if defined(__arm__) || defined(__aarch64__) +#define HVM_PARAM_VPL011_CONSOLE_PFN 20 +#define HVM_PARAM_VPL011_CONSOLE_EVTCHN 21 +#define HVM_PARAM_VPL011_VIRQ 22 +#else #define HVM_PARAM_MEMORY_EVENT_CR0 20 #define HVM_PARAM_MEMORY_EVENT_CR3 21 #define HVM_PARAM_MEMORY_EVENT_CR4 22 +#endif + +/* Deprecated */ #define HVM_PARAM_MEMORY_EVENT_INT3 23 #define HVM_PARAM_MEMORY_EVENT_SINGLE_STEP 25 #define HVM_PARAM_MEMORY_EVENT_MSR 30 @@ -253,6 +260,7 @@ */ #define HVM_PARAM_X87_FIP_WIDTH 36 + #define HVM_NR_PARAMS 37 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */