From patchwork Mon Aug 22 09:15:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12950391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6139C32772 for ; Mon, 22 Aug 2022 09:15:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.391247.629017 (Exim 4.92) (envelope-from ) id 1oQ3X1-0001x9-Sw; Mon, 22 Aug 2022 09:15:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 391247.629017; Mon, 22 Aug 2022 09:15:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQ3X1-0001wf-Os; Mon, 22 Aug 2022 09:15:39 +0000 Received: by outflank-mailman (input) for mailman id 391247; Mon, 22 Aug 2022 09:15:38 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQ3X0-00016q-MO for xen-devel@lists.xen.org; Mon, 22 Aug 2022 09:15:38 +0000 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [2607:f8b0:4864:20::52d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fbc912f6-21fa-11ed-9250-1f966e50362f; Mon, 22 Aug 2022 11:15:37 +0200 (CEST) Received: by mail-pg1-x52d.google.com with SMTP id w13so3760117pgq.7 for ; Mon, 22 Aug 2022 02:15:37 -0700 (PDT) Received: from localhost ([122.171.18.80]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172951dd9absm7873503pla.43.2022.08.22.02.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 02:15:35 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fbc912f6-21fa-11ed-9250-1f966e50362f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=V2mdY566ca45hKMG7KJR4XNdOwkTjA1uL0gZlrSZ5zw=; b=CP9lYPL2sKa6LoCzSJ0w0suKTfTkrz8Hw+WrE9qWYmYaXSHCMEuWr7MGNXlLFZIo+o vAlGupnv63mpPWoeKDL9/hVbIhbrkXEKB0AaScNpwrMkmdTPCdyWeulperiYXNQExVKh IgoenigXuS4Hhc51nrsTkIVexka4EbRplpyDtUwHuG1Zmz3WKE2w5vCT/eTfCtxYZow+ V/gFh5z7r0+XvH4ah8f3T6cL/q5bKkqUzz1gCaCggq5JCCB3TCNU2LGC0XyL+qYouEdz XpeQsZBard7u+onEcoqX4DemUzc9J/Nd85Q5izQgo/PPCvZavrdRcemVtBWeqwowpOvh Mb2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=V2mdY566ca45hKMG7KJR4XNdOwkTjA1uL0gZlrSZ5zw=; b=dnHyPPOx4MWj4d77XywMpL3oEk5rRlcN25kD+FiEDoiLCOmw3ufDasYXJGOzR647Jk TqFTLZVQKQxGpuT5fwMj5qAPyzamguBp//aojvU39ncfHo75gc4SAZ9+LsQA6+0wLIHD QRgjrJKyynb5yv2W5tsgf9hNqu7Cv22WfWLdz9myNjmKZZyADGpvtMSI6+A53WAMG7Rm gIxQYrrfzbLQZZ6AXFoLqB1es5ZvItDWKlQ/+NHuCoP4XWoABQpD2KTf4MoszlBqKvfJ +khRGcpY+humHaLPSuX4vNGX6g4/ddLZCOHUeTwtIHDwiKRpODUQ2lheL6046MCJwRsJ DoNw== X-Gm-Message-State: ACgBeo3knMQInmzJwzlJKHBJvgKliMfrFcN3gUbkjKEKFd0w66FFEXFv Zi4Z6aR2nN4yCU3gkrs3lx5DNOKDDUh0Aw== X-Google-Smtp-Source: AA6agR7eDgV6y/I71nVNPuZqwM1wnvxBOMzpWrGIbv80XVcveKBAmq4LmZHHSYJu/f0PlO3uSdjZew== X-Received: by 2002:a63:6c49:0:b0:41d:e36b:1e4a with SMTP id h70-20020a636c49000000b0041de36b1e4amr16389739pgc.300.1661159736323; Mon, 22 Aug 2022 02:15:36 -0700 (PDT) From: Viresh Kumar To: xen-devel@lists.xen.org Cc: Viresh Kumar , Vincent Guittot , stratos-dev@op-lists.linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Stefano Stabellini , Mathieu Poirier , Mike Holmes , Oleksandr Tyshchenko , Wei Liu , Juergen Gross , Julien Grall , anthony.perard@citrix.com, Oleksandr Tyshchenko Subject: [PATCH V5 4/6] libxl: arm: Split make_virtio_mmio_node() Date: Mon, 22 Aug 2022 14:45:16 +0530 Message-Id: <981b663f6a44f9f82f32cc58219f6af26f73d66f.1661159474.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 make_virtio_mmio_node() creates the DT node for simple MMIO devices currently, i.e. the ones that don't require any additional properties. In order to allow using it for other complex device types, split the functionality into two, one where the fdt node isn't closed and the other one to create a simple DT node. Reviewed-by: Oleksandr Tyshchenko Signed-off-by: Viresh Kumar --- tools/libs/light/libxl_arm.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index 0e3051bac5e4..4d0469f8166a 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -906,9 +906,9 @@ static int make_xen_iommu_node(libxl__gc *gc, void *fdt) return 0; } -static int make_virtio_mmio_node(libxl__gc *gc, void *fdt, - uint64_t base, uint32_t irq, - uint32_t backend_domid) +/* The caller is responsible to complete / close the fdt node */ +static int make_virtio_mmio_node_common(libxl__gc *gc, void *fdt, uint64_t base, + uint32_t irq, uint32_t backend_domid) { int res; gic_interrupt intr; @@ -941,10 +941,18 @@ static int make_virtio_mmio_node(libxl__gc *gc, void *fdt, if (res) return res; } - res = fdt_end_node(fdt); + return res; +} + +static int make_virtio_mmio_node_simple(libxl__gc *gc, void *fdt, uint64_t base, + uint32_t irq, uint32_t backend_domid) +{ + int res; + + res = make_virtio_mmio_node_common(gc, fdt, base, irq, backend_domid); if (res) return res; - return 0; + return fdt_end_node(fdt); } static const struct arch_info *get_arch_info(libxl__gc *gc, @@ -1267,8 +1275,9 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config, iommu_created = true; } - FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq, - disk->backend_domid) ); + FDT( make_virtio_mmio_node_simple(gc, fdt, disk->base, + disk->irq, + disk->backend_domid) ); } }