From patchwork Mon Apr 7 12:48:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 27895 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1B36520553 for ; Mon, 7 Apr 2014 12:50:54 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf22626692yho.5 for ; Mon, 07 Apr 2014 05:50:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=vjLSNngcHwcmG3PL/VJVVFkK21VQ3kYsMYx3p8rKyPw=; b=Xqxj77Z8/Vx+QZr26EdhTf3F0FEkpOKXBhcmJoWxyr3WBMoRYsCWgsuz9CX3yNYk0B WlzICdCKsaoUIr7WlwEif2dFVxjvQ2rZqroneFi5M6zo9NqO/njESWFjkVgbuku6DBQe YnJoi9McEkQTHAPKlWdhp5ePFx9Y8ZxCILpMY/eTezwjApwv/8vK9YbrRMpFrfB/0K5S dEpKTlHwOMWgooO09a9Ch3Zoldc8yawcxslMU+nX+DetpLG5Jp9nn5U8I9+GOwkaU1W9 e5CFwl2qC8g5pbf1ZHwZAxr0Kmx+uWr4aLijzzuHTDMH+t7iItQbPcT6y03idnIfZWD2 tRYA== X-Gm-Message-State: ALoCoQm75VuJusNtzD5mozkGAP/tbHiMDt7NnzfTpygGlvfyNWHCX9xu3z66il+Emsjg0WtMPI8W X-Received: by 10.236.29.51 with SMTP id h39mr14127669yha.45.1396875054740; Mon, 07 Apr 2014 05:50:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.66 with SMTP id h60ls1725561qge.54.gmail; Mon, 07 Apr 2014 05:50:54 -0700 (PDT) X-Received: by 10.52.90.37 with SMTP id bt5mr24937111vdb.7.1396875054624; Mon, 07 Apr 2014 05:50:54 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id q1si2089634ves.117.2014.04.07.05.50.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Apr 2014 05:50:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so5040942vcb.22 for ; Mon, 07 Apr 2014 05:50:54 -0700 (PDT) X-Received: by 10.52.34.4 with SMTP id v4mr124956vdi.42.1396875054523; Mon, 07 Apr 2014 05:50:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp159344vcv; Mon, 7 Apr 2014 05:50:54 -0700 (PDT) X-Received: by 10.229.198.2 with SMTP id em2mr2806848qcb.21.1396875054035; Mon, 07 Apr 2014 05:50:54 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id z3si6578043qcl.62.2014.04.07.05.50.53 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 07 Apr 2014 05:50:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WX8z6-0008DW-8E; Mon, 07 Apr 2014 12:49:08 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WX8z5-0008CK-2d for xen-devel@lists.xen.org; Mon, 07 Apr 2014 12:49:07 +0000 Received: from [85.158.139.211:39663] by server-7.bemta-5.messagelabs.com id E4/E0-20531-2CE92435; Mon, 07 Apr 2014 12:49:06 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1396874943!5951734!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25201 invoked from network); 7 Apr 2014 12:49:05 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 7 Apr 2014 12:49:05 -0000 X-IronPort-AV: E=Sophos;i="4.97,810,1389744000"; d="scan'208";a="117467090" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 07 Apr 2014 12:48:56 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.2.342.4; Mon, 7 Apr 2014 08:48:56 -0400 Received: from cosworth.uk.xensource.com ([10.80.16.52] helo=cosworth.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WX8yt-0006GR-W4; Mon, 07 Apr 2014 12:48:56 +0000 From: Ian Campbell To: Date: Mon, 7 Apr 2014 13:48:55 +0100 Message-ID: <1396874935-20513-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1396874925-751-1-git-send-email-ian.campbell@citrix.com> References: <1396874925-751-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: David Vrabel , Boris Ostrovsky , Ian Campbell , Stefano Stabellini Subject: [Xen-devel] [PATCH linux v2] arm: xen: implement multicall hypercall support. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: As part of this make the usual change to xen_ulong_t in place of unsigned long. This change has no impact on x86. The Linux definition of struct multicall_entry.result differs from the Xen definition, I think for good reasons, and used a long rather than an unsigned long. Therefore introduce a xen_long_t, which is a long on x86 architectures and a signed 64-bit integer on ARM. Use uint32_t nr_calls on x86 for consistency with the ARM definition. Build tested on amd64 and i386 builds. Runtime tested on ARM. Signed-off-by: Ian Campbell Cc: Stefano Stabellini Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel Reviewed-by: David Vrabel --- v2: - Typo in commit message. - Update x86 prototype for HYPERCALL_multicall for consistency (nr_calls is a uint32_t). Tested on ARM with a stupid patch: diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index b96723e..61c6b94 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -339,6 +339,36 @@ static int __init xen_pm_init(void) } late_initcall(xen_pm_init); +static int __init multicall_test(void) +{ + struct multicall_entry call[2]; + const char *str0 = "This is the first debug string\n"; + const char *str1 = "This is the second debug string\n"; + int ret; + + call[0] = (struct multicall_entry) { + .op = __HYPERVISOR_console_io, + .args[0] = CONSOLEIO_write, + .args[1] = strlen(str0), + .args[2] = (uintptr_t)str0 + }; + call[1] = (struct multicall_entry) { + .op = __HYPERVISOR_console_io, + .args[0] = CONSOLEIO_write, + .args[1] = strlen(str1), + .args[2] = (uintptr_t)str1 + }; + + ret = HYPERVISOR_multicall(call, ARRAY_SIZE(call)); + printk("MULTICALL returned %d\n", ret); + if (ret == 0) { + printk("call[0].result = %"PRI_xen_long"\n", call[0].result); + printk("call[1].result = %"PRI_xen_long"\n", call[1].result); + } + return 0; +} +late_initcall(multicall_test); + /* In the hypervisor.S file. */ EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op); EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op); fixup --- arch/arm/include/asm/xen/hypercall.h | 6 +----- arch/arm/include/asm/xen/interface.h | 2 ++ arch/arm/xen/hypercall.S | 1 + arch/x86/include/asm/xen/hypercall.h | 2 +- arch/x86/include/asm/xen/interface.h | 3 +++ include/xen/interface/xen.h | 6 +++--- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h index 7704e28..7658150 100644 --- a/arch/arm/include/asm/xen/hypercall.h +++ b/arch/arm/include/asm/xen/hypercall.h @@ -48,6 +48,7 @@ int HYPERVISOR_memory_op(unsigned int cmd, void *arg); int HYPERVISOR_physdev_op(int cmd, void *arg); int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args); int HYPERVISOR_tmem_op(void *arg); +int HYPERVISOR_multicall(struct multicall_entry *calls, uint32_t nr); static inline void MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, @@ -63,9 +64,4 @@ MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req, BUG(); } -static inline int -HYPERVISOR_multicall(void *call_list, int nr_calls) -{ - BUG(); -} #endif /* _ASM_ARM_XEN_HYPERCALL_H */ diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h index 1151188..5006600 100644 --- a/arch/arm/include/asm/xen/interface.h +++ b/arch/arm/include/asm/xen/interface.h @@ -40,6 +40,8 @@ typedef uint64_t xen_pfn_t; #define PRI_xen_pfn "llx" typedef uint64_t xen_ulong_t; #define PRI_xen_ulong "llx" +typedef int64_t xen_long_t; +#define PRI_xen_long "llx" /* Guest handles for primitive C types. */ __DEFINE_GUEST_HANDLE(uchar, unsigned char); __DEFINE_GUEST_HANDLE(uint, unsigned int); diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S index d1cf7b7..44e3a5f 100644 --- a/arch/arm/xen/hypercall.S +++ b/arch/arm/xen/hypercall.S @@ -89,6 +89,7 @@ HYPERCALL2(memory_op); HYPERCALL2(physdev_op); HYPERCALL3(vcpu_op); HYPERCALL1(tmem_op); +HYPERCALL2(multicall); ENTRY(privcmd_call) stmdb sp!, {r4} diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h index e709884..ca08a27 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h @@ -343,7 +343,7 @@ HYPERVISOR_memory_op(unsigned int cmd, void *arg) } static inline int -HYPERVISOR_multicall(void *call_list, int nr_calls) +HYPERVISOR_multicall(void *call_list, uint32_t nr_calls) { return _hypercall2(int, multicall, call_list, nr_calls); } diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h index fd9cb76..3400dba 100644 --- a/arch/x86/include/asm/xen/interface.h +++ b/arch/x86/include/asm/xen/interface.h @@ -54,6 +54,9 @@ typedef unsigned long xen_pfn_t; #define PRI_xen_pfn "lx" typedef unsigned long xen_ulong_t; #define PRI_xen_ulong "lx" +typedef long xen_long_t; +#define PRI_xen_long "lx" + /* Guest handles for primitive C types. */ __DEFINE_GUEST_HANDLE(uchar, unsigned char); __DEFINE_GUEST_HANDLE(uint, unsigned int); diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h index 0cd5ca3..de08213 100644 --- a/include/xen/interface/xen.h +++ b/include/xen/interface/xen.h @@ -275,9 +275,9 @@ DEFINE_GUEST_HANDLE_STRUCT(mmu_update); * NB. The fields are natural register size for this architecture. */ struct multicall_entry { - unsigned long op; - long result; - unsigned long args[6]; + xen_ulong_t op; + xen_long_t result; + xen_ulong_t args[6]; }; DEFINE_GUEST_HANDLE_STRUCT(multicall_entry);