From nobody Fri May 17 04:49:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662627224; cv=none; d=zohomail.com; s=zohoarc; b=HruiXAUSPD80LF0iqWVVipv4y6q4Gi6R8BpDnOvbpjdKUU0n3VqBH2omATeAh+EkWcMHmMrV2Clw2utZ7+JzNtmosFV4tfNdMUCHevZTAUFoEA/SniiPIKImpeydPMKKKRcb20zJ+KucSjGVWeRK7szIYthkkEqBYGrOZsZ14cM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662627224; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g8uTdefvk9Re34ta3Hpj2EM7Z0M3BKhJL7lQL/PEL2M=; b=IHlOCzNbcz7UsSyeF/fsqkqV6Jpp9ZBVCbCMQiek+y2dAnRv7Q2ITs2UV+E1fn0wn1Auzvy/9nMMqSB+lpTSLsV111hSgAtsE+1JubJFFlwor3ZlcYFt68gc/8GfNEw1HsDl+3w7WCcxWgI//Uocr/wN6ovNsQRbSeOPH9U1Eow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16626272241027.848691341208678; Thu, 8 Sep 2022 01:53:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.402880.644819 (Exim 4.92) (envelope-from ) id 1oWDHo-0004Iu-DN; Thu, 08 Sep 2022 08:53:24 +0000 Received: by outflank-mailman (output) from mailman id 402880.644819; Thu, 08 Sep 2022 08:53:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oWDHo-0004Ic-9v; Thu, 08 Sep 2022 08:53:24 +0000 Received: by outflank-mailman (input) for mailman id 402880; Thu, 08 Sep 2022 08:53:23 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oWDHn-0004Hp-5v for xen-devel@lists.xen.org; Thu, 08 Sep 2022 08:53:23 +0000 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [2607:f8b0:4864:20::62f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b0356a2b-2f53-11ed-a31c-8f8a9ae3403f; Thu, 08 Sep 2022 10:53:22 +0200 (CEST) Received: by mail-pl1-x62f.google.com with SMTP id b21so4255078plz.7 for ; Thu, 08 Sep 2022 01:53:21 -0700 (PDT) Received: from localhost ([122.171.18.80]) by smtp.gmail.com with ESMTPSA id h186-20020a62dec3000000b00536b67c6a80sm14202330pfg.109.2022.09.08.01.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 01:53:19 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b0356a2b-2f53-11ed-a31c-8f8a9ae3403f 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:subject:date; bh=g8uTdefvk9Re34ta3Hpj2EM7Z0M3BKhJL7lQL/PEL2M=; b=mBtM7uvNiEiMQLI2MLWBZ6JSOiFTqkssUfJyR7Lxq52+GS4fT+MsWyp1FiV4D9xh7r rtUo196+JZzmyWgL9K/iXKZWKEwh3mW0D+ScWCax7w2DL9kPOUYANXRiaGa1y0+UkvS9 l2OUxIcSpjj4lAUegWK5xEbr01sr4ytlgnTKin8q1FLQDu3YpYbbs00fylMajKkB+FbA KzhXbrrK06bJmmxx7fWmv8y9SNGakoUIvwYs6XaHiLV2pUXsIhL6Dra+0zF0sbP+WLHm bSuiGkRZ2caIfvwA8yGlpzXAWjwF1oRClkh15Oh6MFFlOIsfCSHUMAdM3qY31yn9hdvT mhLg== 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 :subject:date; bh=g8uTdefvk9Re34ta3Hpj2EM7Z0M3BKhJL7lQL/PEL2M=; b=ZhsyVVtnU1tjZXeTO4QpBxDhj1aN+WnzMvm/bc5JO4AWtyRVKmViyCHuCzyZHcT6ta aDQ9ilEgcxymkUCkTVceOgU+0d9x0M8Mx0kiK61BdO0G7V7zm7mkRv9eldQ9Ac7HjbyG VXFfL2eJgzimG9IClZRBsfedQ8Jb2pXY09M/lK2VhLeVBrlABayxWljCzNEQSxczoTo2 zkauHsGnMDamqixHuj5g1I26eBTko33PXgVESpJmwXMNqKvEk8R/accs5TosmBVg0H+5 EhL4zxgyAkNj2iBFCe6ffH/XZQl6MbF5pjiKQmZMQ2+aj0SX0ma2u97j/FHFoLDYZt45 4RGw== X-Gm-Message-State: ACgBeo2Z4U82SEu2F56Ebsx+qWXqcg5WcVW5Cmtm83OP2q05hxtkUac8 LbXACpopS+dH/6p5RxD/FaBPid2sk2HcPw== X-Google-Smtp-Source: AA6agR7ySj8B3HLO3ogrPbMnT+iVySyqolRFoWBUwcMlzqYCix0W79Ex8+UATRIvXkt438fUFUgeFA== X-Received: by 2002:a17:90a:13c8:b0:200:17ca:f183 with SMTP id s8-20020a17090a13c800b0020017caf183mr3010705pjf.104.1662627199819; Thu, 08 Sep 2022 01:53:19 -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=20Benn=C3=A9e?= , Stefano Stabellini , Mathieu Poirier , Oleksandr Tyshchenko , Wei Liu , Juergen Gross , Julien Grall , Anthony PERARD , Oleksandr Tyshchenko Subject: [PATCH V6 1/3] libxl: arm: Create alloc_virtio_mmio_params() Date: Thu, 8 Sep 2022 14:22:59 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662627226060100001 Content-Type: text/plain; charset="utf-8" In order to prepare for adding support for more device types, create a separate routine to allocate base and irq for a device as the same code will be required for other device types too. Also move updates to virtio_irq and virtio_enabled out of the disk device specific block, as they will depend on other device types too. Suggested-by: Oleksandr Tyshchenko Reviewed-by: Oleksandr Tyshchenko Signed-off-by: Viresh Kumar Reviewed-by: Anthony PERARD --- tools/libs/light/libxl_arm.c | 47 +++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index 1a3ac1646e94..cc30ba124918 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -48,6 +48,24 @@ static uint32_t alloc_virtio_mmio_irq(libxl__gc *gc, uin= t32_t *virtio_mmio_irq) return irq; } =20 +static int alloc_virtio_mmio_params(libxl__gc *gc, uint64_t *base, + uint32_t *irq, uint64_t *virtio_mmio_b= ase, + uint32_t *virtio_mmio_irq) +{ + *base =3D alloc_virtio_mmio_base(gc, virtio_mmio_base); + if (!*base) + return ERROR_FAIL; + + *irq =3D alloc_virtio_mmio_irq(gc, virtio_mmio_irq); + if (!*irq) + return ERROR_FAIL; + + LOG(DEBUG, "Allocate Virtio MMIO params: IRQ %u BASE 0x%"PRIx64, *irq, + *base); + + return 0; +} + static const char *gicv_to_string(libxl_gic_version gic_version) { switch (gic_version) { @@ -70,6 +88,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, bool vuart_enabled =3D false, virtio_enabled =3D false; uint64_t virtio_mmio_base =3D GUEST_VIRTIO_MMIO_BASE; uint32_t virtio_mmio_irq =3D GUEST_VIRTIO_MMIO_SPI_FIRST; + int rc; =20 /* * If pl011 vuart is enabled then increment the nr_spis to allow alloc= ation @@ -85,20 +104,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, libxl_device_disk *disk =3D &d_config->disks[i]; =20 if (disk->specification =3D=3D LIBXL_DISK_SPECIFICATION_VIRTIO) { - disk->base =3D alloc_virtio_mmio_base(gc, &virtio_mmio_base); - if (!disk->base) - return ERROR_FAIL; - - disk->irq =3D alloc_virtio_mmio_irq(gc, &virtio_mmio_irq); - if (!disk->irq) - return ERROR_FAIL; - - if (virtio_irq < disk->irq) - virtio_irq =3D disk->irq; - virtio_enabled =3D true; + rc =3D alloc_virtio_mmio_params(gc, &disk->base, &disk->irq, + &virtio_mmio_base, + &virtio_mmio_irq); =20 - LOG(DEBUG, "Allocate Virtio MMIO params for Vdev %s: IRQ %u BA= SE 0x%"PRIx64, - disk->vdev, disk->irq, disk->base); + if (rc) + return rc; } } =20 @@ -107,8 +118,16 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, * present, make sure that we allocate enough SPIs for them. * The resulting "nr_spis" needs to cover the highest possible SPI. */ - if (virtio_enabled) + if (virtio_mmio_irq !=3D GUEST_VIRTIO_MMIO_SPI_FIRST) { + virtio_enabled =3D true; + + /* + * Assumes that "virtio_mmio_irq" is the highest allocated irq, wh= ich is + * updated from alloc_virtio_mmio_irq() currently. + */ + virtio_irq =3D virtio_mmio_irq - 1; nr_spis =3D max(nr_spis, virtio_irq - 32 + 1); + } =20 for (i =3D 0; i < d_config->b_info.num_irqs; i++) { uint32_t irq =3D d_config->b_info.irqs[i]; --=20 2.31.1.272.g89b43f80a514 From nobody Fri May 17 04:49:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662627221; cv=none; d=zohomail.com; s=zohoarc; b=Wh/k87DwecBAocNgyUHVc2aO+ksvLe569x9mVwS6V160GWrcTTC/11d6oIyvSl30elaQGcbD9fw72sEfGIwkSZlkS+nS6zCjKCksIwmknNt53WERnHs/m32+0/hsPkejPludWYC5Wkqiv3bw13X7VkX5/IKh1qQYVGUhGEqOcdw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662627221; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/UEiFJKtm7/4NuvrzhnPo0LaLbvuX390efC9WrRSDDA=; b=T+PRKAc8RISXXxt6jIZ9gEtCwFAbsS8DOO4JeeXryJIGuRf3sNO/Twn1hMiHcDRLtULhtGATrNsU9SpSFG/Qr767IaP6liHARUrfmKD1Ra8dBFcTg1BDkXEbVq2olph2AlVIANeqs8Swg92BpmwvFKA2VTTSncnlgAEP49aIay0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662627221766771.2930840947492; Thu, 8 Sep 2022 01:53:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.402881.644830 (Exim 4.92) (envelope-from ) id 1oWDHp-0004a0-Qh; Thu, 08 Sep 2022 08:53:25 +0000 Received: by outflank-mailman (output) from mailman id 402881.644830; Thu, 08 Sep 2022 08:53:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oWDHp-0004Zp-Nn; Thu, 08 Sep 2022 08:53:25 +0000 Received: by outflank-mailman (input) for mailman id 402881; Thu, 08 Sep 2022 08:53:25 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oWDHp-0004Hp-0g for xen-devel@lists.xen.org; Thu, 08 Sep 2022 08:53:25 +0000 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [2607:f8b0:4864:20::62e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b1dc067c-2f53-11ed-a31c-8f8a9ae3403f; Thu, 08 Sep 2022 10:53:24 +0200 (CEST) Received: by mail-pl1-x62e.google.com with SMTP id iw17so10521616plb.0 for ; Thu, 08 Sep 2022 01:53:23 -0700 (PDT) Received: from localhost ([122.171.18.80]) by smtp.gmail.com with ESMTPSA id m14-20020a170902bb8e00b0017519b86996sm13793459pls.218.2022.09.08.01.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 01:53:22 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b1dc067c-2f53-11ed-a31c-8f8a9ae3403f 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:subject:date; bh=/UEiFJKtm7/4NuvrzhnPo0LaLbvuX390efC9WrRSDDA=; b=wWgUabhPbeJq2hBFiCzFdXfq110UIC+HRSYH4k4bh1bV8dxugymD82lrIUOn94NmRv s0FW+wjGfMw2GIm2DXIuYb2V9zrhWmiO6VhHl++hzYejWaFGRnR+KS36dw2PFqKjWf0E 8WRYpRnyZZR2vHWeLXdhw8uKDCcSBpqswRXY7p2i4U7LWNMOcfW2L9viOsLvz88kzdcT wpCphxw+pJyYzwI3gXt2Y4GEqI3O0OO2W0+67/dUnShjm/IE3+J5rPG00TVoeR2lJHSx 8psrXFdHGoYrlBllLO5rNUsj9eGcvV9y9hCeZOy9asX3DfwwMOI9Lc+EC7DMaoDauxdY z0Vg== 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 :subject:date; bh=/UEiFJKtm7/4NuvrzhnPo0LaLbvuX390efC9WrRSDDA=; b=LMVkFl21/V+64rIN2BAvKt36iDR4xAouXqKn0nkMSqgY1Z+5k+wXme6yDGy91hM8C6 tW7wBIjHVAatQcrBF5yqmxscKHVkiIpag+Uy74ID9c00t5vfYA/REco3F2ppM+CfBRbx aLc8fx+JpPgnLkax4KTg3QrjkZ9zW8s+pY0a4UbR7krmeFLh5K90eLYEMsStnxUHr2/N qiQRzKMYHLP6RT8ms5BpXijeWTJAKQUylYkANs2LKdA5v7Faqa5l0xFnc9oSyxpK6rCy 2w6b1WRbOpTDb6QfkJAfmH7Mqs9zNJ22NRYpdioGTX7zU6xF4B6PLEoHniuxh9fGbx76 x25Q== X-Gm-Message-State: ACgBeo2uHul7ZyKyYBJod+rKFmWUKWuum/OVmq2Z5mCqIExYeTfx2Wao H4b2Jefh8ykL116EildX06hGxkMXTlzYsg== X-Google-Smtp-Source: AA6agR44zhvleFny9uTwjI62GkT4G1FygHSVLhOOBlnLa/zEmKAqCg6xfNxPUp/bNyLw2IyO1iNKhQ== X-Received: by 2002:a17:903:40d2:b0:174:e086:c748 with SMTP id t18-20020a17090340d200b00174e086c748mr8259497pld.108.1662627202662; Thu, 08 Sep 2022 01:53:22 -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=20Benn=C3=A9e?= , Stefano Stabellini , Mathieu Poirier , Oleksandr Tyshchenko , Wei Liu , Juergen Gross , Julien Grall , Anthony PERARD , Oleksandr Tyshchenko Subject: [PATCH V6 2/3] libxl: arm: Split make_virtio_mmio_node() Date: Thu, 8 Sep 2022 14:23:00 +0530 Message-Id: <0edb5dc1ea3308cf9202e6476ff2797aad953966.1662626550.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662627221995100003 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Anthony PERARD --- tools/libs/light/libxl_arm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index cc30ba124918..55aee15c10b4 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -907,9 +907,9 @@ static int make_xen_iommu_node(libxl__gc *gc, void *fdt) return 0; } =20 -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_dom= id) { int res; gic_interrupt intr; @@ -942,10 +942,18 @@ static int make_virtio_mmio_node(libxl__gc *gc, void = *fdt, if (res) return res; } =20 - res =3D fdt_end_node(fdt); + return res; +} + +static int make_virtio_mmio_node(libxl__gc *gc, void *fdt, uint64_t base, + uint32_t irq, uint32_t backend_domid) +{ + int res; + + res =3D make_virtio_mmio_node_common(gc, fdt, base, irq, backend_domid= ); if (res) return res; =20 - return 0; + return fdt_end_node(fdt); } =20 static const struct arch_info *get_arch_info(libxl__gc *gc, --=20 2.31.1.272.g89b43f80a514 From nobody Fri May 17 04:49:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662627224; cv=none; d=zohomail.com; s=zohoarc; b=nc8Ak74t/Lj/3hoPm1912F6MQRFqopjrLylM7bp3AOuXydKGdyQpBFqQnJ8V4Ciu9KbdF1BadtMm+35u7WBgiHfLY/y098QIOrJZpq89eAujPBO3Oy7RclDqsOdvBBQqdQcd5ed31TM5OEMRv/7FH/XecNIy9SXxDL/eMY/uFeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662627224; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KvygtE56N8zYKSJxBlMmn0X+tKsUv5sphCjxV3H2TI4=; b=IFlKOLWkKz8ALFVmg7Riq6zZ6EI/KqlmJFUleWdCpKPI0pvNtAOZ4ZwH23snBpDTpJx7ULKE7ZiMDSF70zfixA+1dk56BSYGcnpm5wU0O+/B0SmPpSbLrBbY9nNtcR7HI4Z0EdFPcuMMTx8UkU6YUhhHX2esCoi1GbMThsj9GOA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662627224441453.48492943978715; Thu, 8 Sep 2022 01:53:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.402882.644841 (Exim 4.92) (envelope-from ) id 1oWDHt-0004uE-2D; Thu, 08 Sep 2022 08:53:29 +0000 Received: by outflank-mailman (output) from mailman id 402882.644841; Thu, 08 Sep 2022 08:53:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oWDHs-0004u3-VO; Thu, 08 Sep 2022 08:53:28 +0000 Received: by outflank-mailman (input) for mailman id 402882; Thu, 08 Sep 2022 08:53:28 +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 1oWDHs-00041V-0U for xen-devel@lists.xen.org; Thu, 08 Sep 2022 08:53:28 +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 b3829a88-2f53-11ed-9760-273f2230c3a0; Thu, 08 Sep 2022 10:53:26 +0200 (CEST) Received: by mail-pg1-x52d.google.com with SMTP id 78so16054808pgb.13 for ; Thu, 08 Sep 2022 01:53:26 -0700 (PDT) Received: from localhost ([122.171.18.80]) by smtp.gmail.com with ESMTPSA id k15-20020aa7998f000000b0053e9c04757dsm2067450pfh.169.2022.09.08.01.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 01:53:24 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b3829a88-2f53-11ed-9760-273f2230c3a0 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:subject:date; bh=KvygtE56N8zYKSJxBlMmn0X+tKsUv5sphCjxV3H2TI4=; b=WohkmT1BeCvS0E8Wetu+Zk37tJlFt2oJSQpKV+b3jFHbACkodyw/hJgyGjsoSZlxXq rHcd2Roec+M4LP+J/u6QvlYY4x3kECdQHjPklUMGK+3Q9Iz91AR8NtYD2JeMvplDNfJa zC4lBxO7izl7baxR2DE52F2OonJlXP4oKQDr1bTFAb7Zcb4iChJEf7MuUqYU7XKS1sKY 46+/i1+6VS8YfaWjE2YN2Zc/0t6tuqcElgIBVISus5FIC2E5CO3E3cDuhgVs47cCWGLI p8clqR40EALUIXkcklT2O4Qw5vB/I6ymUus+26KLIOip7ydmb6sWVsArmkjh0V2VSIi5 YSMg== 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 :subject:date; bh=KvygtE56N8zYKSJxBlMmn0X+tKsUv5sphCjxV3H2TI4=; b=N+/zuVXR7rOH/Yp8lE3wCfgXBOE+zzBNi2ouAxrJH54+tnpSsnlIDvUKDtVSkrv3tl 1OflqWe/mziM2nrAeBy3l034IURryV5i3oP8RVFR08HgLc/l28zUtoi2dEO2NfVnXXqc F2TtiipVuhl71X+u3vXsvxfsLXBaSgs3X8gwVPr5amx9t4o3iQ1Xb1tSeOknwzhfQn+w mqImg9YwXFeOO40upSRnUdLFZ0++bwCK46yB2ylH4TNsiNcdM/RmQBXix8yYnANz5t74 FBuVdKp2lquu3sb2pGen/0N2JPwx37jDyqmrQQcVeDfUkSJ1Hgxml7d+db7vlKsK90e7 4c8Q== X-Gm-Message-State: ACgBeo1rYXXHjwgoG6AeuBpjjmAV72hzo26GrHWjXoIEveJ/HhGiqrb/ KlqRC0XpTT3p6kwDUuyXJXQsn04OqVTPKg== X-Google-Smtp-Source: AA6agR7rTh0qzn+h0YaGzImMjv1sCcTEZWC+LMNk7f8DZa4Jdj1plGLmSf7Cz36sRy94uaxwxeYcug== X-Received: by 2002:a63:d114:0:b0:429:f039:ccfc with SMTP id k20-20020a63d114000000b00429f039ccfcmr7090714pgg.95.1662627205408; Thu, 08 Sep 2022 01:53:25 -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=20Benn=C3=A9e?= , Stefano Stabellini , Mathieu Poirier , Oleksandr Tyshchenko , Wei Liu , Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH V6 3/3] libxl: arm: make creation of iommu node independent of disk device Date: Thu, 8 Sep 2022 14:23:01 +0530 Message-Id: <099616e1092409fceea4eb30590215310f8c091c.1662626550.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662627226061100002 Content-Type: text/plain; charset="utf-8" The iommu node will be required for other virtio device types too, not just disk device. Move the call to make_xen_iommu_node(), out of the disk device specific block and rename "iommu_created" variable to "iommu_needed", and set it to true for virtio disk device. Signed-off-by: Viresh Kumar --- tools/libs/light/libxl_arm.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index 55aee15c10b4..2637acafa358 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -1157,7 +1157,7 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_do= main_config *d_config, size_t fdt_size =3D 0; int pfdt_size =3D 0; libxl_domain_build_info *const info =3D &d_config->b_info; - bool iommu_created; + bool iommu_needed; unsigned int i; =20 const libxl_version_info *vers; @@ -1265,22 +1265,26 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_= domain_config *d_config, if (d_config->num_pcidevs) FDT( make_vpci_node(gc, fdt, ainfo, dom) ); =20 - iommu_created =3D false; + iommu_needed =3D false; for (i =3D 0; i < d_config->num_disks; i++) { libxl_device_disk *disk =3D &d_config->disks[i]; =20 if (disk->specification =3D=3D LIBXL_DISK_SPECIFICATION_VIRTIO= ) { - if (disk->backend_domid !=3D LIBXL_TOOLSTACK_DOMID && - !iommu_created) { - FDT( make_xen_iommu_node(gc, fdt) ); - iommu_created =3D true; - } + if (disk->backend_domid !=3D LIBXL_TOOLSTACK_DOMID) + iommu_needed =3D true; =20 FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq, disk->backend_domid) ); } } =20 + /* + * Note, this should be only called after creating all virtio-mmio + * device nodes + */ + if (iommu_needed) + FDT( make_xen_iommu_node(gc, fdt) ); + if (pfdt) FDT( copy_partial_fdt(gc, fdt, pfdt) ); =20 --=20 2.31.1.272.g89b43f80a514