From nobody Mon May 6 00:20:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544203145834278.8548893499442; Fri, 7 Dec 2018 09:19:05 -0800 (PST) Received: from localhost ([::1]:47398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJmK-00025d-NM for importer@patchew.org; Fri, 07 Dec 2018 12:19:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJYA-0005JY-WF for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVJYA-0004y1-Ax for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56398) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVJY7-0004uD-Ee; Fri, 07 Dec 2018 12:04:23 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96AA0C04959B; Fri, 7 Dec 2018 17:04:22 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.154]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C4372B453; Fri, 7 Dec 2018 17:04:19 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Laszlo Ersek , Peter Maydell Date: Fri, 7 Dec 2018 18:03:55 +0100 Message-Id: <20181207170400.5129-2-philmd@redhat.com> In-Reply-To: <20181207170400.5129-1-philmd@redhat.com> References: <20181207170400.5129-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 07 Dec 2018 17:04:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/6] hw/arm/virt: Remove null-check in virt_build_smbios() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Since af1f60a4022, the fw_cfg field is always created in machvirt_init(). There is no need to null check it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/arm/virt.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f69e7eb399..36303ed59c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1279,10 +1279,6 @@ static void virt_build_smbios(VirtMachineState *vms) size_t smbios_tables_len, smbios_anchor_len; const char *product =3D "QEMU Virtual Machine"; =20 - if (!vms->fw_cfg) { - return; - } - if (kvm_enabled()) { product =3D "KVM Virtual Machine"; } --=20 2.17.2 From nobody Mon May 6 00:20:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544202736882817.697438297086; Fri, 7 Dec 2018 09:12:16 -0800 (PST) Received: from localhost ([::1]:47339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJfj-0005eT-3w for importer@patchew.org; Fri, 07 Dec 2018 12:12:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJYD-0005Lf-3F for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVJYC-00051o-Dv for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56422) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVJYA-0004xV-KA; Fri, 07 Dec 2018 12:04:26 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB946C0586D3; Fri, 7 Dec 2018 17:04:25 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.154]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DFD019C7F; Fri, 7 Dec 2018 17:04:22 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Laszlo Ersek , Peter Maydell Date: Fri, 7 Dec 2018 18:03:56 +0100 Message-Id: <20181207170400.5129-3-philmd@redhat.com> In-Reply-To: <20181207170400.5129-1-philmd@redhat.com> References: <20181207170400.5129-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 07 Dec 2018 17:04:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/6] hw/arm: Remove unused include X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , qemu-devel@nongnu.org, Shannon Zhao , qemu-arm@nongnu.org, Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt-acpi-build.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 5785fb697c..98d7f7cf20 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -35,7 +35,6 @@ #include "target/arm/cpu.h" #include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" -#include "hw/nvram/fw_cfg.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/loader.h" #include "hw/hw.h" --=20 2.17.2 From nobody Mon May 6 00:20:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544202718891879.3623703461869; Fri, 7 Dec 2018 09:11:58 -0800 (PST) Received: from localhost ([::1]:47332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJfK-0005HD-HI for importer@patchew.org; Fri, 07 Dec 2018 12:11:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJYF-0005Np-6a for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVJYE-00054P-DX for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58982) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVJYE-00053W-7P for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 809143078AA9; Fri, 7 Dec 2018 17:04:29 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.154]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4DF819C7F; Fri, 7 Dec 2018 17:04:26 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Laszlo Ersek Date: Fri, 7 Dec 2018 18:03:57 +0100 Message-Id: <20181207170400.5129-4-philmd@redhat.com> In-Reply-To: <20181207170400.5129-1-philmd@redhat.com> References: <20181207170400.5129-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 07 Dec 2018 17:04:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/6] hw/i386: Remove unused include X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , qemu-devel@nongnu.org, Paolo Bonzini , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/acpi/piix4.c | 1 - hw/i386/acpi-build.c | 1 - hw/i386/pc.c | 1 - 3 files changed, 3 deletions(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index e330f24c71..49a33bfcda 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -28,7 +28,6 @@ #include "sysemu/sysemu.h" #include "qapi/error.h" #include "qemu/range.h" -#include "hw/nvram/fw_cfg.h" #include "exec/address-spaces.h" #include "hw/acpi/piix4.h" #include "hw/acpi/pcihp.h" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 236a20eaa8..1e5c371294 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -35,7 +35,6 @@ #include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" #include "hw/acpi/cpu.h" -#include "hw/nvram/fw_cfg.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/loader.h" #include "hw/isa/isa.h" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f095725dba..2221dcdb36 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -35,7 +35,6 @@ #include "hw/ide.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" -#include "hw/nvram/fw_cfg.h" #include "hw/timer/hpet.h" #include "hw/smbios/smbios.h" #include "hw/loader.h" --=20 2.17.2 From nobody Mon May 6 00:20:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544202896065650.2612603788779; Fri, 7 Dec 2018 09:14:56 -0800 (PST) Received: from localhost ([::1]:47362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJiI-0000UL-7j for importer@patchew.org; Fri, 07 Dec 2018 12:14:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJYR-0005hZ-Bc for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVJYO-0005Gd-Rj for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43098) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVJYO-0005Ex-Gs for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:40 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 88ABB307DAC7 for ; Fri, 7 Dec 2018 17:04:39 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.154]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B01E1974D; Fri, 7 Dec 2018 17:04:29 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Laszlo Ersek Date: Fri, 7 Dec 2018 18:03:58 +0100 Message-Id: <20181207170400.5129-5-philmd@redhat.com> In-Reply-To: <20181207170400.5129-1-philmd@redhat.com> References: <20181207170400.5129-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 07 Dec 2018 17:04:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/6] hw/nvram/fw_cfg: Add trace events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek Reviewed-by: Michael S. Tsirkin --- hw/nvram/fw_cfg.c | 5 +++++ hw/nvram/trace-events | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 3cb726ff68..582653f07e 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -627,6 +627,7 @@ static void *fw_cfg_modify_bytes_read(FWCfgState *s, ui= nt16_t key, =20 void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len) { + trace_fw_cfg_add_bytes(key, len); fw_cfg_add_bytes_callback(s, key, NULL, NULL, NULL, data, len, true); } =20 @@ -634,6 +635,7 @@ void fw_cfg_add_string(FWCfgState *s, uint16_t key, con= st char *value) { size_t sz =3D strlen(value) + 1; =20 + trace_fw_cfg_add_string(key, value); fw_cfg_add_bytes(s, key, g_memdup(value, sz), sz); } =20 @@ -643,6 +645,7 @@ void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16= _t value) =20 copy =3D g_malloc(sizeof(value)); *copy =3D cpu_to_le16(value); + trace_fw_cfg_add_i16(key, value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } =20 @@ -662,6 +665,7 @@ void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32= _t value) =20 copy =3D g_malloc(sizeof(value)); *copy =3D cpu_to_le32(value); + trace_fw_cfg_add_i32(key, value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } =20 @@ -671,6 +675,7 @@ void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64= _t value) =20 copy =3D g_malloc(sizeof(value)); *copy =3D cpu_to_le64(value); + trace_fw_cfg_add_i64(key, value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } =20 diff --git a/hw/nvram/trace-events b/hw/nvram/trace-events index 6b55ba7a09..0ee0f8d04a 100644 --- a/hw/nvram/trace-events +++ b/hw/nvram/trace-events @@ -7,4 +7,9 @@ nvram_write(uint32_t addr, uint32_t old, uint32_t val) "wri= te addr %d: 0x%02x -> # hw/nvram/fw_cfg.c fw_cfg_select(void *s, uint16_t key, int ret) "%p key %d =3D %d" fw_cfg_read(void *s, uint64_t ret) "%p =3D 0x%"PRIx64 +fw_cfg_add_bytes(uint16_t key, size_t len) "key 0x%04" PRIx16 " (%zu bytes= )" fw_cfg_add_file(void *s, int index, char *name, size_t len) "%p #%d: %s (%= zd bytes)" +fw_cfg_add_string(uint16_t key, const char *value) "key 0x%04" PRIx16 ", v= alue '%s'" +fw_cfg_add_i16(uint16_t key, uint32_t value) "key 0x%04" PRIx16 ", value 0= x%" PRIx32 +fw_cfg_add_i32(uint16_t key, uint32_t value) "key 0x%04" PRIx16 ", value 0= x%" PRIx32 +fw_cfg_add_i64(uint16_t key, uint64_t value) "key 0x%04" PRIx16 ", value 0= x%" PRIx64 --=20 2.17.2 From nobody Mon May 6 00:20:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544203298164519.8877086200223; Fri, 7 Dec 2018 09:21:38 -0800 (PST) Received: from localhost ([::1]:47415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJom-0004T2-VE for importer@patchew.org; Fri, 07 Dec 2018 12:21:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJYY-0005xq-1X for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVJYS-0005LG-UK for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59492) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVJYS-0005Jh-EW for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:44 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83796E1851 for ; Fri, 7 Dec 2018 17:04:43 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.154]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E7C919C7F; Fri, 7 Dec 2018 17:04:39 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Laszlo Ersek , "Dr . David Alan Gilbert" Date: Fri, 7 Dec 2018 18:03:59 +0100 Message-Id: <20181207170400.5129-6-philmd@redhat.com> In-Reply-To: <20181207170400.5129-1-philmd@redhat.com> References: <20181207170400.5129-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 07 Dec 2018 17:04:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/6] hw/nvram/fw_cfg: Add HMP 'info fw_cfg' command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" $ qemu-system-x86_64 -S -monitor stdio (qemu) info fw_cfg Type Perm Size Specific Order Info signature RO 4 QEMU id RO 4 0x00000003 uuid RO 16 00000000-0000-0000-0000-= 000000000000 ram_size RO 8 0x0000000008000000 nographic RO 2 0x0000 nb_cpus RO 2 0x0001 numa RO 16 boot_menu RO 2 0x0000 max_cpus RO 2 0x0001 file_dir RO 2052 file (id 1) RO 36 160 etc/acpi/rsdp file (id 2) RO 131072 130 etc/acpi/tables file (id 3) RO 4 15 etc/boot-fail-wait file (id 4) RO 20 40 etc/e820 file (id 5) RO 31 30 etc/smbios/smbios-anchor file (id 6) RO 320 20 etc/smbios/smbios-tables file (id 7) RO 6 90 etc/system-states file (id 8) RO 4096 140 etc/table-loader file (id 10) RO 9216 55 genroms/kvmvapic.bin uuid RO 4 (arch spec) 01000000-0000-0000-0000-= 000000000000 ram_size RO 324 (arch spec) nographic RO 121 (arch spec) (qemu) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hmp-commands-info.hx | 14 +++++ hw/nvram/fw_cfg.c | 115 ++++++++++++++++++++++++++++++++++++++ include/hw/nvram/fw_cfg.h | 2 + 3 files changed, 131 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index cbee8b944d..9e86dceeb4 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -916,6 +916,20 @@ STEXI @item info sev @findex info sev Show SEV information. +ETEXI + + { + .name =3D "fw_cfg", + .args_type =3D "", + .params =3D "", + .help =3D "Display the table of the fw_cfg entries registere= d", + .cmd =3D hmp_info_fw_cfg, + }, + +STEXI +@item info fw_cfg +@findex info fw_cfg +Show roms. ETEXI =20 STEXI diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 582653f07e..50525ec1dd 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -36,6 +36,7 @@ #include "qemu/config-file.h" #include "qemu/cutils.h" #include "qapi/error.h" +#include "monitor/monitor.h" =20 #define FW_CFG_FILE_SLOTS_DFLT 0x20 =20 @@ -1164,3 +1165,117 @@ static void fw_cfg_register_types(void) } =20 type_init(fw_cfg_register_types) + +static const char *fw_cfg_wellknown_entries[0x20] =3D { + [FW_CFG_SIGNATURE] =3D "signature", + [FW_CFG_ID] =3D "id", + [FW_CFG_UUID] =3D "uuid", + [FW_CFG_RAM_SIZE] =3D "ram_size", + [FW_CFG_NOGRAPHIC] =3D "nographic", + [FW_CFG_NB_CPUS] =3D "nb_cpus", + [FW_CFG_MACHINE_ID] =3D "machine_id", + [FW_CFG_KERNEL_ADDR] =3D "kernel_addr", + [FW_CFG_KERNEL_SIZE] =3D "kernel_size", + [FW_CFG_KERNEL_CMDLINE] =3D "kernel_cmdline", + [FW_CFG_INITRD_ADDR] =3D "initrd_addr", + [FW_CFG_INITRD_SIZE] =3D "initdr_size", + [FW_CFG_BOOT_DEVICE] =3D "boot_device", + [FW_CFG_NUMA] =3D "numa", + [FW_CFG_BOOT_MENU] =3D "boot_menu", + [FW_CFG_MAX_CPUS] =3D "max_cpus", + [FW_CFG_KERNEL_ENTRY] =3D "kernel_entry", + [FW_CFG_KERNEL_DATA] =3D "kernel_data", + [FW_CFG_INITRD_DATA] =3D "initrd_data", + [FW_CFG_CMDLINE_ADDR] =3D "cmdline_addr", + [FW_CFG_CMDLINE_SIZE] =3D "cmdline_size", + [FW_CFG_CMDLINE_DATA] =3D "cmdline_data", + [FW_CFG_SETUP_ADDR] =3D "setup_addr", + [FW_CFG_SETUP_SIZE] =3D "setup_size", + [FW_CFG_SETUP_DATA] =3D "setup_data", + [FW_CFG_FILE_DIR] =3D "file_dir", +}; + +void hmp_info_fw_cfg(Monitor *mon, const QDict *qdict) +{ + FWCfgState *s =3D fw_cfg_find(); + int arch, key; + + monitor_printf(mon, "%12s %5s %7s %9s %6s %-24s\n", + "Type", "Perm", "Size", "Specific", "Order", "Info"); + for (arch =3D 0; arch < ARRAY_SIZE(s->entries); ++arch) { + for (key =3D 0; key < fw_cfg_max_entry(s); ++key) { + FWCfgEntry *e =3D &s->entries[arch][key]; + const char *perm =3D e->allow_write ? "RW" : "RO"; + const char *arch_spec =3D arch ? "arch_spec" : ""; + char *type, *info =3D NULL; + + if (!e->len) { + continue; + } + if (key >=3D FW_CFG_FILE_FIRST) { + int id =3D key - FW_CFG_FILE_FIRST; + const char *path =3D s->files->f[id].name; + + type =3D g_strdup_printf("file (id %d)", id); + monitor_printf(mon, "%12s %5s %7d %10s %5d %-24s\n", + type, perm, e->len, arch_spec, + get_fw_cfg_order(s, path), path); + g_free(type); + continue; + } + type =3D g_strdup(fw_cfg_wellknown_entries[key]); + if (!type) { + type =3D g_strdup_printf("entry_%d", key); + } + + switch (key) { + case FW_CFG_SIGNATURE: + info =3D g_strndup((const gchar *)e->data, e->len); + break; + case FW_CFG_UUID: + info =3D qemu_uuid_unparse_strdup((const QemuUUID *)e->dat= a); + break; + case FW_CFG_ID: + case FW_CFG_NOGRAPHIC: + case FW_CFG_NB_CPUS: + case FW_CFG_BOOT_MENU: + case FW_CFG_MAX_CPUS: + case FW_CFG_RAM_SIZE: + case FW_CFG_KERNEL_ADDR: + case FW_CFG_KERNEL_SIZE: + case FW_CFG_KERNEL_CMDLINE: + case FW_CFG_KERNEL_ENTRY: + case FW_CFG_KERNEL_DATA: + case FW_CFG_INITRD_ADDR: + case FW_CFG_INITRD_SIZE: + case FW_CFG_INITRD_DATA: + case FW_CFG_CMDLINE_ADDR: + case FW_CFG_CMDLINE_SIZE: + case FW_CFG_CMDLINE_DATA: + case FW_CFG_SETUP_ADDR: + case FW_CFG_SETUP_SIZE: + case FW_CFG_SETUP_DATA: + switch (e->len) { + case 2: + info =3D g_strdup_printf("0x%04x", lduw_le_p(e->data)); + break; + case 4: + info =3D g_strdup_printf("0x%08x", ldl_le_p(e->data)); + break; + case 8: + info =3D g_strdup_printf("0x%016" PRIx64, ldq_le_p(e->= data)); + break; + default: + break; + } + break; + default: + break; + } + monitor_printf(mon, "%12s %5s %7d %10s %5s %-24s\n", + type, perm, e->len, arch_spec, "", info ? info = : ""); + g_free(type); + g_free(info); + } + } +} diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index f5a6895a74..28630b2f26 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -226,4 +226,6 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, FWCfgState *fw_cfg_find(void); bool fw_cfg_dma_enabled(void *opaque); =20 +void hmp_info_fw_cfg(Monitor *mon, const QDict *qdict); + #endif --=20 2.17.2 From nobody Mon May 6 00:20:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154420287016156.73491818118316; Fri, 7 Dec 2018 09:14:30 -0800 (PST) Received: from localhost ([::1]:47353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJhs-0008S0-RS for importer@patchew.org; Fri, 07 Dec 2018 12:14:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJYa-00065C-6E for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVJYY-0005Qp-10 for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33586) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVJYW-0005NH-32 for qemu-devel@nongnu.org; Fri, 07 Dec 2018 12:04:48 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E59881DEA for ; Fri, 7 Dec 2018 17:04:46 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.154]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 45C9419C7F; Fri, 7 Dec 2018 17:04:43 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Laszlo Ersek Date: Fri, 7 Dec 2018 18:04:00 +0100 Message-Id: <20181207170400.5129-7-philmd@redhat.com> In-Reply-To: <20181207170400.5129-1-philmd@redhat.com> References: <20181207170400.5129-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 07 Dec 2018 17:04:46 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 6/6] hw/nvram/fw_cfg: Add fw_cfg_add_file_from_host() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add a function to read the full content of file on the host, and add a new 'file' name item to the fw_cfg device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvram/fw_cfg.c | 22 ++++++++++++++++++++++ include/hw/nvram/fw_cfg.h | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 50525ec1dd..f3232fcb16 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -842,6 +842,28 @@ void fw_cfg_add_file(FWCfgState *s, const char *filen= ame, fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, tru= e); } =20 +void *fw_cfg_add_file_from_host(FWCfgState *s, const char *filename, + const char *host_path, size_t *len) +{ + GError *gerr =3D NULL; + gchar *ptr =3D NULL; + gsize contents_len =3D 0; + + + if (g_file_get_contents(host_path, &ptr, &contents_len, &gerr)) { + fw_cfg_add_file(s, filename, ptr, contents_len); + } else { + error_report("failed to read file %s, %s", host_path, gerr->messag= e); + g_error_free(gerr); + return NULL; + } + if (len) { + *len =3D contents_len; + } + + return ptr; +} + void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data, size_t len) { diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 28630b2f26..8de8d63433 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -166,6 +166,28 @@ void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint6= 4_t value); void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data, size_t len); =20 +/** + * fw_cfg_add_file_from_host: + * @s: fw_cfg device being modified + * @filename: name of new fw_cfg file item + * @host_path: path of the host file to read the data from + * @len: pointer to hold the length of the host file (optional) + * + * Read the content of a host file as a raw "blob" then add a new NAMED + * fw_cfg item of the file size. If @len is provided, it will contains the + * total length read from the host file. The data referenced by the starti= ng + * pointer is only linked, NOT copied, into the data structure of the fw_c= fg + * device. + * The next available (unused) selector key starting at FW_CFG_FILE_FIRST + * will be used; also, a new entry will be added to the file directory + * structure residing at key value FW_CFG_FILE_DIR, containing the item na= me, + * data size, and assigned selector key value. + * + * Returns: pointer to the file content, or NULL if an error occured. + */ +void *fw_cfg_add_file_from_host(FWCfgState *s, const char *filename, + const char *host_path, size_t *len); + /** * fw_cfg_add_file_callback: * @s: fw_cfg device being modified --=20 2.17.2