From patchwork Wed Aug 7 12:57:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viktor Mitin X-Patchwork-Id: 11082111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97367746 for ; Wed, 7 Aug 2019 12:59:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85DA1205A9 for ; Wed, 7 Aug 2019 12:59:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79A7E2624D; Wed, 7 Aug 2019 12:59:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 13A8728521 for ; Wed, 7 Aug 2019 12:59:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvLVx-0001A0-K1; Wed, 07 Aug 2019 12:58:01 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvLVw-00019m-OW for xen-devel@lists.xenproject.org; Wed, 07 Aug 2019 12:58:00 +0000 X-Inumbo-ID: fb3c7188-b912-11e9-8980-bc764e045a96 Received: from mail-lf1-x141.google.com (unknown [2a00:1450:4864:20::141]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id fb3c7188-b912-11e9-8980-bc764e045a96; Wed, 07 Aug 2019 12:57:59 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id c19so63967688lfm.10 for ; Wed, 07 Aug 2019 05:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5y3iK51qj3Kq5F8uJHax4WgYRigra800VfBRcNZdmyw=; b=HjWGm1we3B0FTfax1mOzEm3D4XS7j1fDbND0S2G20zqXm1q9oQSYyA494OCo4MIEkS 8JYnpCdrx6wIW9I+X3TGPTLf7dvo0WzhZR9tDVSe97JfiX4HIM6J5Q6m4HA/aOmr4lRF lDAFOPceBFahq8h/7ll5IzUnEiybFh38hssLRmjm8e3AeowU00XOelgJqfgGJ2QRu2K9 FrRR4/P0Bm5KdyTK9QewAN1Pr3ccP/UhlTPkhTynighBhcK9hR1FtMTG+41uBxhoimDK IvCDvHHdk1D2QEjORgCBPOdrKXH0NYLLeq1+PlPq5znulpjdwDMx2/MWJn23+cixeZEs ciwQ== 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=5y3iK51qj3Kq5F8uJHax4WgYRigra800VfBRcNZdmyw=; b=ax25m15mlkuZeZf9jxpFsL1Zbm0okqdZMdtdt/gorSG0BnVI1ajFM0Q+O/h6h4ZhsP 6eI4rc+S/VRjx1QLsieUS7ylCFS3F+yXE2ikq84ZOOSPixZRKA5MijElpP9F23S+5VQB WQR+0oj1mca3lwlSAX9XLHlbRRFIcTkU6i9GYf1LPNZSCYRdDp8gOrJ+bzZ+BvGnfbAp ZSiQ7iHWV5QWj9Vj6T24ThPL073Um7oHsUDcPje9vKz7i677yVVSvt6m9vEidXiL8rqJ LfUyqJ0EYXXbdEU8EqbAzpcogmMAo9jHEeJnXDIW/bK9ZqWjJtbjwmSn/s9w3qWz9by7 Ihkg== X-Gm-Message-State: APjAAAU/9f5T/sgDDmQ0eEaJfVjZVpJg/ztoU/b7/RxIlti9si8QKQyk 0wu0L8YL7dLliW6aKtJkmu6hh3X1 X-Google-Smtp-Source: APXvYqynZRwgXTTYcAy9gbDtvjstzHx+0/m2dGOjgudAoVXD11sZP6uFV7z6/XJ3XXM5M1y1AwBa/w== X-Received: by 2002:a19:c150:: with SMTP id r77mr6187569lff.76.1565182677979; Wed, 07 Aug 2019 05:57:57 -0700 (PDT) Received: from 3489.kyiv.epam.com ([178.133.153.36]) by smtp.gmail.com with ESMTPSA id a15sm2033220lfo.2.2019.08.07.05.57.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 05:57:57 -0700 (PDT) From: Viktor Mitin To: xen-devel@lists.xenproject.org Date: Wed, 7 Aug 2019 15:57:24 +0300 Message-Id: <20190807125725.31683-2-viktor.mitin.19@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190807125725.31683-1-viktor.mitin.19@gmail.com> References: <20190807125725.31683-1-viktor.mitin.19@gmail.com> Subject: [Xen-devel] [PATCH v8 1/2] xen/arm: extend fdt_property_interrupts to support DomU X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Viktor Mitin , Julien Grall , Stefano Stabellini , Volodymyr Babchuk , Viktor Mitin MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The domain and fdt can be found in the structure kinfo. Rather than adding a an extra argument for the domain, pass directly kinfo. This also requires to adapt fdt_property_interrupts() prototype. A follow-up patch will need to create the interrupts for either Dom0 or DomU. Suggested-by: Julien Grall Signed-off-by: Viktor Mitin Reviewed-by: Volodymyr Babchuk --- v7: removed extra space after sizeof in fdt_property_interrupts() v8: updated commit message --- xen/arch/arm/domain_build.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 4c8404155a..26cd0ae12c 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -621,17 +621,20 @@ static void __init set_interrupt(gic_interrupt_t interrupt, * "interrupts": contains the list of interrupts * "interrupt-parent": link to the GIC */ -static int __init fdt_property_interrupts(void *fdt, gic_interrupt_t *intr, +static int __init fdt_property_interrupts(const struct kernel_info *kinfo, + gic_interrupt_t *intr, unsigned num_irq) { int res; + uint32_t phandle = is_hardware_domain(kinfo->d) ? + dt_interrupt_controller->phandle : GUEST_PHANDLE_GIC; - res = fdt_property(fdt, "interrupts", intr, sizeof (intr[0]) * num_irq); + res = fdt_property(kinfo->fdt, "interrupts", + intr, sizeof(intr[0]) * num_irq); if ( res ) return res; - res = fdt_property_cell(fdt, "interrupt-parent", - dt_interrupt_controller->phandle); + res = fdt_property_cell(kinfo->fdt, "interrupt-parent", phandle); return res; } @@ -733,7 +736,7 @@ static int __init make_hypervisor_node(struct domain *d, * TODO: Handle properly the cpumask; */ set_interrupt(intr, d->arch.evtchn_irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW); - res = fdt_property_interrupts(fdt, &intr, 1); + res = fdt_property_interrupts(kinfo, &intr, 1); if ( res ) return res; @@ -960,8 +963,9 @@ static int __init make_gic_node(const struct domain *d, void *fdt, return res; } -static int __init make_timer_node(const struct domain *d, void *fdt) +static int __init make_timer_node(const struct kernel_info *kinfo) { + void *fdt = kinfo->fdt; static const struct dt_device_match timer_ids[] __initconst = { DT_MATCH_COMPATIBLE("arm,armv7-timer"), @@ -1016,7 +1020,7 @@ static int __init make_timer_node(const struct domain *d, void *fdt) dt_dprintk(" Virt interrupt %u\n", irq); set_interrupt(intrs[2], irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW); - res = fdt_property_interrupts(fdt, intrs, 3); + res = fdt_property_interrupts(kinfo, intrs, 3); if ( res ) return res; @@ -1377,7 +1381,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo, if ( device_get_class(node) == DEVICE_GIC ) return make_gic_node(d, kinfo->fdt, node); if ( dt_match_node(timer_matches, node) ) - return make_timer_node(d, kinfo->fdt); + return make_timer_node(kinfo); /* Skip nodes used by Xen */ if ( dt_device_used_by(node) == DOMID_XEN )