From patchwork Fri Dec 7 17:03:55 2018 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: 10718613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1182315A6 for ; Fri, 7 Dec 2018 17:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00797289FF for ; Fri, 7 Dec 2018 17:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5A532EC7A; Fri, 7 Dec 2018 17:18:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88C09289FF for ; Fri, 7 Dec 2018 17:18:33 +0000 (UTC) Received: from localhost ([::1]:47398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJlo-00025d-Ep for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 12:18:32 -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_Mathieu-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) 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?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é 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 = "QEMU Virtual Machine"; - if (!vms->fw_cfg) { - return; - } - if (kvm_enabled()) { product = "KVM Virtual Machine"; } From patchwork Fri Dec 7 17:03:56 2018 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: 10718599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A584517DB for ; Fri, 7 Dec 2018 17:11:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 935DA294E9 for ; Fri, 7 Dec 2018 17:11:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 910252EE35; Fri, 7 Dec 2018 17:11:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 190C92E057 for ; Fri, 7 Dec 2018 17:11:44 +0000 (UTC) Received: from localhost ([::1]:47339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJfD-0005eT-5B for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 12:11:43 -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_Mathieu-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) 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_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Philippe Mathieu-Daudé --- 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" From patchwork Fri Dec 7 17:03:57 2018 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: 10718595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B22717DB for ; Fri, 7 Dec 2018 17:11:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08FE72EDB6 for ; Fri, 7 Dec 2018 17:11:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 066102ED3E; Fri, 7 Dec 2018 17:11:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 738D82EDB6 for ; Fri, 7 Dec 2018 17:11:20 +0000 (UTC) Received: from localhost ([::1]:47332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJep-0005HD-II for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 12:11:19 -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_Mathieu-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) 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_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Philippe Mathieu-Daudé --- 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" From patchwork Fri Dec 7 17:03:58 2018 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: 10718603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3AFF15A6 for ; Fri, 7 Dec 2018 17:14:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D112C26490 for ; Fri, 7 Dec 2018 17:14:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C51E928870; Fri, 7 Dec 2018 17:14:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A96126490 for ; Fri, 7 Dec 2018 17:14:24 +0000 (UTC) Received: from localhost ([::1]:47362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJhn-0000UL-FA for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 12:14:23 -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_Mathieu-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) 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_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Reviewed-by: Laszlo Ersek --- 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, uint16_t key, 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); } @@ -634,6 +635,7 @@ void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value) { size_t sz = strlen(value) + 1; + trace_fw_cfg_add_string(key, value); fw_cfg_add_bytes(s, key, g_memdup(value, sz), sz); } @@ -643,6 +645,7 @@ void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value) copy = g_malloc(sizeof(value)); *copy = cpu_to_le16(value); + trace_fw_cfg_add_i16(key, value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } @@ -662,6 +665,7 @@ void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value) copy = g_malloc(sizeof(value)); *copy = cpu_to_le32(value); + trace_fw_cfg_add_i32(key, value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } @@ -671,6 +675,7 @@ void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value) copy = g_malloc(sizeof(value)); *copy = cpu_to_le64(value); + trace_fw_cfg_add_i64(key, value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } 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) "write addr %d: 0x%02x -> # hw/nvram/fw_cfg.c fw_cfg_select(void *s, uint16_t key, int ret) "%p key %d = %d" fw_cfg_read(void *s, uint64_t ret) "%p = 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 ", value '%s'" +fw_cfg_add_i16(uint16_t key, uint32_t value) "key 0x%04" PRIx16 ", value 0x%" PRIx32 +fw_cfg_add_i32(uint16_t key, uint32_t value) "key 0x%04" PRIx16 ", value 0x%" PRIx32 +fw_cfg_add_i64(uint16_t key, uint64_t value) "key 0x%04" PRIx16 ", value 0x%" PRIx64 From patchwork Fri Dec 7 17:03:59 2018 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: 10718617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDB561759 for ; Fri, 7 Dec 2018 17:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA332EDC6 for ; Fri, 7 Dec 2018 17:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0BF02F1B9; Fri, 7 Dec 2018 17:21:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 259192EDC6 for ; Fri, 7 Dec 2018 17:21:14 +0000 (UTC) Received: from localhost ([::1]:47415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJoP-0004T2-BU for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 12:21:13 -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_Mathieu-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) 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_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP $ 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é --- 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 = "fw_cfg", + .args_type = "", + .params = "", + .help = "Display the table of the fw_cfg entries registered", + .cmd = hmp_info_fw_cfg, + }, + +STEXI +@item info fw_cfg +@findex info fw_cfg +Show roms. ETEXI 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" #define FW_CFG_FILE_SLOTS_DFLT 0x20 @@ -1164,3 +1165,117 @@ static void fw_cfg_register_types(void) } type_init(fw_cfg_register_types) + +static const char *fw_cfg_wellknown_entries[0x20] = { + [FW_CFG_SIGNATURE] = "signature", + [FW_CFG_ID] = "id", + [FW_CFG_UUID] = "uuid", + [FW_CFG_RAM_SIZE] = "ram_size", + [FW_CFG_NOGRAPHIC] = "nographic", + [FW_CFG_NB_CPUS] = "nb_cpus", + [FW_CFG_MACHINE_ID] = "machine_id", + [FW_CFG_KERNEL_ADDR] = "kernel_addr", + [FW_CFG_KERNEL_SIZE] = "kernel_size", + [FW_CFG_KERNEL_CMDLINE] = "kernel_cmdline", + [FW_CFG_INITRD_ADDR] = "initrd_addr", + [FW_CFG_INITRD_SIZE] = "initdr_size", + [FW_CFG_BOOT_DEVICE] = "boot_device", + [FW_CFG_NUMA] = "numa", + [FW_CFG_BOOT_MENU] = "boot_menu", + [FW_CFG_MAX_CPUS] = "max_cpus", + [FW_CFG_KERNEL_ENTRY] = "kernel_entry", + [FW_CFG_KERNEL_DATA] = "kernel_data", + [FW_CFG_INITRD_DATA] = "initrd_data", + [FW_CFG_CMDLINE_ADDR] = "cmdline_addr", + [FW_CFG_CMDLINE_SIZE] = "cmdline_size", + [FW_CFG_CMDLINE_DATA] = "cmdline_data", + [FW_CFG_SETUP_ADDR] = "setup_addr", + [FW_CFG_SETUP_SIZE] = "setup_size", + [FW_CFG_SETUP_DATA] = "setup_data", + [FW_CFG_FILE_DIR] = "file_dir", +}; + +void hmp_info_fw_cfg(Monitor *mon, const QDict *qdict) +{ + FWCfgState *s = fw_cfg_find(); + int arch, key; + + monitor_printf(mon, "%12s %5s %7s %9s %6s %-24s\n", + "Type", "Perm", "Size", "Specific", "Order", "Info"); + for (arch = 0; arch < ARRAY_SIZE(s->entries); ++arch) { + for (key = 0; key < fw_cfg_max_entry(s); ++key) { + FWCfgEntry *e = &s->entries[arch][key]; + const char *perm = e->allow_write ? "RW" : "RO"; + const char *arch_spec = arch ? "arch_spec" : ""; + char *type, *info = NULL; + + if (!e->len) { + continue; + } + if (key >= FW_CFG_FILE_FIRST) { + int id = key - FW_CFG_FILE_FIRST; + const char *path = s->files->f[id].name; + + type = 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 = g_strdup(fw_cfg_wellknown_entries[key]); + if (!type) { + type = g_strdup_printf("entry_%d", key); + } + + switch (key) { + case FW_CFG_SIGNATURE: + info = g_strndup((const gchar *)e->data, e->len); + break; + case FW_CFG_UUID: + info = qemu_uuid_unparse_strdup((const QemuUUID *)e->data); + 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 = g_strdup_printf("0x%04x", lduw_le_p(e->data)); + break; + case 4: + info = g_strdup_printf("0x%08x", ldl_le_p(e->data)); + break; + case 8: + info = 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); +void hmp_info_fw_cfg(Monitor *mon, const QDict *qdict); + #endif From patchwork Fri Dec 7 17:04:00 2018 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: 10718601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E94A117DB for ; Fri, 7 Dec 2018 17:13:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D66F526490 for ; Fri, 7 Dec 2018 17:13:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C50E92855E; Fri, 7 Dec 2018 17:13:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5A98F26490 for ; Fri, 7 Dec 2018 17:13:58 +0000 (UTC) Received: from localhost ([::1]:47353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVJhN-0008S0-43 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 12:13:57 -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_Mathieu-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) 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_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é --- 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 *filename, fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true); } +void *fw_cfg_add_file_from_host(FWCfgState *s, const char *filename, + const char *host_path, size_t *len) +{ + GError *gerr = NULL; + gchar *ptr = NULL; + gsize contents_len = 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->message); + g_error_free(gerr); + return NULL; + } + if (len) { + *len = 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, uint64_t value); void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data, size_t len); +/** + * 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 starting + * pointer is only linked, NOT 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. + * + * 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