From nobody Mon Sep 16 19:18:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1707429982; cv=none; d=zohomail.com; s=zohoarc; b=aOzyQUZq3yxbyi2yGaV/zk060WBK/cnYdM8XRWltQHGiw44vUjZgf4wphAEILzMsh/NboXF0RhXV7kPKlQ539eopa5gEttCFJvGAFeAS8imAsXkhFxKR66I5Wg6RyZaBTps6HPeOADDJl2qDoj2GdHz4PejMwbCLBzAH76BICk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707429982; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uLRRI7JaWxueGy30xNOeOTuX8cbsB2oZVyCqXBekoKA=; b=TdbZ/VbRsdvMmC8HUzcYUb7ewSG9IYOuYzw5ylRd4jfrcq75vd/j4ocGvGxVWmTup6ai3SXmzZZW9LpRQazZzf1UbCjrYAjonoNF7F5kJBNy6tHI0vHpoLVAgNbH9lEMpVBeLibA8+oraDODIXjfH4z6rt4HJOoGjv24FELX/xA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707429982164724.9218696329474; Thu, 8 Feb 2024 14:06:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYCV7-0007Gx-1G; Thu, 08 Feb 2024 17:04:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYCV5-0007GU-GL for qemu-devel@nongnu.org; Thu, 08 Feb 2024 17:04:07 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYCV3-0005EM-Rx for qemu-devel@nongnu.org; Thu, 08 Feb 2024 17:04:07 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a3850ce741bso29487566b.3 for ; Thu, 08 Feb 2024 14:04:05 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id ti9-20020a170907c20900b00a3109a492d4sm109753ejc.20.2024.02.08.14.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707429843; x=1708034643; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uLRRI7JaWxueGy30xNOeOTuX8cbsB2oZVyCqXBekoKA=; b=Xuc+RoXJK+A8dKrWK8eZsAQKLc6NhpcAuKl90efpSuN5+B0aP28ARi3oBxHtAODJyQ /kptiWMoOIGvRsYYFF41dDaaS+P8qKRqZTJWgx1YX3xDsLGO+OrXasb15m7QvTh4pbcQ K8tL08YMgajbhMrw+O+NTM6moQHW0B26H2+Wvm01ABkpza+AGyumMT5jFqYwyCGAHsIS 8xmt1y4pjsms5+ncQVLfNpV1BDMjQoVVG/drhCsup/syaP2/+Y9ojDbanNM3Rh6kBon1 xd8IgXSYor4P4N3h01WAJZxJQakBJp4kpSE2DtoJNohnDzeDrk9S+m+cXrWb2qabM41q 2lSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707429843; x=1708034643; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uLRRI7JaWxueGy30xNOeOTuX8cbsB2oZVyCqXBekoKA=; b=cNC4u5+z275BY0Qn6JfEAUeCFion6wSIs30pzHKHbxU6AhOGjAMWGIO1IZWeOy3Fmi Yo+eSObuQxFf5mAk5RuzFVliiJ9a0ca2P+sbKbinVb81udLp+RYumSqT0Grguzfm4hOw 9wX1Et73NGXqUNzzap0d1Lbm7lsxufDiI9+7uYq+sewwCPVFrUZ4wkYLNxBxhHogGO5s ncD41gnhKT1XMWVJ88eLWHpPcDl9ey0dCLNBE3mb6aV7pP+8NVulDIhileVJ+2WikeW4 cO8xvk7eBpWFTiOSbqdFzeAj7X7VlpuTM7+h6Q4O3JMZ4Q2EKJvUZhVl7MjnTq3BzElL HNKg== X-Gm-Message-State: AOJu0YwMqC8UpRP8TaXkeFzPrs3eNXyS+b8gN5cs/df8b34I2cMW/f9b qM7fvYrzT3ZaN9DYzl76g82ja2RbWJwq7JUWIejtLoaa2719ICnzf2LZxOwm X-Google-Smtp-Source: AGHT+IHM7+bDwhtPN8JRaFblhESriQEG63pRAgEs3bcOLucy4h6vswm/KolMmVtpw9eFYkEeX89cHg== X-Received: by 2002:a17:906:240b:b0:a38:174c:c985 with SMTP id z11-20020a170906240b00b00a38174cc985mr393327eja.63.1707429843306; Thu, 08 Feb 2024 14:04:03 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVpl7cnf1xCI3cTOlfIoD2TzMKJGzsvRabKLL8tBxJD2akCLPyjkk05lDjhMGbdkxLop0Ba4BihCP25/3h5JWb0JxKl26R+gyVb6L4vzBEQ43L7VWkHf26E+Pc4ED+KKD65wiOWJSVOJ3BhRRNjCqPlyt9jL43u0v9K4SGCYEshiVFmiJ+8L8YFBn9UboBJpZ2JgISbe1514AdKTee7UD8vE7w1HSw/D+daZTeSVQaVlDfql5F+ From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Eduardo Habkost , Paolo Bonzini , Sergio Lopez , Richard Henderson , Marcel Apfelbaum , Bernhard Beschow Subject: [PATCH 6/9] hw/i386/pc: Confine system flash handling to pc_sysfw Date: Thu, 8 Feb 2024 23:03:46 +0100 Message-ID: <20240208220349.4948-7-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240208220349.4948-1-shentey@gmail.com> References: <20240208220349.4948-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=shentey@gmail.com; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1707429982988100003 Content-Type: text/plain; charset="utf-8" Rather than distributing PC system flash handling across three files, let's confine it to one. Now, pc_system_firmware_init() creates, configures and c= leans up the system flash which makes the code easier to understand. It also avoi= ds the extra call to pc_system_flash_cleanup_unused() in the Xen case. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/i386/pc.h | 2 -- hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - hw/i386/pc_sysfw.c | 6 ++++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 0e6c41e908..77228822f5 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -191,8 +191,6 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_i= rqs); #define TYPE_PORT92 "port92" =20 /* pc_sysfw.c */ -void pc_system_flash_create(PCMachineState *pcms); -void pc_system_flash_cleanup_unused(PCMachineState *pcms); void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memor= y); bool pc_system_ovmf_table_find(const char *entry, uint8_t **data, int *data_len); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 369c21fb99..4e73cd8a3b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1740,7 +1740,6 @@ static void pc_machine_initfn(Object *obj) #endif pcms->default_bus_bypass_iommu =3D false; =20 - pc_system_flash_create(pcms); pcms->pcspk =3D isa_new(TYPE_PC_SPEAKER); object_property_add_alias(OBJECT(pcms), "pcspk-audiodev", OBJECT(pcms->pcspk), "audiodev"); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 5addaae978..5c928ac71b 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -232,7 +232,6 @@ static void pc_init1(MachineState *machine, assert(machine->ram_size =3D=3D x86ms->below_4g_mem_size + x86ms->above_4g_mem_size); =20 - pc_system_flash_cleanup_unused(pcms); if (machine->kernel_filename !=3D NULL) { /* For xen HVM direct kernel boot, load linux here */ xen_load_linux(pcms); diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index c8d9e71b88..b4c3833352 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -91,7 +91,7 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, return PFLASH_CFI01(dev); } =20 -void pc_system_flash_create(PCMachineState *pcms) +static void pc_system_flash_create(PCMachineState *pcms) { PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); =20 @@ -103,7 +103,7 @@ void pc_system_flash_create(PCMachineState *pcms) } } =20 -void pc_system_flash_cleanup_unused(PCMachineState *pcms) +static void pc_system_flash_cleanup_unused(PCMachineState *pcms) { char *prop_name; int i; @@ -212,6 +212,8 @@ void pc_system_firmware_init(PCMachineState *pcms, return; } =20 + pc_system_flash_create(pcms); + /* Map legacy -drive if=3Dpflash to machine properties */ for (i =3D 0; i < ARRAY_SIZE(pcms->flash); i++) { pflash_cfi01_legacy_drive(pcms->flash[i], --=20 2.43.0