From patchwork Thu Apr 9 15:09:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 46973 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8F3F621416 for ; Thu, 9 Apr 2015 15:22:36 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf13045565wgt.1 for ; Thu, 09 Apr 2015 08:22:35 -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=v1DgEEihCizejs0OVITAEFgP5nehNsBm6cCehYGGSu4=; b=d8s1nUJZ24YQdlMdTYGMHUdmW4c10fI6f7wNJanfbRIfbZVEn0vQ7yFddJbG7fMT+u PHQuAr0I6qXiUycHMl+Q6QWxFmuIZoghsaaw5Xt6X44ve58r53uadVjhFBbrG0TvEmKL TXz9w9/LsUO+tle9Z+JHSepfHZHm7Wxt4bWQlXHFeqT5pursrwZ8qUe1L6W3nJyEdSjL 89LuCpHtxJR/L59hQVXiug1ZSUalH0EzOpAh/IAt7RO/UXZ/GWYflmEiVJhk0VUi7MeA h/YeBRI9k6uU/QERm8uhV8GAspjcxZLY3swBQsQr9nD1i0US8dlj55/9GOauwj8aD5it zsTQ== X-Gm-Message-State: ALoCoQlpNiqqJXLDvBVOy+nmoz1klq+RK4eRjD3NDjgThLRjWdkiPdoG9ROOR9oS/bdYSKapix+S X-Received: by 10.194.53.225 with SMTP id e1mr6061347wjp.4.1428592955920; Thu, 09 Apr 2015 08:22:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.38 with SMTP id cb6ls280352lad.97.gmail; Thu, 09 Apr 2015 08:22:35 -0700 (PDT) X-Received: by 10.112.133.225 with SMTP id pf1mr28803328lbb.33.1428592955665; Thu, 09 Apr 2015 08:22:35 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id rl7si11689032lac.80.2015.04.09.08.22.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 08:22:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laat2 with SMTP id t2so85062242laa.1 for ; Thu, 09 Apr 2015 08:22:35 -0700 (PDT) X-Received: by 10.112.16.196 with SMTP id i4mr17676213lbd.72.1428592955531; Thu, 09 Apr 2015 08:22:35 -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 l1csp537698lbt; Thu, 9 Apr 2015 08:22:31 -0700 (PDT) X-Received: by 10.140.201.74 with SMTP id w71mr38796206qha.51.1428592948567; Thu, 09 Apr 2015 08:22:28 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id w8si14691682qcn.34.2015.04.09.08.22.27 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 09 Apr 2015 08:22:28 -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 1YgEH1-0003Pd-I2; Thu, 09 Apr 2015 15:21:43 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YgEGz-0003NM-Vn for xen-devel@lists.xenproject.org; Thu, 09 Apr 2015 15:21:42 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id F2/2F-30545-50996255; Thu, 09 Apr 2015 15:21:41 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1428592898!11899527!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.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6343 invoked from network); 9 Apr 2015 15:21:40 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 9 Apr 2015 15:21:40 -0000 X-IronPort-AV: E=Sophos;i="5.11,550,1422921600"; d="scan'208";a="253569381" From: Julien Grall To: Date: Thu, 9 Apr 2015 16:09:39 +0100 Message-ID: <1428592185-18581-14-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1428592185-18581-1-git-send-email-julien.grall@citrix.com> References: <1428592185-18581-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 v5 p2 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.49 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 Cc: Ian Jackson Cc: Wei Liu --- 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..aa302fd 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); +} + /* * 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