From patchwork Fri Dec 13 13:33:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 850123 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1502509wry; Fri, 13 Dec 2024 05:35:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUShPI+F+o/PxCQOa76p5KaKDAjablJaa+cNsqWuyFcmR7UAu5vVXMQ6R6mztbRQWeqYZ5QoQ==@linaro.org X-Google-Smtp-Source: AGHT+IETnNYEwova2DOAg+ZVJIKStt6Q2kj2LcGpt/5d13epKJ89fvS5dBBp93aaLbHl9iz1x+zg X-Received: by 2002:a05:620a:6843:b0:7b6:cdd4:bde1 with SMTP id af79cd13be357-7b6fbeca637mr478508585a.1.1734096900853; Fri, 13 Dec 2024 05:35:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734096900; cv=none; d=google.com; s=arc-20240605; b=VQ2EpHF3NZo5dGJ3BWk0hftHCc+ZCgeQVq2UaIxQCYtby/McNhPBWTfwvAjxkMmtTt r7d5JVR8Lsfvnt/TKDKBvKeULPzj8AlPbv8rExCZ6Y8r+JxPjuGxpQzi9tiVuBTOWH7Y wQe3t0G+wp0TxRZlOQjifLFgT9TlwJrx+cj7i4n9b5QwlGOmvqnQR5cJhHnbiFgkfM+v G88kFdM3xZWljfbyBBLrb5vBgX1WSis2wrGrUkfvsWvNTQcR1E43nFeeM8Dj9vlZnkTW nwL6jTu6jwO9huyv6PuqlHH+MI4OaKiMeIY4f//iK7KmgF0QWv5z0PH78zZl/WhXUf+y o9XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WlswgE/eUO5zmvvMPBofBLx3raLRd7GBRUggU9AjFY8=; fh=5/bEEfneXpYiCSLu1RRtIdWOVpk1SgQYYFlk2zFRZHo=; b=Q68Tf/EUuuwnLjCEaC+sHUi1BktQ43NFx15NJ8Ufbf/4FuwBzawrndCXOoAB3Z31IJ Ok8+NzGTpmmhhgGO9l0/IFT4TIL0TMEVvaWgakW9jkZuyBL/jWBp37cPhl8JA0bxPJHE yQ4QKmdpxcgW88kgcuZDbo5lJrYssWNIRqn6aZeOuArIVjddpiBeF7FuPq0mKJj6UqY7 uOfbGCugujxzkln5Six0A4VZzyWQS2m804afa+VZYYclDkzZ69ZocFmlEJzm7kClAxRh OreiC+dBQoKI4ki/MwzzT5yobEMJ79/WZ9qMPKRoydL2rukowec8Njk39Zaj3ev7OJvA 9VmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ijtpxrzu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d9b292basi1040370785a.521.2024.12.13.05.35.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 05:35:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ijtpxrzu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) 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 ) 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 ) 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 ; Fri, 13 Dec 2024 05:34:01 -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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Gerd Hoffmann , =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel P. Berrangé --- 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 *filename, void *data, size_t len); /** - * 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 *filename, 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); /** * 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 *filename, return NULL; } -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 = strlen(str); /* NUL terminator NOT included in fw_cfg blob */ buf = 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; From patchwork Fri Dec 13 13:33:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 850130 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1503224wry; Fri, 13 Dec 2024 05:36:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWqeY56KleevzSLUkpJRSYDg+9XKA++ThDxHW/5dXdwM8ijELsY0RJgWuQHSGzc1/6We9Dvqg==@linaro.org X-Google-Smtp-Source: AGHT+IHtwt9XXSMiuOrs2TmClrA7gfveGI2+/Y9GF4sWhkEpFvebhEWA04jRyC1JulCc8qbMf3t9 X-Received: by 2002:a05:6214:246a:b0:6d8:f7cf:a12 with SMTP id 6a1803df08f44-6dc969a86d8mr43950406d6.45.1734096976036; Fri, 13 Dec 2024 05:36:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734096976; cv=none; d=google.com; s=arc-20240605; b=gJh4xRG5+3Fa7z67ZL8XSzah7nFQjh8CcjWRUvpN1cnAu3BmQ5gSHHKSQsMGSjTRNx s76rQm9ujF6QiIKEQo0VhC6Vd/XtC7TzdRj6PW/6L/1V1O6ShjVD0vPKVlKFHQQa7P6m ukSFugalhlcxqVRJssV2WNCsvwPDPivD9vPdoCE1C/nSvvmqXBIjol4yIKUF104hXI8q iIXK65AMEk9hH2spXsWBwcJkHyYqX5BGcQGkjLd2Td1V7eUayUj9JXffzyArkUgbyam/ lWwUM8yf2sjwl/eA6MZ4dwBjehB21d+qqtb71Tfg+HrLSwULqAHD0SAbW4XXhl0KkUu5 aD8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3yF4gTyIXghUKxGkr5yLxPBvl2lN3UWs2PgcMEYcsVo=; fh=5/bEEfneXpYiCSLu1RRtIdWOVpk1SgQYYFlk2zFRZHo=; b=Zz4ZcBwCtMyI0ajqjQ9YqVtY0sFF8vzxxyvC9izjsXFdeYEjzu0ed+97W3JJCQH1NG kkJ+rW+rvDX52lyvNbgRFGHepxTYou29ba62XltpuDg9j8w/ryS/4RUNDXTE2zVz5AO9 1YX1bDzUGGs3Y3yg9ZLWTSMzo9A2NYuTmOWB8hRGHypTLbJe+QHpgK8bZlWilFQhFeSH bkhSDKBjw41YKJ+XPtf+eQUA4gqOYUU34Y3DSzUP81Md24eyPpRt/HhwAzh0xjfwCVnJ zUqenVwdtTXJRqAan4gm7ufwZuVgmXy2i536Fq9uYx9wKAiSUMxlXdB28i+nXQ/mD3e6 VpXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qz6cua3o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dae15d3ad7si58601806d6.443.2024.12.13.05.36.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 05:36:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qz6cua3o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) 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 ) 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 ) 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 ; Fri, 13 Dec 2024 05:34:06 -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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Gerd Hoffmann , =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel P. Berrangé --- 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 *filename, 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 *filename, 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); /** * 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; } -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; - obj = object_resolve_path_component(object_get_objects_root(), gen_id); + obj = 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 = 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 = strlen(str); /* NUL terminator NOT included in fw_cfg blob */ buf = 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_root(), + gen_id, name, errp)) { return -1; } return 0; From patchwork Fri Dec 13 13:33:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 850129 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1503207wry; Fri, 13 Dec 2024 05:36:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVhjFFuRm6f9P44vHNPD+i6EIpeoMDs8Edav8Su7gg3fxf9Z7Okl5Xg4KqfQnpFud8WsOUwoQ==@linaro.org X-Google-Smtp-Source: AGHT+IHIDaRsAGWrhoC+SFM5LNXWTSNfIRScmztpud0B8epA3fIPTXbsJRwEJtKZXa4vgxQ09WXL X-Received: by 2002:a05:620a:2943:b0:7b1:543d:c99 with SMTP id af79cd13be357-7b6fbef6a01mr457293285a.24.1734096974548; Fri, 13 Dec 2024 05:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734096974; cv=none; d=google.com; s=arc-20240605; b=hpyBY24wLSrrjB0lM1vCG2mwHq2duCMq66u7YbxRMxnhudJfToFPHa/0LtBC6H/Fcf JDOYjgB0XJUOxg5aaNLkXlyVmz5XI+sesoTKZnd19sxijDTRUyZwAQWjl9mw1SIL3dU0 WPyKpwQtI0NWPKXfU85ShZghrTwMXp3cv6EpoGapZk6+WwSmwS2JCY4nOZK3GNtbILGB i3doJsme7jeAw1cFrOC8LPf46cdAFGCUoVUeZ8Qv5vP2/eZ3fC8F448i39fRI0b6BslW j954YUXIkFnWaBJU017q9o29zanKzRdrEt1tmB1/yQ0fswr4qxy8KcPBExMz/LnzxA88 QSmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=33yHg4YQB7rIHCnPM4ck8re7RPKyKODYcLX3k+hKjac=; fh=5/bEEfneXpYiCSLu1RRtIdWOVpk1SgQYYFlk2zFRZHo=; b=GGaNQaDUpaN0FyySG5h26xtBHWm6Xkz8Dyh6JEdtzDgFDiaFnK8E281LN6MTkCvCwr RoTbx9WSjD0Nf8s0cl9g01nzZ/Xs4WciQPJosyFIRZbJ4LtiXR8dZXirUAjrW+vv6um7 poEoStontFqj/u+GOqjoQeC0PzMTrBz4EinJ8IQ6r0ZO0JRniFOqrSiUkXBasyysrIV8 1KHECqD3BxyhTbMWnXZu4rszPjLP8V2Tdq5cCF0JvMzrqKG+oYaDx7NYVaxZn/Njlzr6 L+Zs2XI+SUn31R1ANdkFvEKaQz70fXD4TwfFMKgQCWyt0Ivk4YaurJXZ72Ral2JZak5k JxPw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6rEjXTS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5aaa6c0si2159158785a.455.2024.12.13.05.36.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 05:36:14 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6rEjXTS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) 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 ) 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 ) 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 ; Fri, 13 Dec 2024 05:34:10 -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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Gerd Hoffmann , =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Signed-off-by: Philippe Mathieu-Daudé --- 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 *filename, 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 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 * structure residing at key value FW_CFG_FILE_DIR, containing the item name, * 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; obj = object_resolve_path_component(parent, part); if (!obj) { @@ -1048,11 +1048,13 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s, } klass = FW_CFG_DATA_GENERATOR_GET_CLASS(obj); array = klass->get_data(obj, errp); - if (!array) { + if (*errp) { return false; } - size = 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); + } return true; } From patchwork Fri Dec 13 13:33:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 850127 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1503045wry; Fri, 13 Dec 2024 05:35:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCULZstDhPksHnSq+GqM+9Ct6xe60P1BDriXYEylwJ+QFl7kMjDGyhlGK/TaM+y/WPwbeRM7PQ==@linaro.org X-Google-Smtp-Source: AGHT+IGMEVRbKCJ+mgwHURtoua2SqnwnD8VmXLp5WJBV+LVsHV4Nzs3mOJ6vu5fUj/Ed8ra47fKV X-Received: by 2002:ac8:5d0f:0:b0:462:b36a:73b8 with SMTP id d75a77b69052e-467a582afbemr45428491cf.43.1734096957648; Fri, 13 Dec 2024 05:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734096957; cv=none; d=google.com; s=arc-20240605; b=NZhB+vsUBxWtlave5QQHyFv80LkimkG0M5bTa3BqMpxr8ZYvvrXSKsQDeR7kpC9efp SVmrysVotkOV0X6MwGRYR3BKtw3yXXVb0LQ5s8Hz1R8SkhAzRT3E6tszEMCx8PcCvHTS lL8lDNZbqC0DHBkCahrsWmKN97e5shc+5THLrGu5JFhklSEeiBWJt0OLpNFY1eNzbrA9 jHqmCyuWmo1/B5R423ZPQnrLU2w5DOXnnRRnaPV9fTezAoOFDvLwoMqjCasVphxpTMst Fqjt0QT7mdX+6GcT4b7X5sU4z5f+DVFrVjDIpuHpH6ZgnwR4/Bu4wPJJdg/4OpUhw6Is jG1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=keEAo9CNDWNBW9lBlzlrISyY+AFYXI3pGoxc0E2DIgY=; fh=5/bEEfneXpYiCSLu1RRtIdWOVpk1SgQYYFlk2zFRZHo=; b=Zpr31GEFqyhN9D9cd6Uiyx0miijdkpE2jZyfPTmhe59imiLATX/kvmSQtMLH0q4IbN O/JVnozWHfMA/xeXTuF/eVq1Sxe0WeuVganJUiQ39Q4+yUREWSZakcImEbsC3o5aPigk Myy6e5VjQ0GijvYPNa8BKjVhFCeT11V3P9S2lmqv0MnSaunjMC/nfZT0umqEtQQ0IJc9 KmsnGnbK4A4ddLsYzRa+gXoGBTyxsfnk9ucSUKVqL0kINJRlYWEVHEhZIBiH13gc+sxD QgJTDzNMTVjJh+PerbBFFV2KUPTCfnhopPQSmEw/KWOryoIyQh/4nLFqeaFGhqtFQQbp q7zA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Krziu5I0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4679cce91aasi13528301cf.27.2024.12.13.05.35.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 05:35:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Krziu5I0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) 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 ) 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 ) 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 ; Fri, 13 Dec 2024 05:34:15 -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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Gerd Hoffmann , =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel P. Berrangé --- 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; } +static GByteArray *pci_bus_fw_cfg_gen_data(Object *obj, Error **errp) +{ + PCIBus *bus = PCI_BUS(obj); + GByteArray *byte_array; + uint64_t extra_hosts = 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 = cpu_to_le64(extra_hosts); + + byte_array = 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 = BUS_CLASS(klass); PCIBusClass *pbc = PCI_BUS_CLASS(klass); ResettableClass *rc = RESETTABLE_CLASS(klass); + FWCfgDataGeneratorClass *fwgc = FW_CFG_DATA_GENERATOR_CLASS(klass); k->print_dev = pcibus_dev_print; k->get_dev_path = pcibus_get_dev_path; @@ -232,6 +263,8 @@ static void pci_bus_class_init(ObjectClass *klass, void *data) pbc->bus_num = pcibus_num; pbc->numa_node = pcibus_numa_node; + + fwgc->get_data = pci_bus_fw_cfg_gen_data; } static const TypeInfo pci_bus_info = { @@ -240,6 +273,10 @@ static const TypeInfo pci_bus_info = { .instance_size = sizeof(PCIBus), .class_size = sizeof(PCIBusClass), .class_init = pci_bus_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_FW_CFG_DATA_GENERATOR_INTERFACE }, + { } + } }; static const TypeInfo cxl_interface_info = { From patchwork Fri Dec 13 13:33:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 850126 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1502873wry; Fri, 13 Dec 2024 05:35:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVaeBG+w7VIRcsTV5GnBVuydWcfULwcNsdR7rNO5m5g9p/A+JXRj7Zk1NWRp7pVM89Rj8SetA==@linaro.org X-Google-Smtp-Source: AGHT+IHKIPb9i9OBtKp4yQ/8tgkg2QYkBmQlQL0zmMPn/+AH1gwKq9UfBuRAE+GnufBv1uUYTbcF X-Received: by 2002:a05:620a:1b86:b0:7b6:e9db:3b21 with SMTP id af79cd13be357-7b6fbee80aemr433798285a.14.1734096937521; Fri, 13 Dec 2024 05:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734096937; cv=none; d=google.com; s=arc-20240605; b=MQddgZBE52QBPHwttZ2YpmTvaqGoSuHsEMu71bFXpBS4+kNkD0Q8dBdetvoh3DJpCi v0LSE1EN8Kf1dszUFU7yUMLuqdlUmQbmDmHr3YPlt3s85bCsTJy2Eq9Y6zmyLrZX8Pkb qU1xzLMDjPxhiRX1Xm3iD1E2gGTyu4iV7RZH1dth0tuNJ42jpAJtNIoIbBl4BIJl6iAY 7Lo+ltRY95KtOXsrGnggj3dAYOYBygnMQz57MRfQtQsCmwVBfncRZhVwAN2MwCOtjGWp sRdKOnoJXCzIqlQdkEDTggk6ft0rW/C2wBuDSJbn4tXCyvLs9W92q0sboVhxh7v4pGnn C04Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NOp9iHpt/Xa4k++YQIG/ZHdZLo2cw6SbKLu+TNop+/w=; fh=5/bEEfneXpYiCSLu1RRtIdWOVpk1SgQYYFlk2zFRZHo=; b=a8WTscxVPjcZUILIy112kRNhfHS6VcdHZsKD5jGz0/ZWCE56o5U3Kt2ldLG8H2RdAe CcjawvsLpuI6Ri5TqK9NmtIoaepeGU5QioUAKbdeAc2lCWTamI/xJnlrZo7lDk+uT55c saeA+CLj//8WmJVP6I1l5W5mkR9N0cxZH3gk+pIVDJUAXqimT4kfYfao4Nc/QOclODZy SNFM0PpuhAspgnOleDwhVIQJjJAOHHidXSGSn90S4g9jCaGFtVAtmHUU7xuyzBmD4igC 0QElSwQmMaVuZT5YUNOpEW4dfh1QsuBKrQ4cFW8kzCbAF3H8OPT3bbqtjk/WHh5WdspM qs3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IT7EvcZu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d9783562si1191877485a.626.2024.12.13.05.35.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 05:35:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IT7EvcZu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) 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 ) 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 ) 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 ; Fri, 13 Dec 2024 05:34:20 -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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Gerd Hoffmann , =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org pci_bus_add_fw_cfg_extra_pci_roots() calls the fw_cfg API with PCI bus specific arguments. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé --- 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 <= pin <= 3 0 = INTA, 1 = INTB, 2 = INTC, 3 = 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; } +bool pci_bus_add_fw_cfg_extra_pci_roots(FWCfgState *fw_cfg, + PCIBus *bus, + Error **errp) +{ + Object *obj; + + if (!bus) { + return true; + } + obj = OBJECT(bus); + + return fw_cfg_add_file_from_generator(fw_cfg, obj->parent, + object_get_canonical_path_component(obj), + "etc/extra-pci-roots", errp); +} + static GByteArray *pci_bus_fw_cfg_gen_data(Object *obj, Error **errp) { PCIBus *bus = PCI_BUS(obj); From patchwork Fri Dec 13 13:33:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 850128 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1503092wry; Fri, 13 Dec 2024 05:36:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXXUBpz3YOTjEw7zUzDdBcV694UbCpvu3OqvSP8+ABesp2r4AnvROrjonYFNVXmhIaheEfj2g==@linaro.org X-Google-Smtp-Source: AGHT+IGkSUpl9CLZ7vgFFqqRFWVRgLddKkd4IfRqJ0MJBpt4Dto56405DuBnQsiJlc1ikOKTSaU4 X-Received: by 2002:a05:6214:2627:b0:6d4:36ff:4358 with SMTP id 6a1803df08f44-6dc8ca826c0mr52540886d6.25.1734096963488; Fri, 13 Dec 2024 05:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734096963; cv=none; d=google.com; s=arc-20240605; b=PBltTyL7lLjISZBRuxKSoxCIg4nhHab7QrrWzlr6k4AAd0AmE2vtiepQr+0/Pfz5tm 8hGaP/Rxj8X88OOmMxtiQbFr05e3EmXKXPQFLvupkaa7JY3/NaU0IAoHu8KEJPBOoLl3 bugJ+aGuUelfsFt14MMLfDZTe7qoRzk7KC4xGMme+PTOSZrmNfuPAg4z+LxCl+0lKXIP 5rIaNe7E8P7kZgMFhmTbJ3BNqMt1ZiOonfBR+Fco5h1x0dZIqOOnHx6DW8mlVJqJZk9J 12FkD/2cx0zqv9QG5RXIpkMy+UUWo3tu5n28YVEGQ/KD3SAY6pUzybVSxGER8CUnaDoS MvpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hLaEA7eBzqJ7BvxdEYXe8LSu5E5jEsYMhIQgut2X7lQ=; fh=5/bEEfneXpYiCSLu1RRtIdWOVpk1SgQYYFlk2zFRZHo=; b=EjN4gvhEH9LZD6TyIJ7c6Ky4cYoPWK+soTPHYI5I5cW9KLPMhsrZDZUi2h3SXOVOYw no9nJiZEyLFo7PG4NMH5Ni1DXRBBBKM86U8KCVUMUQTLeHfWTvluAP7JpbWWkpYTubcI llzjAsEuXml3Yd5VwKh/860YXWOS9rQ7DhhX7Bc+NlWBISNTGIP6LgP/9ZLgqBLg2C0y ZkAAqfTqxVQ076F2lAYoJQqVKmJ9ZWutT0kpYmiACvMS6w7/aVxAOx6Vcc7knT42RGEB 8J7FK1AdJDUUuKSoshRrwKNIS724YNLKXX8nT5YcF/mpjIQJXDaB3R1hc8YlsdMsajCz kYOg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHN9wF8A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d904778f67si160884356d6.209.2024.12.13.05.36.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 05:36:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHN9wF8A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) 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 ) 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 ) 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 ; Fri, 13 Dec 2024 05:34:24 -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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Gerd Hoffmann , =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel P. Berrangé --- 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); } - 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); 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, PCIBus *pci_bus, g_memdup2(qemu_version, sizeof(qemu_version)), sizeof(qemu_version)); - fw_cfg_add_extra_pci_roots(pci_bus, fw_cfg); + pci_bus_add_fw_cfg_extra_pci_roots(fw_cfg, pci_bus, &error_abort); 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); - 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); acpi_setup(); if (x86ms->fw_cfg) { From patchwork Fri Dec 13 13:33:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 850125 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1502860wry; Fri, 13 Dec 2024 05:35:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVkVwdJofgrdZgUcO94/XNz3QuQSwuQJpFxWGrxYZpkXOoH0IiFlXmTKVf3+dtNQZa3eXskKQ==@linaro.org X-Google-Smtp-Source: AGHT+IGdzcaeI1Kpbn9e0Mn8i1jSEl6igao2kwjapn9CSPo6oqxMHx7ntR3ew+cjYN1MrrLej6ei X-Received: by 2002:a05:620a:4485:b0:7b6:ee6d:fc23 with SMTP id af79cd13be357-7b6fbf42887mr347059285a.49.1734096936020; Fri, 13 Dec 2024 05:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734096936; cv=none; d=google.com; s=arc-20240605; b=DfT3gATzgjyf6ZIETpUe0JuxOUZ8cJsGGWjdiS2mwNQrBeVKcy1i5j+K0wMIaKE4N+ dIS0nn7ba00aULoSF45XE7jejs44rkFvkXgZ/HpqDg36zINI/JirFS8cnCvr7F1WSOtk jIydQLWxQ9Hvcj0du1WOCK4aRdjichJBkYpfvuxiX57REu0mzcIU6UlG5VguxeWLLw93 rK4wetk3yoJnvxR4rhxhFqJU3RcSYMhO+1a52bt0pv9n4SY8g4D6UEUiAah+fKbg2q5E jcDLzjTn4TE8Danx2Tx1/NAf+e53fwD3cTSwG8pXAjSPcqpfP7AKutf59eZ9QvX9Gk35 j/Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U2qKUJQXHTauredWvRg6VWWi6TihRO/ewf0svr7HQas=; fh=5/bEEfneXpYiCSLu1RRtIdWOVpk1SgQYYFlk2zFRZHo=; b=AFuvkYaWKxMl2D7LkUE2l0Kw3aZ76FltdaYlHehObNclCmhLhK1lbeSs4Zrts32EPQ lnHR77bCRKuvOmxkdlepsUNFdAKkjK6cIUsP9J0ySEgGoJxtWvA+VtZSDyYrEJ2U3Le2 LDKjRHcZw87KATCkGTniao6zT5rAmEC6KXfOi0NZ7jwYZJTxFhvBnMQ0NiMgr+fZd91Q CseQs0YzRm3HXCCuJD5JOkZvXwD9TUVMtAaMg8MkvkRGXuORd0nNY8COnM1hlc3C1MZw uSjlqk5IfaLpQuL2d0O5F7IEOyjD0mPswf+PRCuPxMy3yPpz9FiPsN3aecMXKThXpc11 m9Ng==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uUZImyce; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6e6979afasi919178585a.389.2024.12.13.05.35.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 05:35:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uUZImyce; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) 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 ) 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 ) 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 ; Fri, 13 Dec 2024 05:34:29 -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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Gerd Hoffmann , =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel P. Berrangé --- 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); -/** - * 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" #define FW_CFG_FILE_SLOTS_DFLT 0x20 @@ -1059,28 +1058,6 @@ bool fw_cfg_add_file_from_generator(FWCfgState *s, return true; } -void fw_cfg_add_extra_pci_roots(PCIBus *bus, FWCfgState *s) -{ - int extra_hosts = 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 = g_malloc(sizeof(*val)); - *val = 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 = MACHINE_GET_CLASS(qdev_get_machine());