From patchwork Tue Apr 28 14:32:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 47677 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 644C92121F for ; Tue, 28 Apr 2015 14:49:21 +0000 (UTC) Received: by wizk4 with SMTP id k4sf6499879wiz.2 for ; Tue, 28 Apr 2015 07:49:20 -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:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=wmPpxdA5i907IaZVVmfUl3FWr/DywCLml+QujZF7DdQ=; b=S0dVAmkGw1xXIsK/CUUAYJspgbc4iF4u67INACvFgVKzbtVXqBdzVyvPdRxYurEjne QySBQf8uoV/XT/gSaT6pTG29GDyFTq3MNUN2kpvxf+mz1UX+VXJNgzOKoKyoOk/K26e/ TccFZY8C6NUCFUEPKG8hBiRNtlCSiGpquIrkSn5OPGzt03iUzXI33fYuWQzPPGuFqmd/ 0MG5dp9LT5HNNIlK3hUul5hKJpytDjiUwxqbbAAFZwYc7Ho7OTrc9Dxuf4vrmG58Lu3I Q0idhz/WDVV/JOYOzdwWpT7MoCizdzffavcPywRIZ4oyaiwcatF8tkyDHurq2DLsC28Z AVNQ== X-Gm-Message-State: ALoCoQlK7pJnKFqE+MKhiq/s1VRM2bPVpG7D0lVvYsbM+eTdkgKKPn52al2fmPi39jOAsYy/RcMp X-Received: by 10.180.7.138 with SMTP id j10mr10300026wia.2.1430232560626; Tue, 28 Apr 2015 07:49:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.101 with SMTP id i5ls73126laa.58.gmail; Tue, 28 Apr 2015 07:49:20 -0700 (PDT) X-Received: by 10.112.211.134 with SMTP id nc6mr14667133lbc.52.1430232560498; Tue, 28 Apr 2015 07:49:20 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id o7si17200818lbp.164.2015.04.28.07.49.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 07:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagv1 with SMTP id v1so106331962lag.3 for ; Tue, 28 Apr 2015 07:49:20 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr15250021lbh.56.1430232560402; Tue, 28 Apr 2015 07:49:20 -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.112.67.65 with SMTP id l1csp1932126lbt; Tue, 28 Apr 2015 07:49:19 -0700 (PDT) X-Received: by 10.140.95.208 with SMTP id i74mr11896928qge.51.1430232558891; Tue, 28 Apr 2015 07:49:18 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id w19si18601798qha.85.2015.04.28.07.49.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 28 Apr 2015 07:49:18 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1Yn6oH-00015n-4w; Tue, 28 Apr 2015 14:48:29 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yn6oF-00014W-Sl for xen-devel@lists.xenproject.org; Tue, 28 Apr 2015 14:48:27 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 65/8E-03284-BBD9F355; Tue, 28 Apr 2015 14:48:27 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1430232504!11245977!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 6.13.14; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25338 invoked from network); 28 Apr 2015 14:48:26 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 28 Apr 2015 14:48:26 -0000 X-IronPort-AV: E=Sophos;i="5.11,664,1422921600"; d="scan'208";a="259453162" From: Julien Grall To: Date: Tue, 28 Apr 2015 15:32:37 +0100 Message-ID: <1430231563-25648-14-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430231563-25648-1-git-send-email-julien.grall@citrix.com> References: <1430231563-25648-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v6 13/19] tools/libxl: Create a per-arch function to map IRQ to a domain 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: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) 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: From: Julien Grall ARM and x86 use a different hypercall to map an IRQ to a domain. The hypercall to give IRQ permission to the domain has also been moved to be an x86 specific function as ARM guest won't be able to manage the IRQ. We may want to support it later. Signed-off-by: Julien Grall Acked-by: Ian Campbell Cc: Ian Jackson Cc: Wei Liu --- Changes in v6: - Update the call to xc_domain_bind_pt_spi_irq according to the new protype - Add Ian's ack Changes in v5: - Use the new function xc_domain_bind_pt_spi_irq - Fix typoes Changes in v4: - Patch added --- tools/libxl/libxl_arch.h | 4 ++++ tools/libxl/libxl_arm.c | 5 +++++ tools/libxl/libxl_create.c | 6 ++---- tools/libxl/libxl_x86.c | 13 +++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index cae64c0..77b1f2a 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -39,4 +39,8 @@ int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, uint32_t domid, libxl_domain_build_info *b_info, libxl__domain_build_state *state); + +/* arch specific irq map function */ +int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq); + #endif diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 5a5cb3f..feded58 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -742,6 +742,11 @@ int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, return libxl__vnuma_build_vmemrange_pv_generic(gc, domid, info, state); } +int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) +{ + return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq); +} + /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index e5a343f..15b464e 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1205,11 +1205,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, LOG(DEBUG, "dom%d irq %d", domid, irq); - ret = irq >= 0 ? xc_physdev_map_pirq(CTX->xch, domid, irq, &irq) + ret = irq >= 0 ? libxl__arch_domain_map_irq(gc, domid, irq) : -EOVERFLOW; - if (!ret) - ret = xc_domain_irq_permission(CTX->xch, domid, irq, 1); - if (ret < 0) { + if (ret) { LOGE(ERROR, "failed give dom%d access to irq %d", domid, irq); ret = ERROR_FAIL; goto error_out; diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 5e9a8d2..ed2bd38 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -424,6 +424,19 @@ out: return rc; } +int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) +{ + int ret; + + ret = xc_physdev_map_pirq(CTX->xch, domid, irq, &irq); + if (ret) + return ret; + + ret = xc_domain_irq_permission(CTX->xch, domid, irq, 1); + + return ret; +} + /* * Local variables: * mode: C