From nobody Wed May 1 02:49:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555962794; cv=none; d=zoho.com; s=zohoarc; b=nI5+6gtAVUzywMpe6LpFj6N7/3eUxJBT5GsYXyNw0+8swYIJ7ik6j+lNLyP3hfsOKZa7Ggc/6ZWBPy5ZH/ZiAwyUx6xwiXMCS8manH56F24wJRcvFnATcc7y0UclrUsf3OIZiEDHT1gZ9qy3C7PVBPYvXtOBFibXvGY6FwMQZgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555962794; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wq7Dk0Wer+T9hG6KoEeeg7Vil+6xL3McoCR+T3FXHwQ=; b=hVh9/0uUMRfnsicuCZDQlu6C8L9uZgJgmgyrU+jBZA0A9H80KiUYfIQFd/4y8sP9R+ckxRqkYaHzl8M64ZI+upNf8bN7vFQTm/NTBvrjUiG+3ABuTlP34yl62jtFpPpjRkUQ6sw/DLLfzE4+motRTp8iNAAgLCA/VoHIy0nSVjs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555962794405162.58961867795733; Mon, 22 Apr 2019 12:53:14 -0700 (PDT) Received: from localhost ([127.0.0.1]:43494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIezz-0005qN-7i for importer@patchew.org; Mon, 22 Apr 2019 15:53:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIexk-0004Kl-IS for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:50:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIexi-000856-C4 for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:50:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIexe-000825-T9; Mon, 22 Apr 2019 15:50:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 847DF4628A; Mon, 22 Apr 2019 19:50:41 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 787535D71E; Mon, 22 Apr 2019 19:50:36 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2019 21:50:14 +0200 Message-Id: <20190422195020.1494-2-philmd@redhat.com> In-Reply-To: <20190422195020.1494-1-philmd@redhat.com> References: <20190422195020.1494-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 22 Apr 2019 19:50:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 1/7] 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: Eduardo Habkost , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Laszlo Ersek , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add trace events to dump the key content. Reviewed-by: Michael S. Tsirkin Reviewed-by: Laszlo Ersek Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v1 -> v3: - moved static fw_cfg_wellknown_keys[] in key_name() - split trace_key_name() (can return "unknown") from key_name() (can return NULL) Since changes from v1 are trivial, keep S-o-b tags. --- hw/nvram/fw_cfg.c | 63 ++++++++++++++++++++++++++++++++++++++++++- hw/nvram/trace-events | 7 ++++- 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 5c3a46ce6f2..d374a970fea 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -60,6 +60,62 @@ struct FWCfgEntry { FWCfgWriteCallback write_cb; }; =20 +/** + * key_name: + * + * @key: The uint16 selector key. + * + * Returns: The stringified name if the selector refers to a well-known + * numerically defined item, or NULL on key lookup failure. + */ +static const char *key_name(uint16_t key) +{ + static const char *fw_cfg_wellknown_keys[FW_CFG_FILE_FIRST] =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", + }; + + if (key & FW_CFG_ARCH_LOCAL) { + return NULL; + } + if (key < FW_CFG_FILE_FIRST) { + return fw_cfg_wellknown_keys[key]; + } + + return NULL; +} + +static inline const char *trace_key_name(uint16_t key) +{ + const char *name =3D key_name(key); + + return name ? name : "unknown"; +} + #define JPG_FILE 0 #define BMP_FILE 1 =20 @@ -233,7 +289,7 @@ static int fw_cfg_select(FWCfgState *s, uint16_t key) } } =20 - trace_fw_cfg_select(s, key, ret); + trace_fw_cfg_select(s, key, trace_key_name(key), ret); return ret; } =20 @@ -616,6 +672,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, trace_key_name(key), len); fw_cfg_add_bytes_callback(s, key, NULL, NULL, NULL, data, len, true); } =20 @@ -623,6 +680,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, trace_key_name(key), value); fw_cfg_add_bytes(s, key, g_memdup(value, sz), sz); } =20 @@ -632,6 +690,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, trace_key_name(key), value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } =20 @@ -651,6 +710,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, trace_key_name(key), value); fw_cfg_add_bytes(s, key, copy, sizeof(value)); } =20 @@ -660,6 +720,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, trace_key_name(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 e191991e2a8..0dea9260ce1 100644 --- a/hw/nvram/trace-events +++ b/hw/nvram/trace-events @@ -5,6 +5,11 @@ nvram_read(uint32_t addr, uint32_t ret) "read addr %d: 0x%= 02x" nvram_write(uint32_t addr, uint32_t old, uint32_t val) "write addr %d: 0x%= 02x -> 0x%02x" =20 # fw_cfg.c -fw_cfg_select(void *s, uint16_t key, int ret) "%p key %d =3D %d" +fw_cfg_select(void *s, uint16_t key_value, const char *key_name, int ret) = "%p key 0x%04" PRIx16 " '%s', ret: %d" fw_cfg_read(void *s, uint64_t ret) "%p =3D 0x%"PRIx64 +fw_cfg_add_bytes(uint16_t key_value, const char *key_name, size_t len) "ke= y 0x%04" PRIx16 " '%s', %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_value, const char *key_name, const char *va= lue) "key 0x%04" PRIx16 " '%s', value '%s'" +fw_cfg_add_i16(uint16_t key_value, const char *key_name, uint16_t value) "= key 0x%04" PRIx16 " '%s', value 0x%" PRIx16 +fw_cfg_add_i32(uint16_t key_value, const char *key_name, uint32_t value) "= key 0x%04" PRIx16 " '%s', value 0x%" PRIx32 +fw_cfg_add_i64(uint16_t key_value, const char *key_name, uint64_t value) "= key 0x%04" PRIx16 " '%s', value 0x%" PRIx64 --=20 2.20.1 From nobody Wed May 1 02:49:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555962941; cv=none; d=zoho.com; s=zohoarc; b=evDF0HrcR+9JWu+fz1Zn+HSkUjLd3DV6XD/wfSwnGOh1AsB/MbGTDLiMMiiXwRd/FfLheG17Bw2ZROdJoUGDjEL1MHeelJ0k2V6lcz6R0Fm7YseklmUXjKGzLzI6GjpnYJI7/fMvNq4Ecfd0PJvMPs3QrpHzeB5sQLwDq6LZiYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555962941; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hn0SgBo1b2qgaYkX30I/2GtaHWjVcNvYPplxzHwWIeU=; b=CogY+pzRK4eJ93s7ocjiOw2BcPpF1aF5gwXwXMKHh4rEVwjtIs4+ai1oUzj9p7gsNTZCPFK0brbchB3RBkVheYrV1ZurR46fr9ea9VZL0zSHPurADh9H/HsSymQYdt7e9jsbb4oimlRPerZF7U6biy9x07gjXVPq/6RkAcdfhNA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555962941152606.2824734395523; Mon, 22 Apr 2019 12:55:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:43547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIf2S-0007ma-7v for importer@patchew.org; Mon, 22 Apr 2019 15:55:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIexu-0004b9-6E for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:50:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIexq-00089K-7X for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:50:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34310) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIexo-00087B-AF; Mon, 22 Apr 2019 15:50:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 40153C034DC4; Mon, 22 Apr 2019 19:50:51 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18F795D71E; Mon, 22 Apr 2019 19:50:41 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2019 21:50:15 +0200 Message-Id: <20190422195020.1494-3-philmd@redhat.com> In-Reply-To: <20190422195020.1494-1-philmd@redhat.com> References: <20190422195020.1494-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 22 Apr 2019 19:50:51 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 2/7] hw/nvram/fw_cfg: Add fw_cfg_arch_key_name() 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 , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Laszlo Ersek , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add fw_cfg_arch_key_name() which returns the name of an architecture-specific key. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- MAINTAINERS | 1 + hw/nvram/fw_cfg.c | 2 +- include/hw/nvram/fw_cfg.h | 11 +++++++++++ stubs/Makefile.objs | 1 + stubs/fw_cfg.c | 21 +++++++++++++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 stubs/fw_cfg.c diff --git a/MAINTAINERS b/MAINTAINERS index 56139ac8ab0..444783bb652 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1675,6 +1675,7 @@ R: Gerd Hoffmann S: Supported F: docs/specs/fw_cfg.txt F: hw/nvram/fw_cfg.c +F: stubs/fw_cfg.c F: include/hw/nvram/fw_cfg.h F: include/standard-headers/linux/qemu_fw_cfg.h F: tests/libqos/fw_cfg.c diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index d374a970fea..b2dc0a80cbc 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -100,7 +100,7 @@ static const char *key_name(uint16_t key) }; =20 if (key & FW_CFG_ARCH_LOCAL) { - return NULL; + return fw_cfg_arch_key_name(key); } if (key < FW_CFG_FILE_FIRST) { return fw_cfg_wellknown_keys[key]; diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index f5a6895a740..828ad9dedc6 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -226,4 +226,15 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, FWCfgState *fw_cfg_find(void); bool fw_cfg_dma_enabled(void *opaque); =20 +/** + * fw_cfg_arch_key_name: + * + * @key: The uint16 selector key. + * + * Returns: The stringified architecture-specific name if the selector + * refers to a well-known numerically defined item, or NULL on + * key lookup failure. + */ +const char *fw_cfg_arch_key_name(uint16_t key); + #endif diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 269dfa58326..73452ad2657 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -39,3 +39,4 @@ stub-obj-y +=3D xen-hvm.o stub-obj-y +=3D pci-host-piix.o stub-obj-y +=3D ram-block.o stub-obj-y +=3D ramfb.o +stub-obj-y +=3D fw_cfg.o diff --git a/stubs/fw_cfg.c b/stubs/fw_cfg.c new file mode 100644 index 00000000000..bb1e3c8aa95 --- /dev/null +++ b/stubs/fw_cfg.c @@ -0,0 +1,21 @@ +/* + * fw_cfg stubs + * + * Copyright (c) 2019 Red Hat, Inc. + * + * Author: + * Philippe Mathieu-Daud=C3=A9 + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/nvram/fw_cfg.h" + +const char *fw_cfg_arch_key_name(uint16_t key) +{ + return NULL; +} --=20 2.20.1 From nobody Wed May 1 02:49:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555962934; cv=none; d=zoho.com; s=zohoarc; b=iPp1Ppg5cxQu8oYWkQKr3SfMNI8wX9s0XmmshxMsK1beJ5ElVQXcZvkZgP5E4L0IEloAIL9qfCWiPzaO/CYx3yqSN6InYg3rXmYbiMk6TM+Gz7Tc8TevpskF29M7k3SPRAFoiFx/EAzU3021nrLHDdvHQSEvvB750GFRTop/oSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555962934; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=rhozfzxeAx85HqcydEzGUU6/WOmkA76mOJkxpnCNLbY=; b=Q9sqOzGlVG3yYqt8OrrUfhCNNqscMNdwVy5/VGEIvE19rp/rIhBh8gg8uD20SwpwJTwtokuE76GunQuNHSoFcf/gF3hBlmki0Kel3I7fbDy5mgjuw/dzO1hpszU5XKNZfcQR13PyL3G/Lq9+oBSOxJ16/8E2Hvks90422IvwWxI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555962934948881.2851155096553; Mon, 22 Apr 2019 12:55:34 -0700 (PDT) Received: from localhost ([127.0.0.1]:43517 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIf2K-0007g6-09 for importer@patchew.org; Mon, 22 Apr 2019 15:55:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIexw-0004eI-N2 for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIexv-0008CC-Jt for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34394) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIexv-0008Bg-Ds; Mon, 22 Apr 2019 15:50:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0396C034DC4; Mon, 22 Apr 2019 19:50:58 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3A855D71E; Mon, 22 Apr 2019 19:50:51 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2019 21:50:16 +0200 Message-Id: <20190422195020.1494-4-philmd@redhat.com> In-Reply-To: <20190422195020.1494-1-philmd@redhat.com> References: <20190422195020.1494-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 22 Apr 2019 19:50:58 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 3/7] hw/i386: Extract fw_cfg definitions to local "fw_cfg.h" 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 , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Laszlo Ersek , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Extract the architecture-specific fw_cfg definitions to "fw_cfg.h". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/i386/fw_cfg.h | 20 ++++++++++++++++++++ hw/i386/pc.c | 7 +------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 hw/i386/fw_cfg.h diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h new file mode 100644 index 00000000000..17a4bc32f22 --- /dev/null +++ b/hw/i386/fw_cfg.h @@ -0,0 +1,20 @@ +/* + * QEMU fw_cfg helpers (X86 specific) + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ + +#ifndef HW_I386_FW_CFG_H +#define HW_I386_FW_CFG_H + +#include "hw/nvram/fw_cfg.h" + +#define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) +#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) +#define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) +#define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3) +#define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4) + +#endif diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f2c15bf1f2c..acb8fd9667d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -30,6 +30,7 @@ #include "hw/char/parallel.h" #include "hw/i386/apic.h" #include "hw/i386/topology.h" +#include "hw/i386/fw_cfg.h" #include "sysemu/cpus.h" #include "hw/block/fdc.h" #include "hw/ide.h" @@ -88,12 +89,6 @@ #define DPRINTF(fmt, ...) #endif =20 -#define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) -#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) -#define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) -#define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3) -#define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4) - #define E820_NR_ENTRIES 16 =20 struct e820_entry { --=20 2.20.1 From nobody Wed May 1 02:49:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555962794; cv=none; d=zoho.com; s=zohoarc; b=b76swyHji5u81aor2s7Y/G8bHIHMeLiUFv0p0kwUgwrsPXim4kmzUo0Jx6GQPVMLFQMGwAqUJ3bZRBejyZZeGsBYdHpKLlfWva3H105FOUHvprv26u1EIhOUfcl2SenjWmhX598zA+0dWdmbbntudiYZh6Yj0rZsMDspaNBydy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555962794; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VVfJ1JQ4+uusAy+0RmNhI6FZjWPHM7/8N8gX62dwN7A=; b=oK0UmLOTiapOftAN7z9NS7RceQDJ6Pw4Am0IyUIaIOY/mLDTNGq+Zb5aud/7ozEBSXygu8BPFcJvx6vy1GnaXtOdQyFiQE3bsW4yHm5eltfE8xrAOxQNP/IyZxo0z+VlrCS/B2ye/QqK9OBFv0/OV/5oYEi/w+8HQbn+6zYzE5M= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555962794285514.2346595329748; Mon, 22 Apr 2019 12:53:14 -0700 (PDT) Received: from localhost ([127.0.0.1]:43496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIf00-0005sJ-1Y for importer@patchew.org; Mon, 22 Apr 2019 15:53:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIey2-0004j2-Qb for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIey1-0008Fc-PL for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40368) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIey1-0008FF-JB; Mon, 22 Apr 2019 15:51:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6EC53082B6A; Mon, 22 Apr 2019 19:51:04 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A62C5D71E; Mon, 22 Apr 2019 19:50:58 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2019 21:50:17 +0200 Message-Id: <20190422195020.1494-5-philmd@redhat.com> In-Reply-To: <20190422195020.1494-1-philmd@redhat.com> References: <20190422195020.1494-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 22 Apr 2019 19:51:04 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 4/7] hw/i386: Implement fw_cfg_arch_key_name() 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 , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Laszlo Ersek , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Implement fw_cfg_arch_key_name(), which returns the name of a i386-specific key. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/i386/Makefile.objs | 2 +- hw/i386/fw_cfg.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 hw/i386/fw_cfg.c diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 27248a0777c..5d9c9efd5fa 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -3,7 +3,7 @@ obj-y +=3D multiboot.o obj-y +=3D pc.o obj-$(CONFIG_I440FX) +=3D pc_piix.o obj-$(CONFIG_Q35) +=3D pc_q35.o -obj-y +=3D pc_sysfw.o +obj-y +=3D fw_cfg.o pc_sysfw.o obj-y +=3D x86-iommu.o obj-$(CONFIG_VTD) +=3D intel_iommu.o obj-$(CONFIG_AMD_IOMMU) +=3D amd_iommu.o diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c new file mode 100644 index 00000000000..c5e8b4ead0b --- /dev/null +++ b/hw/i386/fw_cfg.c @@ -0,0 +1,38 @@ +/* + * QEMU fw_cfg helpers (X86 specific) + * + * Copyright (c) 2019 Red Hat, Inc. + * + * Author: + * Philippe Mathieu-Daud=C3=A9 + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/i386/fw_cfg.h" +#include "hw/nvram/fw_cfg.h" + +const char *fw_cfg_arch_key_name(uint16_t key) +{ + static const struct { + uint16_t key; + const char *name; + } fw_cfg_arch_wellknown_keys[] =3D { + {FW_CFG_ACPI_TABLES, "acpi_tables"}, + {FW_CFG_SMBIOS_ENTRIES, "smbios_entries"}, + {FW_CFG_IRQ0_OVERRIDE, "irq0_override"}, + {FW_CFG_E820_TABLE, "e820_tables"}, + {FW_CFG_HPET, "hpet"}, + }; + + for (size_t i =3D 0; i < ARRAY_SIZE(fw_cfg_arch_wellknown_keys); i++) { + if (fw_cfg_arch_wellknown_keys[i].key =3D=3D key) { + return fw_cfg_arch_wellknown_keys[i].name; + } + } + return NULL; +} --=20 2.20.1 From nobody Wed May 1 02:49:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555962959; cv=none; d=zoho.com; s=zohoarc; b=QBbCdUbwa1iWnB+YFks7zeAOOsnmLbxl9au0pic9t9UIGSpDvMcZwmHUTUjsdXWpyimgZwgvXZpNupdQv9F1uY7jUpw2AOaM8WXUdLa9aA7F2gD8Eta1g2lW0aXd/VgRK8jLGB4eCd1vqOujGlEfGvcXum6ST9mTQGd+1BsDZps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555962959; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=bQmXlLrsOlSJDGSXBWo35cG11gH79J+1HgrEEKV6Ofo=; b=KTHNoXN2eqWZSolU3oSSxlwTTfHM+CtlyB1lleAstjvNRF8kC7QkYinkh3d+0DX5I08WbAEOVQ6UJw5yvgtA4XO+IplGikm9lOBgeBeh0D2z6DiDyZ26c5BjYrF7p/rAC+KmyMmN1rxXTKvPcBkK5dClQFyS5CKsiXlwlPoHGM8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555962959685698.2070772910181; Mon, 22 Apr 2019 12:55:59 -0700 (PDT) Received: from localhost ([127.0.0.1]:43550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIf2h-0007y3-TD for importer@patchew.org; Mon, 22 Apr 2019 15:55:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIeyG-0004sJ-Ij for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIeyF-0008MX-FF for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53188) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIeyF-0008M8-9n; Mon, 22 Apr 2019 15:51:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E91D882EA; Mon, 22 Apr 2019 19:51:18 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DDFA5D71E; Mon, 22 Apr 2019 19:51:05 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2019 21:50:18 +0200 Message-Id: <20190422195020.1494-6-philmd@redhat.com> In-Reply-To: <20190422195020.1494-1-philmd@redhat.com> References: <20190422195020.1494-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 22 Apr 2019 19:51:18 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 5/7] hw/ppc: Implement fw_cfg_arch_key_name() 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 , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Laszlo Ersek , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Implement fw_cfg_arch_key_name(), which returns the name of a ppc-specific key. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/ppc/Makefile.objs | 2 +- hw/ppc/fw_cfg.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 hw/ppc/fw_cfg.c diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index 1111b218a04..ae940981553 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -1,5 +1,5 @@ # shared objects -obj-y +=3D ppc.o ppc_booke.o fdt.o +obj-y +=3D ppc.o ppc_booke.o fdt.o fw_cfg.o # IBM pSeries (sPAPR) obj-$(CONFIG_PSERIES) +=3D spapr.o spapr_caps.o spapr_vio.o spapr_events.o obj-$(CONFIG_PSERIES) +=3D spapr_hcall.o spapr_iommu.o spapr_rtas.o diff --git a/hw/ppc/fw_cfg.c b/hw/ppc/fw_cfg.c new file mode 100644 index 00000000000..a88b5c4bde2 --- /dev/null +++ b/hw/ppc/fw_cfg.c @@ -0,0 +1,45 @@ +/* + * fw_cfg helpers (PPC specific) + * + * Copyright (c) 2019 Red Hat, Inc. + * + * Author: + * Philippe Mathieu-Daud=C3=A9 + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/ppc/ppc.h" +#include "hw/nvram/fw_cfg.h" + +const char *fw_cfg_arch_key_name(uint16_t key) +{ + static const struct { + uint16_t key; + const char *name; + } fw_cfg_arch_wellknown_keys[] =3D { + {FW_CFG_PPC_WIDTH, "width"}, + {FW_CFG_PPC_HEIGHT, "height"}, + {FW_CFG_PPC_DEPTH, "depth"}, + {FW_CFG_PPC_TBFREQ, "tbfreq"}, + {FW_CFG_PPC_CLOCKFREQ, "clockfreq"}, + {FW_CFG_PPC_IS_KVM, "is_kvm"}, + {FW_CFG_PPC_KVM_HC, "kvm_hc"}, + {FW_CFG_PPC_KVM_PID, "pid"}, + {FW_CFG_PPC_NVRAM_ADDR, "nvram_addr"}, + {FW_CFG_PPC_BUSFREQ, "busfreq"}, + {FW_CFG_PPC_NVRAM_FLAT, "nvram_flat"}, + {FW_CFG_PPC_VIACONFIG, "viaconfig"}, + }; + + for (size_t i =3D 0; i < ARRAY_SIZE(fw_cfg_arch_wellknown_keys); i++) { + if (fw_cfg_arch_wellknown_keys[i].key =3D=3D key) { + return fw_cfg_arch_wellknown_keys[i].name; + } + } + return NULL; +} --=20 2.20.1 From nobody Wed May 1 02:49:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555963091; cv=none; d=zoho.com; s=zohoarc; b=AGX78F5NBkntyYv3TjDTJoWKT4jbGG3W5HvsAlGhBEbwwImaJJlonMyCLEN5RxDjCBcuFubXQvcEC2mKF1SwHI8MzdzxgqSjnkIkox8IZNRZry9IDBIB6flLpmwtIWpuxJI+FCWwZ82Ak8Iu6qpZoQ64xwq3RDND4atjEibUd24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555963091; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=X3/CxZnyT6jF6nzF/W2qHo9sF0zhN/NaCdTyYlsepwg=; b=U5pKqetazwOMEWsWUn9e0avI9NfovIs/ASCCaX4vF5LUIz5GlqljtCH615pg5NhkRGuHuR61IqsoFSxCGXp+NuaZHJPm7PEK0Ypvs9wQt3wETUpeoKCv73BzfqS6g8BvubburZbUFdNe6dD2kcsqHiMalR0uZYIIaWS9zPzd+tw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555963091542688.2683662936823; Mon, 22 Apr 2019 12:58:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:43577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIf4m-0001R2-JA for importer@patchew.org; Mon, 22 Apr 2019 15:58:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIeyL-0004wm-BJ for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIeyK-0008PH-GA for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54808) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIeyK-0008On-9o; Mon, 22 Apr 2019 15:51:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83B82307D859; Mon, 22 Apr 2019 19:51:23 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 244A15D71E; Mon, 22 Apr 2019 19:51:18 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2019 21:50:19 +0200 Message-Id: <20190422195020.1494-7-philmd@redhat.com> In-Reply-To: <20190422195020.1494-1-philmd@redhat.com> References: <20190422195020.1494-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 22 Apr 2019 19:51:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 6/7] hw/sparc: Implement fw_cfg_arch_key_name() 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 , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Laszlo Ersek , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Implement fw_cfg_arch_key_name(), which returns the name of a sparc32-specific key. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/sparc/sun4m.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index ca1e3825d58..49251d62b35 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -97,6 +97,25 @@ struct sun4m_hwdef { uint8_t nvram_machine_id; }; =20 +const char *fw_cfg_arch_key_name(uint16_t key) +{ + static const struct { + uint16_t key; + const char *name; + } fw_cfg_arch_wellknown_keys[] =3D { + {FW_CFG_SUN4M_DEPTH, "depth"}, + {FW_CFG_SUN4M_WIDTH, "width"}, + {FW_CFG_SUN4M_HEIGHT, "height"}, + }; + + for (size_t i =3D 0; i < ARRAY_SIZE(fw_cfg_arch_wellknown_keys); i++) { + if (fw_cfg_arch_wellknown_keys[i].key =3D=3D key) { + return fw_cfg_arch_wellknown_keys[i].name; + } + } + return NULL; +} + static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { --=20 2.20.1 From nobody Wed May 1 02:49:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555963102; cv=none; d=zoho.com; s=zohoarc; b=QVSpULLRIa22fc1AnL5M+6vb3rV/zb3vV+ZRU29EA3lwVMozzaF4xv6PXkt24BSlNcgiJYcqM2gufODGuxBnMcwVsIai7YWIiye8H/UzfFDmgRkxtP7/fS7wvd06tx0Wiijbha8Pr90x4GP9vx3SjsYupcS2CYD/4FMeLKSJ5xU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555963102; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2cMuemkR4FuJslLyovxjk5qlz179Y+lieoobKIpMEYU=; b=XuVx+Ia0RschPlLQNlnzPiy10hStF7E7PzwKwUj8WbMLaGn5y9+kUpl2e53vZEbarJCrW1EbQmlG/yIZqrLdx4e6hs768o2viprYiR7p5/rYwOjYyXx1FGNdYwhF0d2+hRlZ8syVHaWvr/vA42PdMVOqN8kd/9at9/eBYmD5eZk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555963102965466.10829052871463; Mon, 22 Apr 2019 12:58:22 -0700 (PDT) Received: from localhost ([127.0.0.1]:43579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIf4w-0001Xz-0r for importer@patchew.org; Mon, 22 Apr 2019 15:58:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIeyQ-00051m-BU for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIeyP-0008Rz-F2 for qemu-devel@nongnu.org; Mon, 22 Apr 2019 15:51:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48642) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIeyP-0008Rd-9Y; Mon, 22 Apr 2019 15:51:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83EE1308339B; Mon, 22 Apr 2019 19:51:28 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E3C35D71E; Mon, 22 Apr 2019 19:51:23 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2019 21:50:20 +0200 Message-Id: <20190422195020.1494-8-philmd@redhat.com> In-Reply-To: <20190422195020.1494-1-philmd@redhat.com> References: <20190422195020.1494-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 22 Apr 2019 19:51:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 7/7] hw/sparc64: Implement fw_cfg_arch_key_name() 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 , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Laszlo Ersek , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Implement fw_cfg_arch_key_name(), which returns the name of a sparc64-specific key. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/sparc64/sun4u.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 399f2d73c81..4230b17b873 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -91,6 +91,25 @@ typedef struct EbusState { #define TYPE_EBUS "ebus" #define EBUS(obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) =20 +const char *fw_cfg_arch_key_name(uint16_t key) +{ + static const struct { + uint16_t key; + const char *name; + } fw_cfg_arch_wellknown_keys[] =3D { + {FW_CFG_SPARC64_WIDTH, "width"}, + {FW_CFG_SPARC64_HEIGHT, "height"}, + {FW_CFG_SPARC64_DEPTH, "depth"}, + }; + + for (size_t i =3D 0; i < ARRAY_SIZE(fw_cfg_arch_wellknown_keys); i++) { + if (fw_cfg_arch_wellknown_keys[i].key =3D=3D key) { + return fw_cfg_arch_wellknown_keys[i].name; + } + } + return NULL; +} + static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { --=20 2.20.1