From nobody Thu May  8 19:02:45 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1734096901; cv=none;
	d=zohomail.com; s=zohoarc;
	b=YnxwT9wLTGN8B5GMwTg/BXe0a+TvMn+y0kfd4lw3O8JOY5Wj5iXqxW3Euyk8h4eyh1BWB+4DpLROQEUkIEvI4g3ModBQIHO/JsodB2uqot+9wp9R2gF1s1tW+gl0FF8D6KV5f0VSv+D41nMEXgdHHWLYxbn9PFegac7yHg0UNgM=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1734096901;
 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=WlswgE/eUO5zmvvMPBofBLx3raLRd7GBRUggU9AjFY8=;
	b=kf3Zj1Re7suhsRl5xkcoSsY2DWqsLhQh52fUQcrOFy+7fGPoMarFF9zJU4QZcX8yebEfsIQbg+xY+c8txJ1BEUZ2FOnUWCaXuhtu8YrPn+YreVnNIdTunRja0l7v4zp2Wce9GYGAMF1emliYKVFrGjru6T8jdPH3aunf2BJlbz4=
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=<philmd@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1734096901387425.55669927819133;
 Fri, 13 Dec 2024 05:35:01 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tM5oQ-0005IN-H8; Fri, 13 Dec 2024 08:34:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5ny-0005AL-7i
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:11 -0500
Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5nv-00014y-Cm
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:05 -0500
Received: by mail-wr1-x42b.google.com with SMTP id
 ffacd0b85a97d-385deda28b3so1299389f8f.0
 for <qemu-devel@nongnu.org>; Fri, 13 Dec 2024 05:34:01 -0800 (PST)
Received: from localhost.localdomain (88-187-86-199.subs.proxad.net.
 [88.187.86.199]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-436255531dasm48965815e9.8.2024.12.13.05.33.58
 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
 Fri, 13 Dec 2024 05:33:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=linaro.org; s=google; t=1734096840; x=1734701640; darn=nongnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=WlswgE/eUO5zmvvMPBofBLx3raLRd7GBRUggU9AjFY8=;
 b=IjtpxrzuxdaEX3fkeS7JbkX83ZVBNxAQSPxvsRLm3MpaXfaGj/BRo6fmcH58vSWHm5
 qcN4Xj82oIKb/0kZUjMj0KfzE7u3jYmjlQ9UcTjgJoRLyrLQN5koQd1Pjit6ZsIyoqDr
 FCjZzw/NG32/NDNev+jEvoU2DFXoT4dQH5bGRmW7V+yzVbn3/kWjgyyDf8PPlUrUw2bA
 8DoPgMutmrWQ1ydQ+uPBiF6+R9IM5v1kGd1E+gbaNx1kFiRZii+eUswfcU30aINvloul
 d6vOpDgp5wLzXM4UriXKXmT9lJk5Xn6z/ttpkOc9jF8Z8VDk+mvARFmn9tZY1WtShKW8
 g02Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734096840; x=1734701640;
 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:message-id:reply-to;
 bh=WlswgE/eUO5zmvvMPBofBLx3raLRd7GBRUggU9AjFY8=;
 b=Q7EyP+FUfQafPiWvfZIYBv63h0KSNxy6ZAdafcd5CVDzI+Zzhhp3m2si98VCBZjHEV
 DSZCnW6RQDvq6Xlm4rtDmgz/0B3qXazsQ9U1g+yqsErt00V9jFvJoiJ5dsITVvx+sp82
 Oy5nNBe0NMLTO/Hpccn/gLnBRvI5Ok3ADSNDSQ0qHxXb1epB8ya5KfPBuXQ7/TWgEncU
 Du7Gt09wDT2l7edTDKd10owGZFS3Eo3aOWQv6eQT8JJQWkSGNGddBckPtYigyKaoTKho
 RkRP3QxbPhINjgSlijQPmXuG951n6essyFWBTMw7nWFam/C8aE3R6QvbWyOuBMahVdhv
 RAgA==
X-Gm-Message-State: AOJu0YyoRoUhHGP+Hpt7ywRZi/mIukwWIHBZVud5qxgxj2ze2DrOLwJN
 /foGtR7Id8xxA9W6NVE+xDyNnFnMtRJr0rxuK1ZA9uXMluSZ4qowJdqD29e6ljGzFQnBfyFvKPT
 j
X-Gm-Gg: ASbGncveEDiXFyRInQE775ymF/vLFeMKF87kXb1pkU9Nm37YywZVCr4ffYXtoAO9+Ge
 aJqae2to2cW9YdzvXyK4a52S9M2G7IFo76XqtjO2dYJJVj8rPIjaaFe9XmxH65G5mp/f5GlgBr+
 HSXgdFRm0kCciC/3p3jZDgt+zlQsVdVLPtK3WXH/I439+OYc5C+KgDCL6VLg0bYzQ2UeQRV57KT
 YtZx2xWwPB7dloiFQx5cZV7tHE1wydEhJDUIxJRIM8C8ZkRhR/0n9i2tJaeCNwQ8wxb40FFbTJT
 AzuSMGVLpqZyMHlZUng4UAfih4BHb7+aM7sP
X-Google-Smtp-Source: 
 AGHT+IGV9gZYYybQXcMBoG+tUlEWZXZdxsf0Ak6kGnWW1Jywsdv5abqYvY/qrcHoLxGXaPhpQsTm6g==
X-Received: by 2002:a05:6000:4616:b0:385:dedb:a148 with SMTP id
 ffacd0b85a97d-3888e0ac4f4mr1863536f8f.46.1734096839885;
 Fri, 13 Dec 2024 05:33:59 -0800 (PST)
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
 =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
Subject: [PATCH v2 1/7] hw/nvram/fw_cfg: Rename
 fw_cfg_add_[file]_from_generator()
Date: Fri, 13 Dec 2024 14:33:46 +0100
Message-ID: <20241213133352.10915-2-philmd@linaro.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241213133352.10915-1-philmd@linaro.org>
References: <20241213133352.10915-1-philmd@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::42b;
 envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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 @linaro.org)
X-ZM-MESSAGEID: 1734096902308116600

fw_cfg_add_from_generator() is adding a 'file' entry,
so rename as fw_cfg_add_file_from_generator() for
clarity. Besides, we might introduce generators for
other entry types.

Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@linaro.org>
Reviewed-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 include/hw/nvram/fw_cfg.h | 6 +++---
 hw/nvram/fw_cfg.c         | 4 ++--
 system/vl.c               | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index fa426776192..14e68966c59 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -291,7 +291,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *fil=
ename, void *data,
                          size_t len);
=20
 /**
- * fw_cfg_add_from_generator:
+ * fw_cfg_add_file_from_generator:
  * @s: fw_cfg device being modified
  * @filename: name of new fw_cfg file item
  * @gen_id: name of object implementing FW_CFG_DATA_GENERATOR interface
@@ -307,8 +307,8 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *fil=
ename, void *data,
  *
  * Returns: %true on success, %false on error.
  */
-bool fw_cfg_add_from_generator(FWCfgState *s, const char *filename,
-                               const char *gen_id, Error **errp);
+bool fw_cfg_add_file_from_generator(FWCfgState *s, const char *filename,
+                                    const char *gen_id, Error **errp);
=20
 /**
  * fw_cfg_add_extra_pci_roots:
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index b644577734c..fe3b86135a7 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1027,8 +1027,8 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *f=
ilename,
     return NULL;
 }
=20
-bool fw_cfg_add_from_generator(FWCfgState *s, const char *filename,
-                               const char *gen_id, Error **errp)
+bool fw_cfg_add_file_from_generator(FWCfgState *s, const char *filename,
+                                    const char *gen_id, Error **errp)
 {
     FWCfgDataGeneratorClass *klass;
     GByteArray *array;
diff --git a/system/vl.c b/system/vl.c
index 2f855d83fbb..f103532a9a1 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1184,7 +1184,7 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts,=
 Error **errp)
         size =3D strlen(str); /* NUL terminator NOT included in fw_cfg blo=
b */
         buf =3D g_memdup(str, size);
     } else if (nonempty_str(gen_id)) {
-        if (!fw_cfg_add_from_generator(fw_cfg, name, gen_id, errp)) {
+        if (!fw_cfg_add_file_from_generator(fw_cfg, name, gen_id, errp)) {
             return -1;
         }
         return 0;
--=20
2.45.2


From nobody Thu May  8 19:02:45 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1734096976; cv=none;
	d=zohomail.com; s=zohoarc;
	b=JZ8G0jA6Jvr/ISd8gCP3ebuzXsFaFMJ+PtUgeYp+r0XCzymg0xDnyiC3bkV2uUzyvmKSELfMbCH9IE8Un4NL1DjQUP/RNpXhP0ulf9DOxRe9kulMnzqUtplbNS3KLdKioekuerlLzWpNg+8G/rYFHwrG89aDsCtICnE2VGpodcI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1734096976;
 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=3yF4gTyIXghUKxGkr5yLxPBvl2lN3UWs2PgcMEYcsVo=;
	b=CUC8A71xXe7nEBZEN0YqDQagmeusVusUhH0PNANAbAuf29MyMnn4Y+WB0g5C2e0LA836mX7kxrWopZEj5eigp9lExO/BLJifNrUakH/vrciG4CB3o64lJRtdZB2c11XKFSU48RrVFuIMwNLWZJUDA552T9wfHzM9ESP7CHkISWE=
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=<philmd@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 173409697652624.550335401490315;
 Fri, 13 Dec 2024 05:36:16 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tM5p4-0005f4-VG; Fri, 13 Dec 2024 08:35:15 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5o0-0005AW-NY
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:13 -0500
Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5ny-00015W-NG
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:08 -0500
Received: by mail-wr1-x431.google.com with SMTP id
 ffacd0b85a97d-3862d16b4f5so1162860f8f.0
 for <qemu-devel@nongnu.org>; Fri, 13 Dec 2024 05:34:06 -0800 (PST)
Received: from localhost.localdomain (88-187-86-199.subs.proxad.net.
 [88.187.86.199]) by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38782521dfesm6969358f8f.107.2024.12.13.05.34.03
 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
 Fri, 13 Dec 2024 05:34:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=linaro.org; s=google; t=1734096844; x=1734701644; darn=nongnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=3yF4gTyIXghUKxGkr5yLxPBvl2lN3UWs2PgcMEYcsVo=;
 b=Qz6cua3o3GmLITMHIWaoM+dqq8LkublH2Ui8KZHaNkZOFBVG/oiJ3BVoBVeexanO0g
 o9mwRgf4s+rRjFufr+1g+xq8dVk2yci8waQm/POFqLfW8tXRFuhMtzbT31nAHLmRHvfd
 pAzY7xFwuSHqBe8VgPQC1XdpnbF6p9/6bIMkWAzC4xpM8QhMRbE/0TP53pnsLSxofAXU
 Gcxb/cEWQ3hU3q+BnU2zbaaHpWdbmxa5p0xLaxfyFO2sx9/Y7r9k4cuEX41FYKfaEyEd
 ogiksFdAwCr+WgiOge+jlEJrZjGvIXmOGQs+hv80jBQHCZ83Nczo7vPnNSLDLESfFi8b
 acww==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734096844; x=1734701644;
 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:message-id:reply-to;
 bh=3yF4gTyIXghUKxGkr5yLxPBvl2lN3UWs2PgcMEYcsVo=;
 b=St4hgbdYdkV4D3gpPdoAbyn5lYixI5FtiqoTzdu7cU5irnm7Rk4jfTf567S51Vxmmg
 tg0WTop5xJRJONLoePecHc+yYy7wGJZSpS3+FErO/NkAP4zThiVjKd5VpqoSi+XJ++VJ
 HF4D1iBwoVZz/7dUTUspOZbEvjlq8lOWxUIkZ0efEr3mXm/otq/+EJUgSsELbgRdHYA+
 cZNBXgKr+ftSAAmix4cD6oFEKnc33oLpf2vFAU1Uf+vftRMEsGw/0HMyOIOOxb5jvibi
 yanSXirWSCCtkvws5TaQ0fmxuE9jqPnbgcgGOqStIKqBUlBxrukGIpyQ5qGNQP0yD1Sw
 CWlw==
X-Gm-Message-State: AOJu0YwNkrLRFmQ2g9GZ6gdK5kMeh0N7C2ikkoV86GKBya/fUwsW8CS7
 5hJT3L+T29P9ZdEK1OH9Waa5g+h8b49357v7hiFhRDUdKXLWxR4wNcFH4ziDpdIozStEDukxp98
 o
X-Gm-Gg: ASbGnct874FpCyxIUzEQZqf58LHCYfrf4GOP79UCkhw1vduYTngb9dsGBqvKk/9DnHU
 XMK8xlGok3ujFHK8b3pWW3rqPJfAzMxFQXIkEa1Npk7IVI0v4hKUTSiXFAkhYG/5YmW4QiKl0IL
 K4dDPPwxEQEp9hrXSed39o6G5WJokOjxHbtk9dmdOY2F/EX/NzRZd00C82Mmnap/TYCbzbB288T
 wtK9y+Zvmsmq/rZ0tVk4VQi2WWeA3/4UN5ZMZ9DuWK/kv/P6G3Msva4izeFgvC+CQoYR8tQDJKU
 Gvvugn46jA/eh2lMp7qXxHmRndfeVOLcGzgk
X-Google-Smtp-Source: 
 AGHT+IEjTQJud7HmuB8/EGY4i4Ze6Zwa+TKzED1E3xO8dWvKlxSgYnShXY87DFpU7p00buQ80O1lxA==
X-Received: by 2002:a05:6000:491b:b0:386:3d27:b4f0 with SMTP id
 ffacd0b85a97d-38788805406mr6166037f8f.14.1734096844432;
 Fri, 13 Dec 2024 05:34:04 -0800 (PST)
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
 =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
Subject: [PATCH v2 2/7] hw/nvram/fw_cfg: Pass QOM parent to
 fw_cfg_add_file_from_generator()
Date: Fri, 13 Dec 2024 14:33:47 +0100
Message-ID: <20241213133352.10915-3-philmd@linaro.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241213133352.10915-1-philmd@linaro.org>
References: <20241213133352.10915-1-philmd@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::431;
 envelope-from=philmd@linaro.org; helo=mail-wr1-x431.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=unavailable 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-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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 @linaro.org)
X-ZM-MESSAGEID: 1734096978569116600

Currently fw_cfg_add_file_from_generator() is restricted
to command line created objects which reside in the
'/objects' QOM container. In order to extend to other
types of containers, pass the QOM parent by argument.

Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@linaro.org>
Reviewed-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 include/hw/nvram/fw_cfg.h | 10 ++++++----
 hw/nvram/fw_cfg.c         | 11 ++++++-----
 system/vl.c               |  3 ++-
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index 14e68966c59..fcb06f18cc3 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -294,11 +294,12 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *f=
ilename, void *data,
  * fw_cfg_add_file_from_generator:
  * @s: fw_cfg device being modified
  * @filename: name of new fw_cfg file item
- * @gen_id: name of object implementing FW_CFG_DATA_GENERATOR interface
+ * @part: name of object implementing FW_CFG_DATA_GENERATOR interface
+ * @parent: the object in which to resolve the @part
  * @errp: pointer to a NULL initialized error object
  *
  * Add a new NAMED fw_cfg item with the content generated from the
- * @gen_id object. The data generated by the @gen_id object is copied
+ * @part object. The data generated by the @part object is copied
  * into the data structure of the fw_cfg device.
  * The next available (unused) selector key starting at FW_CFG_FILE_FIRST
  * will be used; also, a new entry will be added to the file directory
@@ -307,8 +308,9 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *fil=
ename, void *data,
  *
  * Returns: %true on success, %false on error.
  */
-bool fw_cfg_add_file_from_generator(FWCfgState *s, const char *filename,
-                                    const char *gen_id, Error **errp);
+bool fw_cfg_add_file_from_generator(FWCfgState *s,
+                                    Object *parent, const char *part,
+                                    const char *filename, Error **errp);
=20
 /**
  * fw_cfg_add_extra_pci_roots:
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index fe3b86135a7..b94cd27bd85 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1027,22 +1027,23 @@ void *fw_cfg_modify_file(FWCfgState *s, const char =
*filename,
     return NULL;
 }
=20
-bool fw_cfg_add_file_from_generator(FWCfgState *s, const char *filename,
-                                    const char *gen_id, Error **errp)
+bool fw_cfg_add_file_from_generator(FWCfgState *s,
+                                    Object *parent, const char *part,
+                                    const char *filename, Error **errp)
 {
     FWCfgDataGeneratorClass *klass;
     GByteArray *array;
     Object *obj;
     gsize size;
=20
-    obj =3D object_resolve_path_component(object_get_objects_root(), gen_i=
d);
+    obj =3D object_resolve_path_component(parent, part);
     if (!obj) {
-        error_setg(errp, "Cannot find object ID '%s'", gen_id);
+        error_setg(errp, "Cannot find object ID '%s'", part);
         return false;
     }
     if (!object_dynamic_cast(obj, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE)) {
         error_setg(errp, "Object ID '%s' is not a '%s' subclass",
-                   gen_id, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE);
+                   part, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE);
         return false;
     }
     klass =3D FW_CFG_DATA_GENERATOR_GET_CLASS(obj);
diff --git a/system/vl.c b/system/vl.c
index f103532a9a1..4a370da624a 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1184,7 +1184,8 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts,=
 Error **errp)
         size =3D strlen(str); /* NUL terminator NOT included in fw_cfg blo=
b */
         buf =3D g_memdup(str, size);
     } else if (nonempty_str(gen_id)) {
-        if (!fw_cfg_add_file_from_generator(fw_cfg, name, gen_id, errp)) {
+        if (!fw_cfg_add_file_from_generator(fw_cfg, object_get_objects_roo=
t(),
+                                            gen_id, name, errp)) {
             return -1;
         }
         return 0;
--=20
2.45.2


From nobody Thu May  8 19:02:45 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1734096974; cv=none;
	d=zohomail.com; s=zohoarc;
	b=X37vN54PQeUNmHTyA0kttexcuTrIXTMByAKNf8cK2Os3bQ+1TX0tBvrgohY6VVR1Jil1Kn6565p/habLY+0aQlwQWM1ABKYFoPwj4rSNDGMGZp7SplI/w8AqE0wytVTBq5LpmKBe4MyQYFwygpsRgRP83EMFeMjo3KiAdJ2kpTw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1734096974;
 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=33yHg4YQB7rIHCnPM4ck8re7RPKyKODYcLX3k+hKjac=;
	b=Ln9hda57AUTD/fg99TasqO6zae5rn1k/xeWstYUgolv2ZMU6ZrG9zTXF9QzGwdGE4e8x+XqZqK/kIi2oGL4Yk3Ainanvj5gzSecf2t5pEGRxP+CSk+1pALonwd48qami2riV5gl8crVl5WFzgN5cZOVfINZmxcqkEfwCwLSykq8=
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=<philmd@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1734096974771254.16738172831003;
 Fri, 13 Dec 2024 05:36:14 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tM5p8-0005lk-1e; Fri, 13 Dec 2024 08:35:18 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5o9-0005BW-6K
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:19 -0500
Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5o4-00016J-PE
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:15 -0500
Received: by mail-wm1-x330.google.com with SMTP id
 5b1f17b1804b1-435004228c0so21167475e9.0
 for <qemu-devel@nongnu.org>; Fri, 13 Dec 2024 05:34:10 -0800 (PST)
Received: from localhost.localdomain (88-187-86-199.subs.proxad.net.
 [88.187.86.199]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-436257178e3sm50186895e9.41.2024.12.13.05.34.08
 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
 Fri, 13 Dec 2024 05:34:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=linaro.org; s=google; t=1734096849; x=1734701649; darn=nongnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=33yHg4YQB7rIHCnPM4ck8re7RPKyKODYcLX3k+hKjac=;
 b=X6rEjXTS+l+IiT9IAS809useh+8FFac9ocG4tUomt/x1FRL2KceBlw4lzShL/kBWJk
 xLea8Rw8U/FmzBHoJTmvymptCBJImXnEYHy1mticnoC9u4ASbl789FpyMg+VkHbpQAbS
 i+KCnY9pohqEGA5aGEmN3Ij3JSbERYNNDmaVfh7hZjdEAcqNbGVeu9a+8Jiuq9ToGkhw
 5kyHl9U2iuUT4Kw6ShvtiKDD5G98GZi3SypkBQHwG6P5wTHCd8chRELL/0IfK3xU8Joq
 wxCLIrbsg//85qrqO0kqLpR60GT4GYeNDh1XaALF9AaoF5E3nuJdHJyQFsWmWDSzcyyi
 L+ZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734096849; x=1734701649;
 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:message-id:reply-to;
 bh=33yHg4YQB7rIHCnPM4ck8re7RPKyKODYcLX3k+hKjac=;
 b=WFk18gYCcdWVBugCDmYCvM0MzAfUVEjHU/A+DLm699D/dptOjrcPW3Rg54hhh97Fyx
 B/UtZOofcQrQdLnI6SXbWmVrTE/MeF+4oz0ORqZ6a6gwuzbaRKGF0n0JzK3TRq49saqK
 udxqBa6snVy7gRh1VCiZJsLuRxnbjQxQ5dNUw+8EZrAlv62pxE13p3jB7T03slDNrYqR
 yf3vUbTDNzA9V7TcwHoZyog4NCTK8Jp+0CxpTBVw9xJDDnaOzQuSI9CNd2c840U0NwNw
 vqM8Aj0lM7XL64VbolMAg4Ui+sk9OJ/Fd+LQn1WRR3AKvzabmB7kA0EFfK4Dg/Hx6No0
 UFwA==
X-Gm-Message-State: AOJu0Yx9QLTby+c5w4Twj9JfvBBGbS/d3/LwT6nFDwzaEdwZGIpqd+Sq
 be4MGsp/p5VT3XHx+iHuVG3cVhXJEvWI/5ecvbdaQZi/5uMz6j3SXyZ009e5DYIy5rjfIMVqpGy
 f
X-Gm-Gg: ASbGncuJ4OX7FPCt7gat99iULD0nIpB/asM4BUpMlAtwRgGN/61kMLQa5is1w56Tt8+
 +CEH19zAN8tufJOufRvGp1Nck/NOPHmcRic2tY0k+p/hBWxhiLSOS+9JtVENqHwVJKTtLBe9/dG
 gohK6BNhsbWtHOJgX07ARQ4GP4+UiRi8SqJVPunFaEtGlkeuE1n2QbphFbxUasxF89Jcp36Vql5
 ylzZvzsWzDvUC9tWFQxTVwytVJWkdt3PZcLAxxR5tL8pUgo6RW/W7zKyui/L0UI8NuJUNV0t48V
 B/00KC4ocjwNkoGx9hGsCWUrOZJbfAcGQp9r
X-Google-Smtp-Source: 
 AGHT+IHJCQkWjdUS9JM+Or0PrYfr25uOj/EPsYAQ18w+d1tMFeDwJSAwNGr9B9vhcQB4Lk7iOvOf1w==
X-Received: by 2002:a05:600c:450e:b0:434:a852:ba77 with SMTP id
 5b1f17b1804b1-4362aa4ffe0mr24695125e9.15.1734096848901;
 Fri, 13 Dec 2024 05:34:08 -0800 (PST)
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
 =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
Subject: [PATCH v2 3/7] hw/nvram/fw_cfg: Skip FW_CFG_DATA_GENERATOR when no
 data to generate
Date: Fri, 13 Dec 2024 14:33:48 +0100
Message-ID: <20241213133352.10915-4-philmd@linaro.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241213133352.10915-1-philmd@linaro.org>
References: <20241213133352.10915-1-philmd@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::330;
 envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=unavailable 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-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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 @linaro.org)
X-ZM-MESSAGEID: 1734096976588116600

Allow the FW_CFG_DATA_GENERATOR interface get_data() handler to
return NULL when there is nothing to generate. In that case
fw_cfg_add_file_from_generator() will not add any item and
return %true.

Reported-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@linaro.org>
---
 include/hw/nvram/fw_cfg.h | 13 ++++++++-----
 hw/nvram/fw_cfg.c         | 10 ++++++----
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index fcb06f18cc3..5211018fd8f 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -30,8 +30,9 @@ struct FWCfgDataGeneratorClass {
      * @obj: the object implementing this interface
      * @errp: pointer to a NULL-initialized error object
      *
-     * Returns: reference to a byte array containing the data on success,
-     *          or NULL on error.
+     * Returns: NULL on failure (errp set if not NULL).
+     *          A byte array containing the data (if any,
+     *          otherwise NULL) on success.
      *
      * The caller should release the reference when no longer
      * required.
@@ -298,14 +299,16 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *f=
ilename, void *data,
  * @parent: the object in which to resolve the @part
  * @errp: pointer to a NULL initialized error object
  *
- * Add a new NAMED fw_cfg item with the content generated from the
- * @part object. The data generated by the @part object is copied
- * into the data structure of the fw_cfg device.
+ * If the @part object generates content, add a new NAMED fw_cfg item with=
 it.
+ * The data generated by the @part object is copied into the data structur=
e of
+ * the fw_cfg device.
  * The next available (unused) selector key starting at FW_CFG_FILE_FIRST
  * will be used; also, a new entry will be added to the file directory
  * structure residing at key value FW_CFG_FILE_DIR, containing the item na=
me,
  * data size, and assigned selector key value.
  *
+ * If the @part object does not generate content, no fw_cfg item is added.
+ *
  * Returns: %true on success, %false on error.
  */
 bool fw_cfg_add_file_from_generator(FWCfgState *s,
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index b94cd27bd85..7e1065e5f50 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1031,10 +1031,10 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,
                                     Object *parent, const char *part,
                                     const char *filename, Error **errp)
 {
+    ERRP_GUARD();
     FWCfgDataGeneratorClass *klass;
     GByteArray *array;
     Object *obj;
-    gsize size;
=20
     obj =3D object_resolve_path_component(parent, part);
     if (!obj) {
@@ -1048,11 +1048,13 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,
     }
     klass =3D FW_CFG_DATA_GENERATOR_GET_CLASS(obj);
     array =3D klass->get_data(obj, errp);
-    if (!array) {
+    if (*errp) {
         return false;
     }
-    size =3D array->len;
-    fw_cfg_add_file(s, filename, g_byte_array_free(array, FALSE), size);
+    if (array) {
+        fw_cfg_add_file(s, filename, g_byte_array_free(array, FALSE),
+                        array->len);
+    }
=20
     return true;
 }
--=20
2.45.2


From nobody Thu May  8 19:02:45 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1734096958; cv=none;
	d=zohomail.com; s=zohoarc;
	b=bKuPM0PNN7j7lpkTRUeVPAfLBK3yQN/xtt9QTXs+YB8C//qYaW0HUcLAw0WhQPZ5kaA6kossDfRLAmjxUSLf7276H8I/x4Rav7a3Z3M7kddoKoUoOOwKKrZNS26YiECxdIKum3clKtDh4phDinDjEFj6/M2afjFpYbuyBGbYuPg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1734096958;
 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=keEAo9CNDWNBW9lBlzlrISyY+AFYXI3pGoxc0E2DIgY=;
	b=Vku/RNFCXxvlSIKBCIcaOI1VpwTuYTvoGLJOQPpeRmgBGAnIuPg2TcZDfnNooLxJATC/Gx+r9YEy0MPETfumwUKFfghWHjnBlojyNCxnETpnKScRqraejD7wKfa9aYWqNXCYkVh47IBFHfZX2ii8DobVwns7c512vPmZiURnZOg=
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=<philmd@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1734096958058514.8639289427888;
 Fri, 13 Dec 2024 05:35:58 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tM5pE-0006BK-Kg; Fri, 13 Dec 2024 08:35:24 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5oB-0005EZ-DE
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:21 -0500
Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5o8-00016Z-VC
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:18 -0500
Received: by mail-wm1-x334.google.com with SMTP id
 5b1f17b1804b1-4361dc6322fso11740655e9.3
 for <qemu-devel@nongnu.org>; Fri, 13 Dec 2024 05:34:15 -0800 (PST)
Received: from localhost.localdomain (88-187-86-199.subs.proxad.net.
 [88.187.86.199]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-436256b4556sm48690705e9.33.2024.12.13.05.34.12
 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
 Fri, 13 Dec 2024 05:34:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=linaro.org; s=google; t=1734096853; x=1734701653; darn=nongnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=keEAo9CNDWNBW9lBlzlrISyY+AFYXI3pGoxc0E2DIgY=;
 b=Krziu5I0VYSwqQ6p0LCHeMRO2LNvOJyQigB56OtHvOrwIsWRD2SS0miohndyzqsaXC
 OdBlLqXMFpBR3s+RhkPNFJVtkDwhMd1WQeX04prbgifX+69uDK0mHPuhvm5ZJ1CN0E42
 HtHSBLmyIwExRlYcgPPFsbJst2qqXv5CU8GqoYGUywbhI4bgA7brjYNbBZC+C1Swrk+q
 xaYmx8dk1BoSfGqvDSMfAj5IOaVQr4mTJkW8asPdvFukk6BOveDnRt+F68IfW0YYvCSm
 y0TrXH0XIN60K6Y/PfXIAkds9qIHg7SpnLmNptMkf2jrytnjQF1yctFi+0YU85OB5WR/
 96Jw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734096853; x=1734701653;
 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:message-id:reply-to;
 bh=keEAo9CNDWNBW9lBlzlrISyY+AFYXI3pGoxc0E2DIgY=;
 b=ajZ1XvXrpygQeqH/ISLKArRhV6bW5ZyZsNKgKqhiKF/uZcRHPmwI5IEoWFc2aAZK5H
 TX+G4b74wc/ystvDVRVaW/vGWYKcAkYizjcYXo07k8yiiuc6L1aw5eLa2xASAI7PxCJz
 MlXn2yxUNz3cjvIz9PoIzqG4CFIK6Dw4VhTJph7fhtaDbXnh5TsoNaXIufcpRfIX8Qc2
 By4sRS9iekR2kEeSanTJodIulsfnvfPknVA29q46FyIwK6NDao0HuKuPb8ZWUPgFpejN
 eo7+/b8VCjDC4s1L/zfZCOe/LYMwZxBFD7MQr8v6CzDKq5QrZZICs/6kWww1MRUKnbYH
 Q9RA==
X-Gm-Message-State: AOJu0YyDE7/f0RPdlYTFnQocYBVw82JzxjdJ0Whf2sRt/8vULl+UH6/B
 HN+95Y3VoNdA+GTDkpYMabY4mUzvOKCTF4gAH7V+6sr1mJ6Fb4z4de5QDH1rxeNgl78rwpq9mfK
 T
X-Gm-Gg: ASbGncsyq3BH3fX6XSrCo5OoXycbfiUD22Ps1uhnkJTfx3sqE1YluCOQD2S2MJ8EppQ
 jB7ig4fEIrOj1hmu+Kf14u/ktENIGnosYEr5tar0uh1ZB3wMtgAqRLuV6xf4+KUqO4OW0rd89dQ
 /RRmsangnPXYCTdi6x7czvY0DRdeK5u0ffUiSI7YQcOVhsBmTcQ2HQWYt8Gy70nDqWD0DVwKhaG
 AZEyYZlrygGjm+NOfi5qKEvy1Z/sPx1Nq8cclavpML3exORf4ACLGDeYZJmeFq/xwedezId9eZh
 FUDKEodaRRdzmZQ/FXXTI+nMytgwXVMdhheO
X-Google-Smtp-Source: 
 AGHT+IE0ffWZw+U60PDT7QBRhyibaA5YDxPBq0XXXZqasm/RJH5hNoTjSv/ogL3zZMijlrlO6a1i4Q==
X-Received: by 2002:a5d:584b:0:b0:386:1cd3:8a09 with SMTP id
 ffacd0b85a97d-38880abfd60mr2192970f8f.1.1734096853442;
 Fri, 13 Dec 2024 05:34:13 -0800 (PST)
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
 =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
Subject: [PATCH v2 4/7] hw/pci: Have PCI_BUS implement
 TYPE_FW_CFG_DATA_GENERATOR_INTERFACE
Date: Fri, 13 Dec 2024 14:33:49 +0100
Message-ID: <20241213133352.10915-5-philmd@linaro.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241213133352.10915-1-philmd@linaro.org>
References: <20241213133352.10915-1-philmd@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::334;
 envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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 @linaro.org)
X-ZM-MESSAGEID: 1734096958415116600

The FW_CFG_DATA_GENERATOR interface allows any object to
produce a blob of data consumable by the fw_cfg device.
Implement that for PCI bus objects.

Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@linaro.org>
Reviewed-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 hw/pci/pci.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1416ae202c3..8844251eceb 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -46,6 +46,7 @@
 #include "hw/pci/msix.h"
 #include "hw/hotplug.h"
 #include "hw/boards.h"
+#include "hw/nvram/fw_cfg.h"
 #include "qapi/error.h"
 #include "qemu/cutils.h"
 #include "pci-internal.h"
@@ -216,11 +217,41 @@ static uint16_t pcibus_numa_node(PCIBus *bus)
     return NUMA_NODE_UNASSIGNED;
 }
=20
+static GByteArray *pci_bus_fw_cfg_gen_data(Object *obj, Error **errp)
+{
+    PCIBus *bus =3D PCI_BUS(obj);
+    GByteArray *byte_array;
+    uint64_t extra_hosts =3D 0;
+
+    if (!bus) {
+        return NULL;
+    }
+
+    QLIST_FOREACH(bus, &bus->child, sibling) {
+        /* look for expander root buses */
+        if (pci_bus_is_root(bus)) {
+            extra_hosts++;
+        }
+    }
+
+    if (!extra_hosts) {
+        return NULL;
+    }
+    extra_hosts =3D cpu_to_le64(extra_hosts);
+
+    byte_array =3D g_byte_array_new();
+    g_byte_array_append(byte_array,
+                        (const void *)&extra_hosts, sizeof(extra_hosts));
+
+    return byte_array;
+}
+
 static void pci_bus_class_init(ObjectClass *klass, void *data)
 {
     BusClass *k =3D BUS_CLASS(klass);
     PCIBusClass *pbc =3D PCI_BUS_CLASS(klass);
     ResettableClass *rc =3D RESETTABLE_CLASS(klass);
+    FWCfgDataGeneratorClass *fwgc =3D FW_CFG_DATA_GENERATOR_CLASS(klass);
=20
     k->print_dev =3D pcibus_dev_print;
     k->get_dev_path =3D pcibus_get_dev_path;
@@ -232,6 +263,8 @@ static void pci_bus_class_init(ObjectClass *klass, void=
 *data)
=20
     pbc->bus_num =3D pcibus_num;
     pbc->numa_node =3D pcibus_numa_node;
+
+    fwgc->get_data =3D pci_bus_fw_cfg_gen_data;
 }
=20
 static const TypeInfo pci_bus_info =3D {
@@ -240,6 +273,10 @@ static const TypeInfo pci_bus_info =3D {
     .instance_size =3D sizeof(PCIBus),
     .class_size =3D sizeof(PCIBusClass),
     .class_init =3D pci_bus_class_init,
+    .interfaces =3D (InterfaceInfo[]) {
+        { TYPE_FW_CFG_DATA_GENERATOR_INTERFACE },
+        { }
+    }
 };
=20
 static const TypeInfo cxl_interface_info =3D {
--=20
2.45.2


From nobody Thu May  8 19:02:45 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1734096937; cv=none;
	d=zohomail.com; s=zohoarc;
	b=TzgIDPjfwBOuuswpcKtO5knBTr442+5s7i1gJ/P1IolAAJKr8J5LQXdrNbjT7FRsqU53NtXG+h/sRDarQPhbaZ8xzpuWfgIxkhcuMC6oGZPXxWrrDF30D5igFDzKkdT3T3DmAaGLtYBIhX1zryXRXnytW7sKQ3K6dGJuI6Q2pOo=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1734096937;
 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=NOp9iHpt/Xa4k++YQIG/ZHdZLo2cw6SbKLu+TNop+/w=;
	b=Q8o661xVXxrjI/DhrUiO9/yS5crHUNx7QJb7IL2y8jvVp5G2HZA02xqjNMnp/BrkivAkvtNvGY3BAqO3WwXXljD8PAKfZ6cWRWUn9J5rIck9l9uQPVT8BtlfM8Pw/qk0ZZMgbmZalzfAB0AgnJD9VfkVQDWZjGBlxAGFVV3uN3w=
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=<philmd@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1734096937707202.094264862228;
 Fri, 13 Dec 2024 05:35:37 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tM5pG-0006KO-7a; Fri, 13 Dec 2024 08:35:26 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5oE-0005Ev-Tm
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:26 -0500
Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5oC-00017Q-T5
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:22 -0500
Received: by mail-wm1-x333.google.com with SMTP id
 5b1f17b1804b1-436202dd7f6so18525695e9.0
 for <qemu-devel@nongnu.org>; Fri, 13 Dec 2024 05:34:20 -0800 (PST)
Received: from localhost.localdomain (88-187-86-199.subs.proxad.net.
 [88.187.86.199]) by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-387824c2bf2sm7010324f8f.55.2024.12.13.05.34.17
 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
 Fri, 13 Dec 2024 05:34:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=linaro.org; s=google; t=1734096858; x=1734701658; darn=nongnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=NOp9iHpt/Xa4k++YQIG/ZHdZLo2cw6SbKLu+TNop+/w=;
 b=IT7EvcZu5hPaCdWncg15GtHUYg+1+E0ArkTR5TdcUBHZtViWx4bMh6bv1dP2tkbQl6
 4yoLCiJswOILA5Unn1HPy/uWis5DuYj4CiaXp9Oe3nfh7K024FwnKQE3tPmfNxy9Ax55
 ZYJYdLBbCUp1zyrfsdRlOG01BW1Jc3QkFbmmJzl8vzC1AeDgcEXGs5Q8gbgO5/MrqhXi
 j18b4LV4u9bhPRjLBBUaAIrvm3W2AxMGVO+AIkY33U/Bu1sB16iCO7siWgagEV83IeA4
 5G6YJenRtyJQexesw+Zvt9qSPLpBF0vx/k83S8hImVt+45NgLidOno9kfqPMT0GuwiBN
 /C0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734096858; x=1734701658;
 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:message-id:reply-to;
 bh=NOp9iHpt/Xa4k++YQIG/ZHdZLo2cw6SbKLu+TNop+/w=;
 b=IeT2Eomyjh3xHYs/MziCX/aGxaqmGCG47gSvzkUZ+k0IbP2Ns07Ij72jEDOnFen4Ut
 9pSbLHNDwezfxcA/aqMCFZEbYiGxC9/4XMg9mWBET1xS8lKqwYYAgPr556LP/TeFED+Y
 3ZLsZHEDoKTlqmAge9HwSNREvwS8W4yQxAhFbsnpjXp5+FO18Wz6FZCY6On0TvExVMZ1
 xkx7NZrrbsy5BoliGU/eTO+mQGCPuPOKTkUot5nIX0WnALbvJv0vzwkcleSAqIzdQnnP
 daE7hfbVW2fKsuwYZlo+M9r7DDg9IQ7o3Kv+ZQUJs7s6aFRkbg1IOdKSI177Svl6GGjS
 2RXA==
X-Gm-Message-State: AOJu0Yw97/o8IvWJc0aNpiSGcJbyUUrptqAcqjbB/YYlFAvTOjqd09iY
 j2euJlOzRhUZU4/n3QH7nqnJ7VLBVbZa8Zyq59Jp2LSj4pe1FkBXVK3qsgTEggjtTNwJSp+uEjA
 y
X-Gm-Gg: ASbGnctdrzo6HJcWvq0O2mnAAydmEsQbgjSQzhid9sPZBQyNpmLELttki2SZVkAMuww
 oEBrTdCZOf81+EMNfZJH3qsHo55IfrabqFuLvJljv/16M3KyY9oqMjfhJPkgsjErPGJc9fiwAPg
 h+AI9uj8cig6e3sXJzdbRArtfMv/FIQJHjg9Hpp96IQdkkOTlCCncblZQ0+iu1e4yvZBJcTesms
 VqclKVgp84CVTxgGGOOI6ls76eIel7N9woFg6MFsIBgNv5jgISbcKv0QO+RP54hmWoLZ5tAl2Xc
 DBlpgWSc150a49QaK3CL4hUtK7DwO94GN1aB
X-Google-Smtp-Source: 
 AGHT+IFE/AMFqAlaGCflKUGIJ22Qst4DTBtoy+UyZh5h9BTZ7y7S+SNjDWIf4TKUeIFwCRRnhRXc3g==
X-Received: by 2002:a05:600c:3b1d:b0:435:192:63fb with SMTP id
 5b1f17b1804b1-4362aa1361emr24812965e9.3.1734096857974;
 Fri, 13 Dec 2024 05:34:17 -0800 (PST)
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
 =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
Subject: [PATCH v2 5/7] hw/pci: Add pci_bus_add_fw_cfg_extra_pci_roots()
 helper
Date: Fri, 13 Dec 2024 14:33:50 +0100
Message-ID: <20241213133352.10915-6-philmd@linaro.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241213133352.10915-1-philmd@linaro.org>
References: <20241213133352.10915-1-philmd@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::333;
 envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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 @linaro.org)
X-ZM-MESSAGEID: 1734096938256116600

pci_bus_add_fw_cfg_extra_pci_roots() calls the fw_cfg
API with PCI bus specific arguments.

Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@linaro.org>
Reviewed-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 include/hw/pci/pci.h |  3 +++
 hw/pci/pci.c         | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index c0717e31219..603c456c3a8 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -297,6 +297,9 @@ int pci_bus_get_irq_level(PCIBus *bus, int irq_num);
 uint32_t pci_bus_get_slot_reserved_mask(PCIBus *bus);
 void pci_bus_set_slot_reserved_mask(PCIBus *bus, uint32_t mask);
 void pci_bus_clear_slot_reserved_mask(PCIBus *bus, uint32_t mask);
+bool pci_bus_add_fw_cfg_extra_pci_roots(FWCfgState *fw_cfg,
+                                        PCIBus *bus,
+                                        Error **errp);
 /* 0 <=3D pin <=3D 3 0 =3D INTA, 1 =3D INTB, 2 =3D INTC, 3 =3D INTD */
 static inline int pci_swizzle(int slot, int pin)
 {
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 8844251eceb..bf0a1840dbe 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -217,6 +217,22 @@ static uint16_t pcibus_numa_node(PCIBus *bus)
     return NUMA_NODE_UNASSIGNED;
 }
=20
+bool pci_bus_add_fw_cfg_extra_pci_roots(FWCfgState *fw_cfg,
+                                        PCIBus *bus,
+                                        Error **errp)
+{
+    Object *obj;
+
+    if (!bus) {
+        return true;
+    }
+    obj =3D OBJECT(bus);
+
+    return fw_cfg_add_file_from_generator(fw_cfg, obj->parent,
+                                          object_get_canonical_path_compon=
ent(obj),
+                                          "etc/extra-pci-roots", errp);
+}
+
 static GByteArray *pci_bus_fw_cfg_gen_data(Object *obj, Error **errp)
 {
     PCIBus *bus =3D PCI_BUS(obj);
--=20
2.45.2


From nobody Thu May  8 19:02:45 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1734096963; cv=none;
	d=zohomail.com; s=zohoarc;
	b=OFR1rpa9a3XaWjy9mU+dDKalMs41Sd527WzU5va6iLqYoZAZj2qWpFb/DoQFZC2t4sZN5hwsW6m3HCpWuhhCFGSzEDf8cy2CPmWpdJYwLabFu7kUj0+7CQKXBZO0HlL7n1dQwJP/rSzUs1AqgKMd1KTxBCm4ec2bBxmqrVSmJ+o=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1734096963;
 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=hLaEA7eBzqJ7BvxdEYXe8LSu5E5jEsYMhIQgut2X7lQ=;
	b=cFenbd8fXsEaPQbDuZmZQ10qOzaShEtDgcubOMlcjyHeuSjW/dL3CnExD6pNsHarKmAhII1BbfMOIEWlrJHs9v5Nj6U8U4ytQvNCcEeV683qtIn6iDaaeVz3dXfslWZ2wQ/WilgJPCVMOy3SHzkkP2oMc+pQaMRvl/T2J/HNXrY=
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=<philmd@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1734096963656115.68483503888001;
 Fri, 13 Dec 2024 05:36:03 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tM5pI-0006Sg-Hh; Fri, 13 Dec 2024 08:35:28 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5oT-0005MZ-UU
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:38 -0500
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5oH-00018F-2W
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:27 -0500
Received: by mail-wm1-x32f.google.com with SMTP id
 5b1f17b1804b1-43624b2d453so21065065e9.2
 for <qemu-devel@nongnu.org>; Fri, 13 Dec 2024 05:34:24 -0800 (PST)
Received: from localhost.localdomain (88-187-86-199.subs.proxad.net.
 [88.187.86.199]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-43625706caesm49386565e9.32.2024.12.13.05.34.21
 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
 Fri, 13 Dec 2024 05:34:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=linaro.org; s=google; t=1734096863; x=1734701663; darn=nongnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=hLaEA7eBzqJ7BvxdEYXe8LSu5E5jEsYMhIQgut2X7lQ=;
 b=MHN9wF8AE42JLqa6DAC8bZOiIArK+rDphhCIigShCqRbYOUKoYVAj4CWCdY6ZnwfeE
 MX3NMo2cDfJRDSmHI+byArIHivKOwrIsvqPz3is0dDknGQ8EGMe6pyX642KMbMakPDFg
 KrmHTtEzbhVTux14YYw8YfiD3U9OtW1C1uVk6g296n/MLxAw9QLsfUL0KmK52aEJHJlP
 mzIiuPE8MKKy08R1ByZiOJNts53AbgS2NUAJvu99UzNIC24Y70OITP0eCIVEK/jMXZFQ
 +/KEhg/fMbCYXXYyuepu6/51mbqR4EdXwSySyzUSdCbVIB/Cl2xKkZJDkaozZRd5/zfU
 8pfg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734096863; x=1734701663;
 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:message-id:reply-to;
 bh=hLaEA7eBzqJ7BvxdEYXe8LSu5E5jEsYMhIQgut2X7lQ=;
 b=wvojwk7iWWj9K3WDSzHAGQMdIzqjJfhnAVUOyEe83Qo/h7kB4H5fd9Utj5uKm2ibjH
 7LWvRq6hQMHWIv/bYDhEicA4Tf/1Hm21H9pgQfsbx5TghNBweAk82SoO4qZgZhff3OCT
 khGLjSIItc2gbOGM1TyTWGWmeUidwtZ35wmLI6kfJaMZ/75sYfpUhsDRsBgsM6qqalf9
 3i9/jc58ofVprjXoOWF4kq3Elf4iyX9FRt88j9rJySM48YMvY4qVCCyg4k/GflQ3VThJ
 2RvrqzG1umCKdvblJsfAqtG9plaa+H1hHuVLrpdr1kQS4yUefNoHZDemShicyK+A/42I
 LuHA==
X-Gm-Message-State: AOJu0YwwuhR24Opm5q28duQOsII65YudVW8mP9ZaM2zb7WkOuUaymsZ1
 eP1TD134fLLSb323KewfexF0QHRP6mxkqT2/LHccjNqP3AZ/rWWF65T2v1zrhcWmdKOruKhIs8l
 r
X-Gm-Gg: ASbGncsfCsI5bKTJRhWlr8WzR+PhPIoGdz14iwdwRjKtKKwq5vHa+4u7EV3Q2gXUwzj
 puwnjhoC8VuJuxZp256HAYivKLYjGlKQzU65g81NlmDRJtHA5fWprRgzVHSitO9ncYh2T3TDMxT
 EeLRgFpZj4SxWbTGWeUvcdVyt8KrgMr76IMuxEYlG0qqELSnONWx/67W4GU9rMp2NgN+c/8VAdE
 I1caYaZl0NGVN0vEyui+2gC69TXJDFRl3C0oRRLf6bsbcaCsVj880FUSP1WIkpfMkZYVlvcqPI2
 GR6TPTzr9528Y0nPDtuOf8WIf0kPrvMxLVTm
X-Google-Smtp-Source: 
 AGHT+IHLm57BWQ7/aJ35UDzZH//jdwPivuxbY6VorgTrgAVxM9l/WZBDnKZy3u1pUY8rf8Xh1VFx/w==
X-Received: by 2002:a05:600c:83cf:b0:436:1ac2:1acf with SMTP id
 5b1f17b1804b1-4362aa9901cmr21719385e9.20.1734096863269;
 Fri, 13 Dec 2024 05:34:23 -0800 (PST)
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
 =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
Subject: [PATCH v2 6/7] hw: Use pci_bus_add_fw_cfg_extra_pci_roots()
Date: Fri, 13 Dec 2024 14:33:51 +0100
Message-ID: <20241213133352.10915-7-philmd@linaro.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241213133352.10915-1-philmd@linaro.org>
References: <20241213133352.10915-1-philmd@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=unavailable 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-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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 @linaro.org)
X-ZM-MESSAGEID: 1734096964453116600

We want to remove fw_cfg_add_extra_pci_roots() which introduced
PCI bus knowledge within the generic hw/nvram/fw_cfg.c file.
Replace the calls by the pci_bus_add_fw_cfg_extra_pci_roots()
which is a 1:1 equivalent, but using correct API.

Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@linaro.org>
Reviewed-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 hw/arm/virt.c     | 3 ++-
 hw/hppa/machine.c | 2 +-
 hw/i386/pc.c      | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 3bd9dd0f863..333eaf67ea3 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1750,7 +1750,8 @@ void virt_machine_done(Notifier *notifier, void *data)
         exit(1);
     }
=20
-    fw_cfg_add_extra_pci_roots(vms->bus, vms->fw_cfg);
+    pci_bus_add_fw_cfg_extra_pci_roots(vms->fw_cfg, vms->bus,
+                                       &error_abort);
=20
     virt_acpi_setup(vms);
     virt_build_smbios(vms);
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index a31dc32a9f7..4e673353225 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -240,7 +240,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIB=
us *pci_bus,
                     g_memdup2(qemu_version, sizeof(qemu_version)),
                     sizeof(qemu_version));
=20
-    fw_cfg_add_extra_pci_roots(pci_bus, fw_cfg);
+    pci_bus_add_fw_cfg_extra_pci_roots(fw_cfg, pci_bus, &error_abort);
=20
     return fw_cfg;
 }
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 99b9b105e26..92047ce8c9d 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -631,7 +631,8 @@ void pc_machine_done(Notifier *notifier, void *data)
     /* set the number of CPUs */
     x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus);
=20
-    fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg);
+    pci_bus_add_fw_cfg_extra_pci_roots(x86ms->fw_cfg, pcms->pcibus,
+                                       &error_abort);
=20
     acpi_setup();
     if (x86ms->fw_cfg) {
--=20
2.45.2


From nobody Thu May  8 19:02:45 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1734096936; cv=none;
	d=zohomail.com; s=zohoarc;
	b=doLjpyDodTFce5/QDUZ3OwqURKc68wPDklgcyOYEkp0HSo24x3etZmkVZDsOMAcM83sMLou60z1E9AWsYRxBOY22zFuMan+bra6Kzs/r8ZSHepVwkpTciHLlvLvMFI3jcJz408ak4P7ipBtxnDgaurKghX2xRZvBfOrRW2enYds=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1734096936;
 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=U2qKUJQXHTauredWvRg6VWWi6TihRO/ewf0svr7HQas=;
	b=aVizYIh2kJqdDQE4JvAtESwr0iynmn70UiiQUbrlgl66IJZclXpNtokG9Cm3tb+eeZRxEX2eQpAoeg3rcD8o2hMAeQnmzkGE048jwpEBw2B7HudhbMhdil+VSpwB/o1jqM6HuCRNKOq6uDfIn4awP+xSUgj9HwNUHa6T2wwZmTU=
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=<philmd@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1734096936377897.3780831982041;
 Fri, 13 Dec 2024 05:35:36 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tM5pC-00066D-MO; Fri, 13 Dec 2024 08:35:22 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5oV-0005OZ-N9
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:39 -0500
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1tM5oT-00018j-Gh
 for qemu-devel@nongnu.org; Fri, 13 Dec 2024 08:34:39 -0500
Received: by mail-wr1-x432.google.com with SMTP id
 ffacd0b85a97d-385e87b25f0so1881367f8f.0
 for <qemu-devel@nongnu.org>; Fri, 13 Dec 2024 05:34:29 -0800 (PST)
Received: from localhost.localdomain (88-187-86-199.subs.proxad.net.
 [88.187.86.199]) by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-387823f1606sm7271653f8f.0.2024.12.13.05.34.27
 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
 Fri, 13 Dec 2024 05:34:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=linaro.org; s=google; t=1734096868; x=1734701668; darn=nongnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=U2qKUJQXHTauredWvRg6VWWi6TihRO/ewf0svr7HQas=;
 b=uUZImyce+XGjmiPBNbQiOUVoXk7op4akmi0Fuc+RPswTs6EGbspREbcVUUkAE2QLdA
 0fRpvwJIOnbCKsU8vhdfIY6YPycHWOCH5fLw5VSVptDixUcnpEUpErdSE2gC+lBIzgjC
 gnladO32ntHnRbp336evwkc1zYnUNTzzSiYQmFeed+Mmz+NdStQfkvs82f0N6sr+oZJ5
 jOMtOrY13CLmhl6/0F6dqEhnD9UPaQDwcZRalhqEBIWr9fzQ6+HuS7T0WuaAIDY+ipCi
 17XoYqsMpTFMP/WnhBWwS4gZKd2RjZqdAmakAA6XEu5cfwVyL0u7wgKsd9kmc3lfE40/
 nJ7g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734096868; x=1734701668;
 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:message-id:reply-to;
 bh=U2qKUJQXHTauredWvRg6VWWi6TihRO/ewf0svr7HQas=;
 b=sTjFPfOc4XOzuO82yIYNXRYzyqSgJWlf/xHG7IF8F8/9XkKQYWSJEajt3kxklVpLwv
 d6ZixP6lq5cX+5AyioBuhEJLgHixQd9jpOaDcQsDtlefyXb1gYFIMp9hmn+Nx19jfgM/
 7qPlfOpgB7LxaGsIgv6FYuyqdIvW0K3GXFZT0xmCCJKPpDu9LraJjfqVWCjQNpe8YI2H
 hqJL78/Q64d9pxtATi7Fap/y+JtxcHptkSflAnL2ipt97N3OQTzPYXWlH/7nnADQBhB9
 v+2h8OZFDFUmUPEzuha1vE1tCJstek4AQwUSJTb5Z5piUTm8mDutp5ww1OifYH9u/KfX
 n6Hg==
X-Gm-Message-State: AOJu0YyzlQ7jL6yCEfgW8/u1D9imTfa4cU3hGC7DnCOm2amQBCBS1BO6
 9oFVlPtKwDUO2vpH6c43tmnWKAVuZU3f4p4Fr0VcyEZuG9RTZSZqXErasMA6VXIEtz7Zo8h82eL
 R
X-Gm-Gg: ASbGnctbbB4hDUM67uwOmnli5D7c4fodvTporSQBJOa6SLP/fy0+2oXMQmucepcEqtp
 NQHIlZTthzXl3q5B0crNn0Y69HtaUk3I1DmY1Iteq4XRE+3dz8kExGYXxX241JYixuISHz5JLqI
 e69DUwrPsi6Hci1dnXP/RD771PDMrjo6+4l19/FuwNN7V6/s7Vqm0p/PEK/4wZ24fG8grjuiKdp
 Xffe5hZbgJVnJrUXZYhHKEAy1RNByi1mBkCAhj4GWK3G2e2PSJ1VjF4LXGnlgVtfrv3+xVZ03x0
 /y2EfI6RZZhdcC2QMysVlmgssnr3szyGphD3
X-Google-Smtp-Source: 
 AGHT+IEKB+oSY/XFteMRP1+vSsK8D57gc84/L4Pa+LmvapOY7su9VntvOrlUKpaBr0b/B9gZMHX3qw==
X-Received: by 2002:a05:6000:4612:b0:385:faf5:ebb8 with SMTP id
 ffacd0b85a97d-388c3651797mr1976046f8f.7.1734096867795;
 Fri, 13 Dec 2024 05:34:27 -0800 (PST)
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
 =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
Subject: [PATCH v2 7/7] hw/nvram/fw_cfg: Remove fw_cfg_add_extra_pci_roots()
Date: Fri, 13 Dec 2024 14:33:52 +0100
Message-ID: <20241213133352.10915-8-philmd@linaro.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241213133352.10915-1-philmd@linaro.org>
References: <20241213133352.10915-1-philmd@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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 @linaro.org)
X-ZM-MESSAGEID: 1734096938365116600

Now that all uses of fw_cfg_add_extra_pci_roots() have been
converted to the newer pci_bus_add_fw_cfg_extra_pci_roots(),
we can remove that bogus method. hw/nvram/fw_cfg must
stay generic. Device specific entries have to be implemented
using TYPE_FW_CFG_DATA_GENERATOR_INTERFACE.

This mostly reverts commit 0abd38885ac0fcdb08653922f339849cad387961
("fw_cfg: Refactor extra pci roots addition").

Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@linaro.org>
Reviewed-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 include/hw/nvram/fw_cfg.h |  9 ---------
 hw/nvram/fw_cfg.c         | 23 -----------------------
 2 files changed, 32 deletions(-)

diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index 5211018fd8f..152e049819b 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -315,15 +315,6 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,
                                     Object *parent, const char *part,
                                     const char *filename, Error **errp);
=20
-/**
- * fw_cfg_add_extra_pci_roots:
- * @bus: main pci root bus to be scanned from
- * @s: fw_cfg device being modified
- *
- * Add a new fw_cfg item...
- */
-void fw_cfg_add_extra_pci_roots(PCIBus *bus, FWCfgState *s);
-
 FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
                                 AddressSpace *dma_as);
 FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr);
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 7e1065e5f50..d56feca6bfe 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -41,7 +41,6 @@
 #include "qemu/cutils.h"
 #include "qapi/error.h"
 #include "hw/acpi/aml-build.h"
-#include "hw/pci/pci_bus.h"
 #include "hw/loader.h"
=20
 #define FW_CFG_FILE_SLOTS_DFLT 0x20
@@ -1059,28 +1058,6 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s,
     return true;
 }
=20
-void fw_cfg_add_extra_pci_roots(PCIBus *bus, FWCfgState *s)
-{
-    int extra_hosts =3D 0;
-
-    if (!bus) {
-        return;
-    }
-
-    QLIST_FOREACH(bus, &bus->child, sibling) {
-        /* look for expander root buses */
-        if (pci_bus_is_root(bus)) {
-            extra_hosts++;
-        }
-    }
-
-    if (extra_hosts && s) {
-        uint64_t *val =3D g_malloc(sizeof(*val));
-        *val =3D cpu_to_le64(extra_hosts);
-        fw_cfg_add_file(s, "etc/extra-pci-roots", val, sizeof(*val));
-    }
-}
-
 static void fw_cfg_machine_reset(void *opaque)
 {
     MachineClass *mc =3D MACHINE_GET_CLASS(qdev_get_machine());
--=20
2.45.2