From nobody Sat Jun 13 11:48:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1780911535; cv=none; d=zohomail.com; s=zohoarc; b=bRJjzifOdxW4V64YlSV7K3UMGgMadYPS3/f+WvOmwl+yA51e/hPRJTLD3qmGTFC/NAP3ED33eyTW8CSk+GA9iNHzhUqnoZRQxmjwdc95wjgAqQYXMYqNNd6sZYtUZCJr+ODj+frjxyILh4GakY1Xl+2LpLbxMcWRj3fFP7cdPQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780911535; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k1W0FDY9Vb0uir54xHVAuRUaBOc53guGxtfsBJ9GpaY=; b=h01Ler2v2GQiXZrG2QcCgNZgPsuW/yHclpaC3RUyvujQDTb3YFyrE1h94Yln7B+j9QiOSbDZ0aCfXbAkRWsvl/QES+i4UqdXJdYzOWbtNoecanuJf0lGq1f2FAeliGidp/YtzezbQzJpruCoYgBq09SolvTh1rZ9NpEatJSJEtw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1780911535289685.6733632799034; Mon, 8 Jun 2026 02:38:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wWWRF-0005qw-RH; Mon, 08 Jun 2026 05:38:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wWWR3-0005dX-3E for qemu-devel@nongnu.org; Mon, 08 Jun 2026 05:38:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wWWQz-0005UI-42 for qemu-devel@nongnu.org; Mon, 08 Jun 2026 05:38:20 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-280-4VhQstBoMdycBKJcRdXK6A-1; Mon, 08 Jun 2026 05:38:13 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-490cc1ae292so9552545e9.1 for ; Mon, 08 Jun 2026 02:38:13 -0700 (PDT) Received: from lleonard-thinkpadx1carbongen13.rmtit.csb ([176.206.19.176]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f34413csm50144923f8f.21.2026.06.08.02.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 02:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780911495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k1W0FDY9Vb0uir54xHVAuRUaBOc53guGxtfsBJ9GpaY=; b=WN134OyqP+i9Ai22r15CT6+3jNSh5elos5aYnFsiltFkHkTW0moGd5AFGzjfFMSgKPNH+7 Lht291Hmw2jy0/NEb05yzBku7aW4Jn9GSNHDTxax6cHKU33YpRvAjoI+BYiKPYBzSIj42S uYzRCIavvANNAMO6l4ZrSlMLaml7+UI= X-MC-Unique: 4VhQstBoMdycBKJcRdXK6A-1 X-Mimecast-MFC-AGG-ID: 4VhQstBoMdycBKJcRdXK6A_1780911492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780911492; x=1781516292; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=k1W0FDY9Vb0uir54xHVAuRUaBOc53guGxtfsBJ9GpaY=; b=XUFIePcU7ji2/7fv3JXYYo+jgJ7yYplKvy0EzLtwTNg8FQvJTcXsWgDc5usS9Clinh BJsutEQLdtXpmBH60+c8CDl/NEoJD349Uc22kLBXjYizUPyi13J6Obqk+td1dRutOUbi ECp9NaRfmScCVpz8Mg2folntw61ONqdVLPS0EBACQn7fTmbNaZItiygJG2j9XW/gqncz TIK7FM8h9TaqMl5Nyf0XN2oV5Kf+Vte14a+/O2Lz08OS9QogfThy+V67rg0MUu80cVo0 fQGu2S4VEKEH5guVBchYZvNBkQjmUq7jumvP4A92F5sFiybfo5qlFpRfrr9r6ZfN06Ry MIdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780911492; x=1781516292; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=k1W0FDY9Vb0uir54xHVAuRUaBOc53guGxtfsBJ9GpaY=; b=Ww58MGb1jw6A33V2p9SWZFH9rcXbHedOcnM4o4lUiKx2BdvHpse8MPbwHmiN1sySW/ tNxsKy8yFk1+hYYF52Sc/8lvXQxanmdZcdaBJiZDO760JOs1ZqlCvLYzZKKjxryYdgFG CY5k0vwMSb2qiKuXbjAyCoo7mBjCpnYTvuUPb010cqtfWO6YW3x0o8U8mX6N1DO+4VMA +9sxVkF0mWA1IplMRyfvgTBKYNPZLyLZRC0DnUv7HRmuGY2JU/uwsbTchqEDnEQ7bQOQ hLz6OkiIGPooyCaIDUJYgU7+jii1wT7/4wylYO4fqnYe12bIRhrb7nI+xpBW7UYLmYnN gZzA== X-Gm-Message-State: AOJu0Yzn7o8uCQ5ssyUjOOq4YTAgP3ljgyw8yTxeqm/yJRopb4K6NNGn h4Hfkp7PlfJ8VvzAydI1T6SK3GsZNkn91CIo0RkxkgVpzIOlHAMQSVDpd9/zdqiujlPLk0ykIqQ ZwQQuSbRN6GibuAfHdO1Ww57KioZUyabihaS9cEZfFMarbhH2V2Rymwsk X-Gm-Gg: Acq92OHGSj1pP9jlK5fsCNAR7xREISmUi47v/+nYn2zk6cffuvMq20WsVkmScfPZR2N LwiCYc9Pav85YNdi4X/cc6B7xLzQ3IJ83qqebqi2NJ7K0eAU0pjFdGM9y5YO0DSaDvnRelN8tIq S4nFQlDzFQ75WZS9JfqBD//HO2Uz/6s9vRDnPyv9+anDaksbGUnztiakny3t+gph/ETTYkY19HZ Et2GSL2KfpRmFeaW5PT5kq8LolOt0gPyJNXKqC6oABf/yoepz544HY+Ig8XAXKv2VzpKL5JXkoY NZwbe4WObfmRdODcpdnr+jCgb3MnDwAj5HJ0+svcwGgwnxH/N2FN9oG4f9GMIx88aeiOCKs+kKf 0PjrXef26BN5sAgdgJsF0M0j+49+2b1k+IhB33+NJXDO4jXRIMugdjZ7WTgJ8qG8jDLVpmhaatO oPZU05vWrMxVM0N/mWIGeWNZkTfCI= X-Received: by 2002:a05:600c:a218:b0:490:b0bf:7606 with SMTP id 5b1f17b1804b1-490c2d2003cmr119774155e9.16.1780911492536; Mon, 08 Jun 2026 02:38:12 -0700 (PDT) X-Received: by 2002:a05:600c:a218:b0:490:b0bf:7606 with SMTP id 5b1f17b1804b1-490c2d2003cmr119773975e9.16.1780911492197; Mon, 08 Jun 2026 02:38:12 -0700 (PDT) From: Luigi Leonardi Date: Mon, 08 Jun 2026 11:37:46 +0200 Subject: [PATCH 1/2] hw/i386/microvm: pack device tree MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260608-microvm_device_tree-v1-1-730874ad0008@redhat.com> References: <20260608-microvm_device_tree-v1-0-730874ad0008@redhat.com> In-Reply-To: <20260608-microvm_device_tree-v1-0-730874ad0008@redhat.com> To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Paolo Bonzini , Richard Henderson , Gerd Hoffmann , Stefano Garzarella , Ani Sinha , Zhao Liu , Oliver Steffen , Luigi Leonardi X-Mailer: b4 0.14.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=leonardi@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1780911537368158500 After the device tree is generated, it can be packed, significantly reducing its size. This is particularly important with the upcoming support for the device tree via IGVM, which can have stricter memory constraints. Signed-off-by: Luigi Leonardi --- hw/i386/microvm-dt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index 45fbb5bbd1..9de2abf92c 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -43,6 +43,8 @@ =20 #include "microvm-dt.h" =20 +#include + static bool debug; =20 static void dt_add_microvm_irq(MicrovmMachineState *mms, @@ -326,6 +328,7 @@ void dt_setup_microvm(MicrovmMachineState *mms) X86MachineState *x86ms =3D X86_MACHINE(mms); MachineState *ms =3D MACHINE(mms); int size =3D 0; + int ret; =20 ms->fdt =3D create_device_tree(&size); =20 @@ -337,6 +340,12 @@ void dt_setup_microvm(MicrovmMachineState *mms) qemu_fdt_add_subnode(ms->fdt, "/chosen"); dt_setup_sys_bus(mms); =20 + ret =3D fdt_pack(ms->fdt); + /* Should only fail if we've built a corrupted tree */ + g_assert(ret =3D=3D 0); + + size =3D fdt_totalsize(ms->fdt); + /* add to fw_cfg */ if (debug) { fprintf(stderr, "%s: add etc/fdt to fw_cfg\n", __func__); --=20 2.54.0 From nobody Sat Jun 13 11:48:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1780911515; cv=none; d=zohomail.com; s=zohoarc; b=Za+nXG3sTR8hh1wbMOUrxD0LtFqw7GG/hwaECU2TJx7Yufd9Ce99oClCdihwgdqVN4nh2SVNhk2Q0Nd+fGRANm9SecuFnCr0KzL/PqbdA1AcIrBYUJxSEktt49kxe6Zedt2wU9VHKRiP/dSgQf0EJEyjFIB1lFQ1p471nGdwjrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780911515; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lERmOCsXaBThSpmPhBAc5PHRI8A4GCkVr7Qr8Mu3kfI=; b=BKZX670YlRy9oZDOZtvEM9sgZXiNnwgXKVHZ4O3FcUwBYgH4BJAbOBfhPRr8SO3K4P0aDQwfMirBM025vIEaJaXRRiLBQ9TqdVEwfzEXHPtnASEb0XDTFH00OL5F6FWmiYomKV3AAwoL+lgkMl+ENvEmQj6q4OtdmL9BbxNzHGg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178091151506617.409909140235868; Mon, 8 Jun 2026 02:38:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wWWRE-0005nK-2e; Mon, 08 Jun 2026 05:38:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wWWR3-0005dZ-Bi for qemu-devel@nongnu.org; Mon, 08 Jun 2026 05:38:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wWWQz-0005UJ-3t for qemu-devel@nongnu.org; Mon, 08 Jun 2026 05:38:21 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-314-KhfdSu42MKqzQj8nSojGCQ-1; Mon, 08 Jun 2026 05:38:14 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-45eecec7667so2989109f8f.3 for ; Mon, 08 Jun 2026 02:38:14 -0700 (PDT) Received: from lleonard-thinkpadx1carbongen13.rmtit.csb ([176.206.19.176]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f34413csm50144923f8f.21.2026.06.08.02.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 02:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780911496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lERmOCsXaBThSpmPhBAc5PHRI8A4GCkVr7Qr8Mu3kfI=; b=FMLoKgMQhOetEZ+kjvJjJfPeMvXwGmFLNR3AUT9JA9pvj2eDVmT6QwqR9Fg1ZPnqENsibZ bJpOZEdj8cWdAHBmafyWwxULxyN+cz5IhLybucKWYBkjC43k/9RZhJiLDlKqrEkRMFZ/1v xTFQNs2eNCVPYz75UMRsBlJ/F0O4lbA= X-MC-Unique: KhfdSu42MKqzQj8nSojGCQ-1 X-Mimecast-MFC-AGG-ID: KhfdSu42MKqzQj8nSojGCQ_1780911494 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780911494; x=1781516294; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lERmOCsXaBThSpmPhBAc5PHRI8A4GCkVr7Qr8Mu3kfI=; b=GH0uHflIXK4MrX6aJU6SH4v7rG8BpyIO/7NXTn3W1/UeVQYGF8zcunY3LlxomkpHF6 afuLduhM4nmn2VWbR5DiKiVJWxCCYB8mMD4H6rKeBpnRZh2YoGGJl0YctjKO68peH1ha nIQbkKqD698fmAGOs/w6FD97RwpW2J4WpLbP0kcqPQLuwDGVEKCn2ybIdDWs3WNw7peH AZovkdromu4s+TttKOx65NKksCiSsZpDStzvtUhL8wN9aOj+DVVq7+mrwVXzr2kF7q7o Ydz0Npx/VAK26JJ8aD487bKOYCCDTP0mk2do9nlWInAIiwzPUwYb0n6F7aQ8Tspo3owP UDsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780911494; x=1781516294; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=lERmOCsXaBThSpmPhBAc5PHRI8A4GCkVr7Qr8Mu3kfI=; b=G3nRkv4IZyQYWoYeZZfxZjAn1KWOZj5eoNlzWSMaawKaBtM2CzEs8reHMTik2jdxas 8mcy9S0g6ddw8JPnHL6vo9qOzMHPeNFyfRwPoXtsNjSSuP+ObuT2fIOajIC0cyz+PF0O f/czFfnBjZvw1Nwjdb0fQYsbbctRrfL2uBGWA/Jh05XZp/ZZATvk9OBEmF7vjoLVbqO3 fD6hQhSSYSvjMFqxdghJV1m5QFoZ6mmkEPPgnuHbxNPigZPvPo63oCZeJI5Xu7Lv9nl/ EzhsaAqPWZKblyoMFJZE1D0hT0o6uKbea827+N9+wroW+vKBkCq5bNPO+u4idFvPCAGm UB8Q== X-Gm-Message-State: AOJu0YzNFqR44+YqARpkXNsumAyc45Sj3l8AivC6Di1r24M2RmZjM/PZ gyavv+eCnZuA8A2CPXqoYqpSoIqIwgSQeiHCZT0Jc0DMWgMB0fLbelmMiVj6xlMNm94F+R0l1P9 iPfm080W9nuS9in9qYv930SwhMOZTtOzZiIG0f2LxL3hFYG/jLbagHScF X-Gm-Gg: Acq92OGego51e2jyjwAKIGPDGzBfYKxDXaaP0p4pTarrNrutYSTOIhx/3cI/pMLLLh4 1OQi7eGEUVI4+S42AeWEI/pUOqf0v6VuIPlwW5QH1VsDtmQlT/t87a9UCUR0dONULusQFA2of6l O1UuldnhIAvu4ODcRrYSCWotRViIpmc31jLmoEQegHi2h/F0WMdM7JBPatDd57YF+3U00UUliQl vcK7mHIcu4+Tf4d2JbTN9RK41/oSkn+2JTQsj0mj2rtEP2zTzREVcJuZAXIf0mUoePu7VDbsjpW LXKtD1JreK2MSBhxtdJojR7XqbjX9BvBXR1BCVbwHUSS1tptEyuAnxCWTDLrfQZATfhEr1Z8gcD 8omUJsSDWhHUZCl6o+ntKrYRVuaFhRQCUIqp9PTaK8sXTiewoM+ti1fsm1IhvQxZEwKKsB6r6jW sbWltWDrgPKlZOw2wjhhG/Oi2VmyA= X-Received: by 2002:a05:6000:178e:b0:460:3234:293e with SMTP id ffacd0b85a97d-46032342a79mr22510145f8f.41.1780911493622; Mon, 08 Jun 2026 02:38:13 -0700 (PDT) X-Received: by 2002:a05:6000:178e:b0:460:3234:293e with SMTP id ffacd0b85a97d-46032342a79mr22510096f8f.41.1780911493230; Mon, 08 Jun 2026 02:38:13 -0700 (PDT) From: Luigi Leonardi Date: Mon, 08 Jun 2026 11:37:47 +0200 Subject: [PATCH 2/2] igvm: Fill device tree IGVM parameter field on x86_64 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260608-microvm_device_tree-v1-2-730874ad0008@redhat.com> References: <20260608-microvm_device_tree-v1-0-730874ad0008@redhat.com> In-Reply-To: <20260608-microvm_device_tree-v1-0-730874ad0008@redhat.com> To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Paolo Bonzini , Richard Henderson , Gerd Hoffmann , Stefano Garzarella , Ani Sinha , Zhao Liu , Oliver Steffen , Luigi Leonardi X-Mailer: b4 0.14.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=leonardi@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1780911517245154100 Coconut SVSM, with the upcoming device tree support[1], will use the IGVM device tree parameter to discover virtio-mmio and ISA serial devices instead of relying on the fw_cfg interface, which is QEMU-specific. The IGVM parameter handler is implemented for the i386 machine target and stubbed for all others. [1] https://github.com/coconut-svsm/svsm/pull/1006 Signed-off-by: Luigi Leonardi --- backends/igvm.c | 2 ++ include/system/igvm.h | 2 ++ stubs/igvm.c | 6 ++++++ target/i386/igvm.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/backends/igvm.c b/backends/igvm.c index c347d0c17e..9c6bee4add 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -130,6 +130,8 @@ static struct QIGVMHandler handlers[] =3D { qigvm_initialization_guest_policy }, { IGVM_VHT_MADT, IGVM_HEADER_SECTION_DIRECTIVE, qigvm_directive_madt }, + { IGVM_VHT_DEVICE_TREE, IGVM_HEADER_SECTION_DIRECTIVE, + qigvm_directive_device_tree }, }; =20 static int qigvm_handler(QIgvm *ctx, uint32_t type, Error **errp) diff --git a/include/system/igvm.h b/include/system/igvm.h index 64d3542311..d39f3d55f1 100644 --- a/include/system/igvm.h +++ b/include/system/igvm.h @@ -32,5 +32,7 @@ int qigvm_x86_set_vp_context(void *data, int index, * IGVM parameter handlers */ int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **e= rrp); +int qigvm_directive_device_tree(QIgvm *ctx, const uint8_t *header_data, + Error **errp); =20 #endif diff --git a/stubs/igvm.c b/stubs/igvm.c index 9e9f683fc9..b4d533ad24 100644 --- a/stubs/igvm.c +++ b/stubs/igvm.c @@ -29,3 +29,9 @@ int qigvm_directive_madt(QIgvm *ctx, const uint8_t *heade= r_data, Error **errp) { return -1; } + +int qigvm_directive_device_tree(QIgvm *ctx, const uint8_t *header_data, + Error **errp) +{ + return -1; +} diff --git a/target/i386/igvm.c b/target/i386/igvm.c index f41b498b89..13db6e9be0 100644 --- a/target/i386/igvm.c +++ b/target/i386/igvm.c @@ -11,6 +11,8 @@ =20 #include "qemu/osdep.h" =20 +#include + #include "cpu.h" #include "hw/i386/e820_memory_layout.h" #include "hw/i386/acpi-build.h" @@ -210,3 +212,37 @@ int qigvm_directive_madt(QIgvm *ctx, const uint8_t *he= ader_data, Error **errp) g_array_free(madt, true); return result; } + +/* + * Process device tree IGVM parameter + */ +int qigvm_directive_device_tree(QIgvm *ctx, const uint8_t *header_data, + Error **errp) +{ + const IGVM_VHS_PARAMETER *param =3D (const IGVM_VHS_PARAMETER *)header= _data; + QIgvmParameterData *param_entry; + uint32_t fdt_size; + + /* Find the parameter area that should hold the device tree data */ + param_entry =3D qigvm_find_param_entry(ctx, param->parameter_area_inde= x); + if (param_entry =3D=3D NULL) { + return 0; + } + + if (ctx->machine_state->fdt =3D=3D NULL) { + error_setg(errp, "IGVM: device tree not available"); + return -1; + } + + fdt_size =3D fdt_totalsize(ctx->machine_state->fdt); + if (fdt_size > param_entry->size) { + error_setg(errp, + "IGVM: device tree size exceeds parameter area" + " defined in IGVM file"); + return -1; + } + + memcpy(param_entry->data, ctx->machine_state->fdt, fdt_size); + + return 0; +} --=20 2.54.0