From patchwork Fri Dec 6 18:13: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: 847847 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp926678wrt; Fri, 6 Dec 2024 10:14:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVeTQ/zR0EUXEDd3czfXekTd5qg5wJb/XJj+Hrioz3Je3lJmqbvATFQQisMSDOItzflSWSv8w==@linaro.org X-Google-Smtp-Source: AGHT+IGcH7kTrZ4KXE991wLGboKTJAX+z9BmeTV3FqqRJFuKNwkUTplLUgHqwm63CpPJ560TFdxK X-Received: by 2002:a05:620a:179e:b0:7b1:5680:164b with SMTP id af79cd13be357-7b6bcae47d8mr436411785a.26.1733508861779; Fri, 06 Dec 2024 10:14:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733508861; cv=none; d=google.com; s=arc-20240605; b=YKQLNTB0llAxmo4E0U+qU7LRbjAejnPmKzaGwBTxrEl8UQN3oHZ8OcW0G+AEQnKoK1 KKIGFCL2QnsAOY/8xP4qNUQAloypdDKZJ5A9Er6GMRSoSKlmaoXxDyoSB5SUemf74GNZ WSyutVmiisqlWTapEQM46nCEmLaMj6G0je0XHCmyn3NaVxM8rAYQkYQpuvrTUrcPu91S Qv5P/NOYWfzdOivLoXxb5Y5wCIc5W87VCXZBfPV1gS5OFH/fKhxpNBPcfk7TeRpEZPO9 +Gn3qaJZ3P6HrHtAIUAorpjIrEBQHsf7P0CN2a6rQdZTCgxSzDrqUuEjbbxUHn55tNAE 8yYA== 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=A0PBZR23Po9ToAnafigq0MA6TfCR66KP6lO73kHOKBI=; fh=IphCI722fRCYnmAkh1+OR/JfVkvagJhmQ9O2qLqcy0w=; b=LlFjNhynrKcHSw+1FaMxkVitthrHWnHdBzcgIZSpBIwxAmLt2ZItuT4dSFI5MnV4bT AFL6S9o4jDZ/zZ5jdPMlKxUPR7Wu3b9jgfWP17zS9kg4e4k8h3MiloeqgQnyUuEILoEn c8zuTKuShiMTYyFfqZQVq9xm6UHT0+L4Uz+BU7FJTVsdsNEu3Kdp8z3hwyFy/K36SJul +1utWHSSc335y6amWD0NW6R+5sE7x0QikTtW1l1WC1+/KPECp6buePQjWHdc5OGSgvr6 i78kcCyOpFQf3FhL4DAloCeeOlSm9E2eR5z+BqNMuiEbwgbQyxLLOK4HNJUp1xLNL/dR yShg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DMRIwzRN; 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-7b6b5aaa687si470338285a.375.2024.12.06.10.14.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Dec 2024 10:14:21 -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=DMRIwzRN; 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 1tJcqD-0001Ix-Fr; Fri, 06 Dec 2024 13:14:13 -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 1tJcqB-0001Im-71 for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:11 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJcq9-0005OR-EI for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:10 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-385dece873cso1186818f8f.0 for ; Fri, 06 Dec 2024 10:14:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733508847; x=1734113647; 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=A0PBZR23Po9ToAnafigq0MA6TfCR66KP6lO73kHOKBI=; b=DMRIwzRNuVIo5SvL5RXpIVbv/ebsur9xmeVa+bKXdZ5li8hks2yOISX/8eTqD1nlWn yTvEUIfcqUOS9FriMltWGSMuDWy+EfR3DuybGxCSm16EfClObJwN/YlzcVB8s6qJcr3O c+CBhTO1B7y4w7dzyiXZXVej8ilAFNNW4SKuBaVo6sJNRknomXvV7Rm4x0jLW6snXI2B VXiuB0xn16SJz8Adt5UKM7cuHPtN6Z/+zt/h8j5FPJi32wo/ytvtqtfhOrnJXWM2TVyZ woroCq2w+ZMedtA5WAYoXxNo+78PuDrKgZa/ncHEzCoHzi582hTYNXEPM5/wWmsxme6h Hc/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733508847; x=1734113647; 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=A0PBZR23Po9ToAnafigq0MA6TfCR66KP6lO73kHOKBI=; b=Lj/KBxA2LowIBfV4ax2L5bSikqmp0o5/wgu5EdlZpS0YfuatJ6r8etywbYbtqdfJNP /d3QAUlxJKZBXhJj1Uvnc2dPseqTIf3A/qRQYc85PjFwG/KEOR1dQf1SzLz8umcyoMOX w74qZ4TswHn2v1IllX+JpadQ/NOy2xJLn8n8J0IZdQKJXI+RqZh65DD0iXqehgIwV+LI iKGO+x5p7MeZEFTSUKJWNS12ii8+NFevfKKamy4rn4aVX4Zp5+Nu76Ar24gFBCAe4/Ok EV4dMttz2+ltjvQWgiPpNFTkHw6cfkR0R5h4MJ+buUIyM9PwmddwzCkh31MJ+FLk9Xnl TJ7w== X-Forwarded-Encrypted: i=1; AJvYcCWUcsEuPpzksODw/fDntdZsQpBh24F92qh66nkelFv7bFV/OHNNz3dGGF1oxnheJAz8kMu24ncSu7oA@nongnu.org X-Gm-Message-State: AOJu0YxVbjvtQUD8sIrge6bHFisaPEwFy9ICqoss5NVJCDPBp5Fs4+OQ M0SRGQB3Tj6CwwPqi7Gd0JqnylqBAd1V/XhVN0ePK/gUMutfPOEIhpKhnQ2e6xM= X-Gm-Gg: ASbGncsjT5fSYeIrKpoVrm7wgwTSNsTUEdV58ZmplixRdayQVZNC4pbokGuc6OMFu6p 5UKsLabYRkJ1CWeVkk97b75RP/+AwqKLetvhtPFq3L1Oo+Ywrg+084QQewZ9Ad6pVZ8w3q1ZAKY 3uA3i+Z6nHH+l8JRwwSnLim8JKJO/IaXH5gROO5bdFWSGQtKsqQzUXVLcoI16hs8GmnsP0CKFkQ GmonHRhBM1Vg3fLQ2ESwnHDJi1nTr1WSiuiQGjfFROxDI8yXGnsT2w82YJ022+WSao= X-Received: by 2002:a05:6000:1846:b0:382:31a1:8dc3 with SMTP id ffacd0b85a97d-3862b39759fmr3099375f8f.35.1733508847568; Fri, 06 Dec 2024 10:14:07 -0800 (PST) Received: from localhost.localdomain ([95.127.41.180]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3862d05d82esm2147630f8f.40.2024.12.06.10.14.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 06 Dec 2024 10:14:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Jiahui Cen , qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Gustavo Romero , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH 1/6] hw/nvram/fw_cfg: Rename fw_cfg_add_[file]_from_generator() Date: Fri, 6 Dec 2024 19:13:47 +0100 Message-ID: <20241206181352.6836-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241206181352.6836-1-philmd@linaro.org> References: <20241206181352.6836-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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é --- 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 6 18:13: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: 847849 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp926833wrt; Fri, 6 Dec 2024 10:14:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUE/OynbWJMUGsSaPqxiUpiZDGolaPkarre4JCtn8s03wiJgFCyJ4J9+fIf5aHRmg8h2i21Hg==@linaro.org X-Google-Smtp-Source: AGHT+IHnW5CBrYnOTXP9DM7HCavo/8luMuPfLz3s2xnRrilXTPqSTGGWtOIIOx5999+OYIjI8gcW X-Received: by 2002:a05:620a:3905:b0:7b6:67e1:b4ff with SMTP id af79cd13be357-7b6bc996dd1mr771357385a.28.1733508883434; Fri, 06 Dec 2024 10:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733508883; cv=none; d=google.com; s=arc-20240605; b=A4fM+6mdhjrDE29k9oHOYoPjGpZzFxyeWiYYq5LUFLiy4jBFtNjD6QSOfK3djDuImQ z/Di6PhAZYMqaxsHFxR4yfJbc0sym1QQR9xNzMPOnGpT1MGKjGLC4RcR+UGPXr1wp1wx VPqqL7W2ak2tvK7h6loE4NZwy+rqIXTjYJGh5AugytI5ANG8XK25LaSLmZi5nfc2cyv7 3c0HMN41FCOz6sgV7ASYzIruqJvidWCzfFZMdj7Z05nLmgXk7qtW/BGGI0OEi1u598wi nZ83IBGG2bHAiOmckhpxeMNs1IGTXyHEyJaTcDet6m8NvbfN1PE1CJ+AV7iPEnk1Gmww tubQ== 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=jcfKXIJuNiuvzm2ydvBx89mK8MIYUVOg22CEhEE1H9M=; fh=3wK/0BWpYKKByqhpnDce4GYDJpf0QpS0zq5lyeSr+sc=; b=VtaEp2Y6Npt41FSj48Y6zhXUuxsu/1OvPPS9oUKnViYSPsO9Lv2xcqdukqV8vPjrEH zvkdnjkiLiWMx4ZFWMCFfJ96w9qCeoVnLF6yL+gPM5JNVKRIUTc26aRpJige8/K/yGdZ 5UGGJPu7tyxpGobMvLHw8sEFIelbNLmQgW/TyqWDwsWG06LwBzgJtmKUdRspur/1SQWL LZR6P7hxnLH3baGVO2c7ubwnQBWBRTXHA3CK4nm6b4e9Jlu0U4TQ+ik/uJ7fsfnchgfo jEt541urHjEb2G5nj1Pg+CNsdPeKE13HP+BumSJEuUgA9cBLmpK4DtUbAFnWx2HUWahi SkFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zAuPiWqk; 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-7b6b5ad40b0si481300085a.705.2024.12.06.10.14.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Dec 2024 10:14:43 -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=zAuPiWqk; 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 1tJcqN-0001Mm-QN; Fri, 06 Dec 2024 13:14:23 -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 1tJcqM-0001ME-Ge for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:22 -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 1tJcqK-0005PW-Id for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:22 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-434a83c6b01so16139105e9.0 for ; Fri, 06 Dec 2024 10:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733508859; x=1734113659; 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=jcfKXIJuNiuvzm2ydvBx89mK8MIYUVOg22CEhEE1H9M=; b=zAuPiWqkUAnLyuapXuXWEa131/B1BmQA9ITE/9cAbPclCeqTdqLr0A3RLUpiWrgV6T Fb2sOzPZ2BXs19DyNah3CcpAdYKxWiKJ70QRvjM/9/Q5caiHaKDle1gGtk/IkSqMt0+S L0ZrUX83W5uQGa9Xet8s4/bW5/tnX72fOi8WaYSPj+SyzewVOQ4IvXzcGEMt2iEjxDM3 xSpRVL7e8nS51i4ZcZ7NxUC47FSpbbctEzHnfDBde+Acv8lNEethhBiOa4183a+4IXEA H36W5jZMain9Gumq2PzDOQgKbhsH6x1DOXnPzoyyW6ALd5AsIpiLrxyeVeRMKl9w/1qn 0J5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733508859; x=1734113659; 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=jcfKXIJuNiuvzm2ydvBx89mK8MIYUVOg22CEhEE1H9M=; b=hC4gZ9V7FD1HBRbpzQlfxHlZ8xXJ7rarkD1jnDEV/bLYU3xvRYifSIIjlptrGrK1TN 95DEIo+zCYuM8kX29Hs/DQJVEuazM3ooKOfsnVubwryuhdHggArP0b5jInDFF3tcanEk pP123dTviUqgf4Y+xWGmGEOlmjQ4MolNNflpdIAJeapFKhyqhwu4zRBI+E3Rti4K1IQG OwtPuhitA5tiTYBiPxWcwOCVjE1WznmK1Jry5Qrdc1eDdfjz6+2RTgd12vUIkgcp/J3o Ma1D5SBoAYvKhNWkMb92KOxtH9L/LED4bVYraS5QR/A67ArDjMYT2EE5nVro3vPVE9cM 8YxA== X-Forwarded-Encrypted: i=1; AJvYcCWtMEuNLIjteSB9ig8QHZWxURMBKwFRQsjXMVnkDgrvjQ2OggVdbld9wIlWqwU5Z3zahgvJcyQvuoo5@nongnu.org X-Gm-Message-State: AOJu0Yw+TYtw/agraK1qJYgcKDkuwzqsREZhlAj9uMOnLCcH15CTx3n2 q+HGeQ3SmmdJKoYGOyx992njIjDjdJHBI9GpTwQQE+OKmcwqCI81bvFOYpK+f5Q= X-Gm-Gg: ASbGncuTEfqkGwiZ1sCids8e2zp2IDyFysRyhg5nz/Lv/TYbA4g4zGHdEf0YNpU8AT/ +31g7wkfEACUu0lpvN0Be5IVglcderoN9Hz6HyOHoM2JqeXIBnUfT1FJ8HQvu2MlYxhllgxI4QA vNMLe4ivMfpiiHzEo9G291DOQxiRh+JqtUKmH2cLG0Ra5F+SUD/C2UAL87G1vDLHIjQdjt8ES8/ n1/DIJbsU1APsk/QQh5Z0aWyPv3ovaZL7xmizcd6qOVF6svEiamEP+avxbzk9JnyV4= X-Received: by 2002:a05:600c:19c7:b0:434:a781:f5d2 with SMTP id 5b1f17b1804b1-434ddea7f36mr35413855e9.5.1733508857333; Fri, 06 Dec 2024 10:14:17 -0800 (PST) Received: from localhost.localdomain ([95.127.41.180]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d5272f99sm98988715e9.11.2024.12.06.10.14.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 06 Dec 2024 10:14:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Jiahui Cen , qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Gustavo Romero , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH 2/6] hw/nvram/fw_cfg: Pass QOM parent to fw_cfg_add_file_from_generator() Date: Fri, 6 Dec 2024 19:13:48 +0100 Message-ID: <20241206181352.6836-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241206181352.6836-1-philmd@linaro.org> References: <20241206181352.6836-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 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é --- 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 6 18:13: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: 847852 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp927582wrt; Fri, 6 Dec 2024 10:16:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX6h8Q8SBAb3fidpVdN9sD++34FeXaPS14czSaMwn+zf6YSRp62ebGOYoOV2Ybvux73s6JS/w==@linaro.org X-Google-Smtp-Source: AGHT+IEeELvt+0xDTILo5wBduvB8FwA6H0Vc4SvTPKNovagM06DBwYGUP/tFCb9Gg2iq41ANCRe3 X-Received: by 2002:a05:6214:21cb:b0:6d8:a730:110d with SMTP id 6a1803df08f44-6d8e6fbcd58mr54322796d6.0.1733508960995; Fri, 06 Dec 2024 10:16:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733508960; cv=none; d=google.com; s=arc-20240605; b=G1Wy1tgWPmYJBLytxU0w7gdOxECjiLUE/T3HYpnN1pz+k/SH3Ed9c6InXUEL7JNhsW 4JYtC/zPq/JGnghng0PY6FDS/eAbb+9LD9iMtStExTRNq/zeC2/zP26sA4nwiZhKG66C 6LM9VJ8TIpC2qWhrxSn5OTJihBowZ9FVRFQhDXbdHZAVryVbzw1FFd99li8xND0BON5f GQNk2LnkANL3IC+jsL7jchqPXqN/DohVx5d+z6Ox5uUePUCCxR6yIkZQMG7tDZb0gs+K P3n9jM38s7roW9ix1LBCQ8+I1IwKLfIFw4YhxmpkiRdxuT8pD77ot3jHYxuUj1x2BBE3 g/Uw== 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=owh50kXvsaInzhL7G0fsDGVpNu3LUuVKio+jRzd7Ga0=; fh=Jj+raDLEQ9Kgny+zJsPhSvsLezhwnZtM+mhmGghpsbw=; b=ZVngK32rjNfUn6iQi7NqzkzTjGlLqAftR0WevDX8Yv8/yUAfbypVppMuZB3v1YDVEV wGuWrHtYpN4pPkvaLna4W4tztj9NglcsGBmC30eimTcey0/iQvW36W3YlcyRnFFMIIf5 R0n7YoT7FmSg1QvasZJTDkJNt2nyF8o8I4E65audf0jAd8VLHp8HjxSviR3I2JuWO+U3 y129MS8kMsnqFALpuitMGMDaOlxBRydrG6qlLGme7XPplocteYeqs1REZCQn0JvidXU3 v7ReFdmp/nRLJIcXwXVyk7dFOnaHscV3qJaFW7+6R1PxxxV9rB7P5cez0Gtn9XUseg5J Btrg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jozGh2Io; 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-6d8f4748498si10965486d6.530.2024.12.06.10.16.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Dec 2024 10:16: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=jozGh2Io; 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 1tJcqV-0001QQ-Kq; Fri, 06 Dec 2024 13:14:31 -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 1tJcqT-0001NL-2r for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:29 -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 1tJcqR-0005Q6-GN for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:28 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4349fd77b33so22351885e9.2 for ; Fri, 06 Dec 2024 10:14:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733508866; x=1734113666; 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=owh50kXvsaInzhL7G0fsDGVpNu3LUuVKio+jRzd7Ga0=; b=jozGh2IoKPNWCTj3dbz5Qt0NhO2Cw5BkhKyo/tCuLk//+v6PLmtV9UO9xEfAOpBYvW ZQf0Hz3VKN4NprnOojf5Vux1OLRmDRhRztbi14NXtoYQoloeL/yNuDXDdzHwSYVcAKkV DtyYg1TpIhicrdnK7J58LXksZpVy5RoJf4VYjfyaBstGUNYZGAJQvQsdKEBK/VDjv2GP lFhe2djhBtbkn9bsFkoNeL+cyYYQ5sDCj6O92EuWIab1teGVFC+FRmccXZ/e3jhvADpZ MZw6ZB3PsmeOmTvO0iLU8BSxuVlcUIkYz/MRMJ2AZ+ZhsFrLAKAUj8drsuq+JgbtlaaV 0WGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733508866; x=1734113666; 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=owh50kXvsaInzhL7G0fsDGVpNu3LUuVKio+jRzd7Ga0=; b=FpMWlwCVq5dBUP60zMhpGjreOK9VD+KSgbT7e4tNL/GwBhfQ4aPXnPcmIzVHPG6aK6 P0QEoiNsB/OuCnooTEjdy4CVgMfhWN0SzPuSP+IidFWzAxU/rnjQLcLyWP6B2D2TZdaF xDeOWfu8P9bhUo2Rx2ZRfccXG7M0qxa7DY+aFWRVL/nAkeIXrmgCCwUklvg7LPhlExEf 1HQndz6BvwKt1mvHE9XpJ56Bu2CmARLAUn7g8oyxqJACOXxbeV/ddmIRrV+AkF619ho6 uN/MvC+6Odcv2sUb+mep8yrkcD2Ow3FJ9HMarxcKxFBF6RYAm1TiNi0MJNFnMkRaJYlw T0Yg== X-Forwarded-Encrypted: i=1; AJvYcCWNGCRCECN/18fOKf9gm+HhBmxw6GzDhhEcJhFUoDEqQOEzwIvaIv7oZuRaLL3sta4gO+HPFCpA0Aoh@nongnu.org X-Gm-Message-State: AOJu0YygyscT0TdxZ6xLAvPT8p9q70QLdN1UDKGlKmvcvH787GhWzL+u 9yBbLUIcwFTPGLNAlAw1umBz5318L1FTOlDnVsb2NTR9JmEOQko5uKI0YPvChYM= X-Gm-Gg: ASbGncsQ/zpYW9FDVkbl5APjbdXQ7yfzuB3uW/fdh2ZYmzG1efJOiTGYBvTOSP+wwq2 g8UazikvnacdMQzqeVtHGFR5lGqPIR60throjsI6m03P817jG5/Yo5v87N5sw6OkxbBmZN1RRjw oQxhkj9/MTAcp8pzMwMeK/HoipptWhlH6EeaS2OLdgwubPJtLTYic0TyMxP22bHQjW04fpAcFsl tK3FF5974cf8LZPsVAWtlzOgnvGpBfi3cnvTbI3AoH7yt9QoZXhWdPUYzqXDWaYBlc= X-Received: by 2002:a05:600c:1d0b:b0:431:5ab3:d28d with SMTP id 5b1f17b1804b1-434ddeb5518mr37823825e9.9.1733508865965; Fri, 06 Dec 2024 10:14:25 -0800 (PST) Received: from localhost.localdomain ([95.127.41.180]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d52c0be4sm100555205e9.28.2024.12.06.10.14.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 06 Dec 2024 10:14:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Jiahui Cen , qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Gustavo Romero , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH 3/6] hw/pci: Have PCI_BUS implement TYPE_FW_CFG_DATA_GENERATOR_INTERFACE Date: Fri, 6 Dec 2024 19:13:49 +0100 Message-ID: <20241206181352.6836-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241206181352.6836-1-philmd@linaro.org> References: <20241206181352.6836-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=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 allows any object to produce blob of data consumable by the fw_cfg device. Implement that for PCI bus objects. Signed-off-by: Philippe Mathieu-Daudé --- 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 6 18:13: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: 847851 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp927392wrt; Fri, 6 Dec 2024 10:15:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCURx1OeJSVqQhBOsCMveU+kNufNG/DNlX+e1ZH3KOB9OUIaWD+gZJXy3vLVCinFUENXeszYGA==@linaro.org X-Google-Smtp-Source: AGHT+IGWmYj3PM5N+aA+ZWENA/Q8zjVhOfbZoqRxwRcoQAo6BWvYZLKvKTJyfhSSV1MT0LqMMohA X-Received: by 2002:a05:620a:454e:b0:7b1:11ac:627a with SMTP id af79cd13be357-7b6bcad51c0mr696069985a.25.1733508936635; Fri, 06 Dec 2024 10:15:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733508936; cv=none; d=google.com; s=arc-20240605; b=kEPwGvJeQAhvL278bFmhgqQiuB+GASWNZ4fPUSeR8ZNIFw3wFeR4A5rmlUJXnZyxkD RE5lSMg69wUgLgKWZbQiHZ2yxkelNYJY8Fz5qhGsb4DwzjRZ5Fzpoxmzte/M++YLhXuB PGBMD6IzUBONsaM81f4ULLx5UJD2sFlzNAKQb9MImYvBPz6qqD5UdHBT3QljBXkkbft3 qvGlPacOEBjct5B4lV7qtR20fI/4btfMwB83PkZRfUeKaspvT7jY1bc4SfpRKSbIdmS1 WcI5UkpWZN5FOgll9D33pmboRJ6e0riaFexbgn0QV1lb1QlMDBoZoXWfajHTSi6HIfxK 5CLg== 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=C1k+dmjInIZ8nHyYwBxRGsxTlfJ8uy0DiQ6erMadlMM=; fh=O+tC46gTVnIslNmO+3v7MDXKfek3klSmEpv6rC+d3k8=; b=a5d4LUec0B1EW5rcPeNuH7lLSpihGkj5oz6kgEAJrNnosnJm0vlmT3S/PqyXfNUM5j yumNv20RdmYav/rdfAqby6h3jbrdBw3mcqkypu6kIQjbq1giLI4W3azqIFxCZi1CTDnS kjj5EQyToQsT1DvyCubSKTuaAcjqg05gyxp8oMBUvuCB+Jv7H9Z0jUhgM+LEN8fcT+nH aD72QnJJUHE2kLH03RpMYukF222mHAdiq18bHZYMfn5RZcLAle4aTecw+vu/fVhVSD8d d3uDl/Ab4VuhacTBCe4QJsfScJdW8oVOxuisYv0oPBq03QT6ezcHb+hFhhsKl+NnEWqo Jccw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hty37EaH; 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-7b6b5abf68csi471851685a.624.2024.12.06.10.15.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Dec 2024 10:15: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=hty37EaH; 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 1tJcqg-0001fn-Ag; Fri, 06 Dec 2024 13:14:42 -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 1tJcqc-0001Z8-Ow for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:38 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJcqb-0005QW-7K for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:38 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-434a044dce2so27046765e9.2 for ; Fri, 06 Dec 2024 10:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733508876; x=1734113676; 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=C1k+dmjInIZ8nHyYwBxRGsxTlfJ8uy0DiQ6erMadlMM=; b=hty37EaH5Z4EVHdKe+a1bOodU/5O6eO3vDZzYEueYpWsOGZ3SCj+DllnIQPYOA6kLM 0HXTMFKN8C795JPYmLejYzDpywhRe9svpNBrCy0e+8V5ZqT18seyRelbi4VZL8czJiAI 8cAFr3s0ba3ApI32Cf4AVvg8ZfHP9TK8nDbX1/ozKQl1k7BblhV5o0qjFwNvNHINE8lt 1wBLBiPeoxJcGVEKha5Kzxz/vk4ONAloQPMRtuG/FesCXwILvM9F2PAaVvhThuDAwQn7 iGI1lQUlYrFUzphZMWZN17XWUvKUbD6sTzz42rjp4weIae4gKTcIXtP0l9xgN5XJ9ewG 2zfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733508876; x=1734113676; 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=C1k+dmjInIZ8nHyYwBxRGsxTlfJ8uy0DiQ6erMadlMM=; b=jyB+uv4OWTSlsOI5ky4AS7ZvLj4W0m35tbZXOGX6OPXGGb6tdXl9N8m8spHo4TUwEV 3gqXzqpgwmx69AI6Z20Zp027xT38KeS3qqbPljrMtu2hOE9pDFGDFY/6YA+IF4HjkHqH fTBzVl/vSMXEeSygMV5x3hkUPt5hxOu7aCK3dcwVptMQ2Ynm1IZS7GjxNHQF8lFt8H4L KFrZ/6VvILtK+OfxXPJnPCZcAaRNM6wKaoq1yGQyBigXMGcsW7Psvz5ilwE2WycTd7I9 BypCa4a/gvNDfev6J1PwGp4YmZaCeH6t0UNyoNyY3ONEjkpJU36cGe+meqPdK17NOFSH EEcA== X-Forwarded-Encrypted: i=1; AJvYcCWHmBMozId7z26JBDbD6UySzg2Nk1/NA1gixFdiA5iifQhCwVCQvXQvDvGiAl+y5rPFj9aMHTr2Amzv@nongnu.org X-Gm-Message-State: AOJu0YxdgKbmGqMyXBFO8MDCcdu0+8fms/wyP+ihWu+lxYF+VHYe4bmR r2/u2P+pZ5SCLAzaXGSwBf/syKyKNDB5QUjWJ2zymgGU0gLX4zdlklW8lJs/W88= X-Gm-Gg: ASbGncu1GsCKr/o2g+BNpgzRP+hPGtt+gw1IYBN2W5C7W8zzDuGMI0txoChdWbe1qXL dazHTaBP2+PlcLIKwWhcfOzKibOM9fmBVO/Yjs3DyIekFgixkrzbnD6Wh6AZRyUCBIYvJ6GGgVq Z79k+Sf9NA8YP51BHRjcVz2ezeklhxUBS7lAcOuSJBNsztRJnglKcq/2q/08lLmDfXLNQaxm+ow E8XyLS/GEssbH7NWXjYtrbVgeheDLxCy1d8Fw7aFkYh/zS0lXJTYfLW9ZJEkXKWdiU= X-Received: by 2002:a05:600c:1d85:b0:434:a955:ede with SMTP id 5b1f17b1804b1-434ddeb8d9dmr43314725e9.14.1733508875758; Fri, 06 Dec 2024 10:14:35 -0800 (PST) Received: from localhost.localdomain ([95.127.41.180]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434e6af5819sm1660245e9.17.2024.12.06.10.14.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 06 Dec 2024 10:14:34 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Jiahui Cen , qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Gustavo Romero , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH 4/6] hw/pci: Add pci_bus_add_fw_cfg_extra_pci_roots() helper Date: Fri, 6 Dec 2024 19:13:50 +0100 Message-ID: <20241206181352.6836-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241206181352.6836-1-philmd@linaro.org> References: <20241206181352.6836-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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é --- 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 6 18:13: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: 847850 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp927363wrt; Fri, 6 Dec 2024 10:15:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXvzOLhYhhlUoUE7icbgpEI+o0Ch/24t2Pem/DxM4LploS1xc7fNvsX7pwRXOPAqsmSy2jRJA==@linaro.org X-Google-Smtp-Source: AGHT+IGFgIzsDgJyRs151hl+Z7iCm3UKar4A4xaWn4qO7OR9hZxAMdjnl6vW7RVRo+VuxIeEuBJp X-Received: by 2002:a05:6214:628:b0:6d8:b292:1e17 with SMTP id 6a1803df08f44-6d8e713a647mr63933666d6.15.1733508933728; Fri, 06 Dec 2024 10:15:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733508933; cv=none; d=google.com; s=arc-20240605; b=JP7A3MVN8l429ZmCC1+ejqMX8Xk5yjXXKM4yZ2vA/r7u9iB1mceYUe0Igh0g9hQo9G ppm4QLbr8gTnz3CYBFZ/Wq+kVrwq0eWgo7uF/vID2e55qFES60TZj7xXGiGKU6XYxsc9 40uA2v9EEq4HfDJx6oz3+ACAptNYRcbu6oOEZb1Fo8L2kVX1BHjkNxclrSiUqnZJQb6c WJ69nChAAEjZ0R5ztzYq3GdTthBrTI6w6xUx6kNxMlY5qVeY/R0DFkuP1gEHlRFgAvAS KnIWHUVaVvut5W8x9Jwf5idbcIU91A+2X5gMH4P00JglbYZG+bJfQiqVqcs8dwWu9m+5 qEIA== 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=SvVPy+gwf8NA8vrmhM2eQ3IGQk6ahNK7Fgaq5e8ko14=; fh=/se7qvbamC+8T0oV1yZ7XZR6lg5FTZjegQ1Lqkt03Zc=; b=Zah49GtgjrV48NiC48YYo1ACIEpDbgJM70pI9MF0b7BmbN76lOABq29h92fcSzngxd qJAx8un63DoWDUKKvBnmFrozwVVK6r6O+39kQpAdyD0TYmHt7NTjo4Utu50dAAO6+AUY +kpAEDPDi7guebi9s1N1jKWP+iHOqMnJzKRBKoIPop8Kcg0ivxI0+2LUKbf/To+NCofY 4luQOCR/t7Al8r1HzX5yKPOSzcu6aVB7uVanEYS7M1lgjXsPEdOKyrG/VviXr21bIMA5 2znOjs/EjkDeu1E0567SEEia12T4X6clc1UO/kYkyPFpxjZMhznls22+YBanx8zuf2lT 2JNQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PYc4rXas; 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-6d8f5ce1c89si4597036d6.333.2024.12.06.10.15.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Dec 2024 10:15:33 -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=PYc4rXas; 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 1tJcqy-0001tU-3U; Fri, 06 Dec 2024 13:15:01 -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 1tJcqn-0001p5-PL for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:51 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJcqm-0005R1-6A for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:14:49 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-37ed3bd6114so1046802f8f.2 for ; Fri, 06 Dec 2024 10:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733508886; x=1734113686; 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=SvVPy+gwf8NA8vrmhM2eQ3IGQk6ahNK7Fgaq5e8ko14=; b=PYc4rXasb3NI1BFNCi5nsKR4zPfNLk9ooRYSz4Mvbf2LGKwddbzZ//PfntnGC74Iwx bdYpn7AznzmK1Us7jzntkptkh8PvUrSE6PC/xJ6QhXgUNt2EJnrI2yCn0igOq+9y2SYm MzbrfpfUVNvO0EoSPn27u3L5n+8K/15gvMqzGtMXEagRA9lqoOyByZII8SRFhrN0bZu4 txDpHUAnqwkuxno7GPv6pk07qhMDT3s+Ttz+XKzzF9SO+4Sy89VSeBzaEunQPX4bxWKl 2i7CW33sLntD3OrlfW+wZ1fh8nQeBDdKGLkDge4H8hOExQ8nn45koNVbxpL2m+xpnmg0 hM0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733508886; x=1734113686; 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=SvVPy+gwf8NA8vrmhM2eQ3IGQk6ahNK7Fgaq5e8ko14=; b=MgG2xKnDM2bnAfdcSZh+L/QjpYjYwmVnev0OCoQNyhU6S8giksl4ABsoZzm6mUFitv v8VjUFl22Yjw0S9M0M+Cx5nHMkcNb/eRlri6MhYVH6ekeVoFrvXI+Q7iIz3LErTNRfir /GksZVe6W2ZO8tJnu00dNglfAdlvpg3KRwXzqzGxYYvpl2X6Q3r8y6+a2fuYYiF480AG /kA7FLEGGEXc+ZKqzSWWqy2dcYdhR8AJ92UaFCQQPh7/cEAsWEkJKWcOqzc7aYyuHGo+ T4tv+lsMepQJ6woUyttgoDKNwOnkYs7yh75nxzYTOFghp51vLdxIBO6jINzzrjn0HHnp Vi8A== X-Forwarded-Encrypted: i=1; AJvYcCVYTigZv1ctG+p11xknjTj6JBKznz0YOtfl43vwE5wue2JDqNlez+k0g4uZmmuW/TNCfk6MBHamKep5@nongnu.org X-Gm-Message-State: AOJu0Yy9KxdJ72a+t/LfGS/jKqAeknN/rcKGx9Cmw40j4XdrQd5U8ikU 3lL/AmQivXbxhlPznJSL/3f92DGP7gEhEFELk3Gh7rtH+wGUmV6r64qtj1tMAyY= X-Gm-Gg: ASbGnctr/HU+fMSqMX9Z0gVRGPt1X4ZX0Y2Ep5e97mv0rA4X8Q8jVC2tGnQv1ZJd6PK iAirpL0SHXXUxfaP1Do/JGhuDYDY2iRB7UXWOPbEQUdxtJXHkExhFLdnCGzt7YTnOzGpAo5DkBp g0X892uiC/BorzNzy0irE+3gFuupCqTHcQBPLKSIQAigbhTURx2FY9tlwJtUPKzaXK9YuWfdLH2 3kMJSD3tFPk2WtXr4cQTYr7OXAT0qYA8JDITBY3cfSZ2XVSCNEOsHZmzqazvOB+G+Y= X-Received: by 2002:a5d:59a6:0:b0:385:e013:73f6 with SMTP id ffacd0b85a97d-3862b3e8503mr3000827f8f.50.1733508886570; Fri, 06 Dec 2024 10:14:46 -0800 (PST) Received: from localhost.localdomain ([95.127.41.180]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3862e767db6sm1612934f8f.26.2024.12.06.10.14.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 06 Dec 2024 10:14:43 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Jiahui Cen , qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Gustavo Romero , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH 5/6] hw: Use pci_bus_add_fw_cfg_extra_pci_roots() Date: Fri, 6 Dec 2024 19:13:51 +0100 Message-ID: <20241206181352.6836-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241206181352.6836-1-philmd@linaro.org> References: <20241206181352.6836-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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 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é --- 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 1a381e9a2bd..191e1d65a8f 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 317aaca25a0..3a656f398fd 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -628,7 +628,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 6 18:13: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: 847853 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp927776wrt; Fri, 6 Dec 2024 10:16:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWDBzr2UpyHP830IJ45K/bBLJ4vIsCk+Dbydod4z32Z123r3BIt5E4l46ulQQu/3uHk8LxeMA==@linaro.org X-Google-Smtp-Source: AGHT+IGE5CuCp7GDR88aL9N8ArM3kRHVcZOvpq0Fcwq6G7u05LM8ISoljKgmlG62b+kmd++hse/+ X-Received: by 2002:a05:620a:4592:b0:7b6:672d:7fbb with SMTP id af79cd13be357-7b6bcb46a73mr652683085a.47.1733508987465; Fri, 06 Dec 2024 10:16:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733508987; cv=none; d=google.com; s=arc-20240605; b=Lxyyn1WnRHuVbOxt5FhkyfdzI5mxnrea8LyHtd8JntV2EA5Jyj7+IRQuQgYmKS8j08 whOn7NtKlOXbFE1Y33LZLvAgRVD2em7Qpk2S6Nabvr9JLQctrFbC+bGMEROk/Lcq8MEU RsW60ISDFV/HtxoHBrsSTeMrQCAvSamDEyAuWQxmMWFcHbOX6vTA56LXY4epInj4u5lU uYewP3yD5rjfd8XUbV8EX5KJ1xXYe7cRPAUCU2GkhrKCEWDLV8leWsSffEyi23Zbs74q 4RbQ0uKz31PQM6VDWhtfi2mnK65Rq4OqnVmGo74WKhk7SlSVxMp1RBIoiM6R2wyAp0gF p9fA== 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=drnor6SocDhMk0Sf/VXY5/KGSh3UPEWhTs9UqjHuGlg=; fh=D3DQMAWsiUlbi9UMsTSJEr0KAnXSFlZLzsE6CsRL6Gs=; b=IGeQLV9ayNOGgjN4BkNq7/EXBK448+1M5l0CrD3yPos6cSq4lW66JulSU058tqRnDd Ps9cBySnBdxumDn8TzphuJCKwF/TmIfAIbfE9fOHXWUFNGl1BcKBikwZh7DKZ78P/9Oh sgB8L0zA5+UEAylOyBh6c6HcNwfWx+APn433mn8TTo0nqJYs9LQ7HiMhQno1jR2AZ2J/ 6FHjWxW389Tl0TQMG3qM3bEotE26bYKj3DpZnhrI/8C9FyG57j1XbcvSeL5Z4MT0DaCB gGYz8kOziYrkpqLXg/vuVG4A4g1nfMQCCna80AyCXuE8tcE8o9GWqPbGeuWyosdV57H0 cuBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BSDhbKH4; 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-7b6b5abdab8si469031285a.579.2024.12.06.10.16.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Dec 2024 10:16:27 -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=BSDhbKH4; 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 1tJcrv-0003Kq-Uj; Fri, 06 Dec 2024 13:16:00 -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 1tJcrI-0002e0-1e for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:15:21 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJcrA-0005Sl-JL for qemu-devel@nongnu.org; Fri, 06 Dec 2024 13:15:14 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4349f160d62so16581035e9.2 for ; Fri, 06 Dec 2024 10:15:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733508911; x=1734113711; 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=drnor6SocDhMk0Sf/VXY5/KGSh3UPEWhTs9UqjHuGlg=; b=BSDhbKH4cTIS9c9S3Rsrp4CKbevQE5m+sQYvxe9VEntFqFC1mbS4wwsYD8ArzZ3Hin tONTi/Z5KYVMtmUTXJIZq0RTdCxH26L3lV3uV1eodXpdviCYRIzQbt2aj+khT/ZIWfnN Mj9XGSztoUGv0RcM+wsJL2mFDsZEQRzOQOy6zgBJerAvxVpyN+kYOYTtVmvTzFahFQzA vzEHmtcVR1efdcEzHv1q5qAtrbLSBKwDGbL0u0JL4QFMF0gtHtMMZxD5xmtCZu1nsTLb jZbFj6fbpbWFL9Mqa2l4vAZ7fNSlCgDX4VF8knITirzkR4FWPReeNVXI6WlUnaWEq4xp Chmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733508911; x=1734113711; 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=drnor6SocDhMk0Sf/VXY5/KGSh3UPEWhTs9UqjHuGlg=; b=t0Pnh4/0mU1BcJMHigZu3S8+BOslwWKWcKiWKDT+qNERYzgf+L9CEyRTXH4V3gguU/ Qwl1tQW/2uObwi1qp64/0ocoGq4V1z7QbJRtmfiCF+zlS6ohhE9jFnYB8AfSy0EOCUp9 OQYi07g118FFrGrT0kdEWr88I7S/ALH4bwpmrmmi0JbFkpsC154bicK5DPzr07N+d67U wj17L/tUjiLZlMvjiH4mJtGd1VE0LKHzKY3T14po1LTziFeSsGen1YTGBXH9vjNNBqL1 9RmksGbCUonug8EeS9N/TOa/0xLjU8vhanpbko+Ieu4f3hK+XYz9Ickx186lI3DwQjz7 vIWA== X-Forwarded-Encrypted: i=1; AJvYcCVN/jUQG37qXRQXXKtSe4B5fyf2EnvsFbxAstVy8RLyu8r27ImQHfeamHLRZuLbXTRBGnoAeupCNsCz@nongnu.org X-Gm-Message-State: AOJu0YzKoHVLMjptS7hnVfN7dkt4Jh+Wv+sw9I1AqbPfp6OLvppAjHi+ VOsvaqG73sd3GzBCdoT/ByhKAF8AqhCcUeLFT4pYZcFsMfYAGRQSytoG7jXKBrs= X-Gm-Gg: ASbGnctne1z0jRK54MjhKCbFMfPdSo3vyrlF269Caf4noLX1y8Ua9asZK6G3RylOdGs dRcB8xJPFRjjjWtninbtOl5+SSD0wF6GrDRko0eJ+G4zqoEHsTjOUctsxA3Axvz55fXdcjpU6lI RZnN/ECHe8d40WgB37AfEjreQtCfwCH12FfyOo9dzRPOcc7xJm2NrYC2dUdv9pLMO+JJDEyyVU0 MdnJXUrxndOSjbJ4wjZ17AtI+0zg6hfBDpd/Nlhs8JPUKsLoNJbHb4M06s6JAaZLGk= X-Received: by 2002:a05:600c:3aca:b0:431:5863:4240 with SMTP id 5b1f17b1804b1-434dded69bfmr34076075e9.24.1733508910870; Fri, 06 Dec 2024 10:15:10 -0800 (PST) Received: from localhost.localdomain ([95.127.41.180]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434da1133c3sm62876255e9.31.2024.12.06.10.14.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 06 Dec 2024 10:14:54 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Jiahui Cen , qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Gustavo Romero , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH 6/6] hw/nvram/fw_cfg: Remove fw_cfg_add_extra_pci_roots() Date: Fri, 6 Dec 2024 19:13:52 +0100 Message-ID: <20241206181352.6836-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241206181352.6836-1-philmd@linaro.org> References: <20241206181352.6836-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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é --- 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 fcb06f18cc3..80a1549ad05 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -312,15 +312,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 b94cd27bd85..053db7e08cc 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 @@ -1057,28 +1056,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());