From patchwork Thu Mar 19 19:29:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 46115 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f198.google.com (mail-we0-f198.google.com [74.125.82.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6FCEB21515 for ; Thu, 19 Mar 2015 19:33:15 +0000 (UTC) Received: by wevm14 with SMTP id m14sf6920429wev.0 for ; Thu, 19 Mar 2015 12:33:14 -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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=k59FbmBqfbZvxcBM0z3blLP3pEovrFWQfXeR9dQLP9A=; b=Mp8BESteZBMh3PvhF6PdiHtNtRVYpWcSgUf//VrXxI80jtsr5PU23Zmwu8/98Uwtgf 1LYkAvG0nyqOKm3bQhRLRmiXl72lU3ZMb/EptLbRA/cceS1YvJdK2VGAvaCbSq4e1U45 tSmyobeAg+wOECPoU7+11+2TkqEhYWoo8pTj+DuroUY7+qH6jn/hkO/pgbd9ZISs+4Z0 ZcRf3trfok5P4kj5iD3bZKg8Eov83NdilKUSLnNPGi24TImYyg3gpelwbiPyhz5gXtqs wD+YOZ7lM4zSPcyOhTgqVQQFxm8XrGc+cIrh4ymgodFIRPGfiV0tuWTyvZLHbXObop9U fsig== X-Gm-Message-State: ALoCoQmMQG2Qkhmn1T7QNja3o3FFFwFR1R0kh5ug7yH2O9nMS6++HZ5bvOshQQEMUmGZ56XVPuSd X-Received: by 10.112.125.67 with SMTP id mo3mr10593653lbb.6.1426793594643; Thu, 19 Mar 2015 12:33:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.140 with SMTP id ay12ls386959lab.2.gmail; Thu, 19 Mar 2015 12:33:14 -0700 (PDT) X-Received: by 10.112.170.100 with SMTP id al4mr70633789lbc.42.1426793594165; Thu, 19 Mar 2015 12:33:14 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id n1si1689341lbc.29.2015.03.19.12.33.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 12:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbnq5 with SMTP id q5so32348130lbn.0 for ; Thu, 19 Mar 2015 12:33:14 -0700 (PDT) X-Received: by 10.112.211.200 with SMTP id ne8mr69196421lbc.73.1426793594076; Thu, 19 Mar 2015 12:33:14 -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.35.133 with SMTP id h5csp597990lbj; Thu, 19 Mar 2015 12:33:13 -0700 (PDT) X-Received: by 10.52.61.137 with SMTP id p9mr50761892vdr.68.1426793569888; Thu, 19 Mar 2015 12:32:49 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id f4si2007585vdk.27.2015.03.19.12.32.49 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 19 Mar 2015 12:32:49 -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 1YYgA7-0005Jk-Ae; Thu, 19 Mar 2015 19:31:23 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYgA4-0005CC-Te for xen-devel@lists.xenproject.org; Thu, 19 Mar 2015 19:31:21 +0000 Received: from [85.158.139.211] by server-8.bemta-5.messagelabs.com id 69/94-25011-8042B055; Thu, 19 Mar 2015 19:31:20 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-3.tower-206.messagelabs.com!1426793479!4386477!1 X-Originating-IP: [209.85.212.182] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5334 invoked from network); 19 Mar 2015 19:31:19 -0000 Received: from mail-wi0-f182.google.com (HELO mail-wi0-f182.google.com) (209.85.212.182) by server-3.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 19 Mar 2015 19:31:19 -0000 Received: by wibg7 with SMTP id g7so15064373wib.1 for ; Thu, 19 Mar 2015 12:31:19 -0700 (PDT) X-Received: by 10.194.175.39 with SMTP id bx7mr158110298wjc.22.1426793478250; Thu, 19 Mar 2015 12:31:18 -0700 (PDT) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id hl8sm3203005wjb.38.2015.03.19.12.31.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Mar 2015 12:31:17 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 19 Mar 2015 19:29:53 +0000 Message-Id: <1426793399-6283-28-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426793399-6283-1-git-send-email-julien.grall@linaro.org> References: <1426793399-6283-1-git-send-email-julien.grall@linaro.org> Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v4 27/33] 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: , MIME-Version: 1.0 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: julien.grall@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.217.177 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: ARM and x86 use a different hypercall to map an IRQ to a domain. The hypercall to give IRQ permission to the domain as also been moved on the 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 Cc: Ian Jackson Cc: Wei Liu --- Changes in v4: - Patch added --- tools/libxl/libxl_arch.h | 4 ++++ tools/libxl/libxl_arm.c | 7 +++++++ tools/libxl/libxl_create.c | 6 ++---- tools/libxl/libxl_x86.c | 13 +++++++++++++ 4 files changed, 26 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 2407c2e..06e940b 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -742,6 +742,13 @@ 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_irq(CTX->xch, domid, irq, PT_IRQ_TYPE_SPI, + 0 /* Not used */, 0 /* Not used */, + 0 /* Not used */, 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 3149896..9f6ec18 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -427,6 +427,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