From patchwork Mon Feb 13 16:19:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1741743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=nKV+BRiP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PFqND4M15z23h0 for ; Tue, 14 Feb 2023 03:21:32 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRbZL-0004Zs-Bo; Mon, 13 Feb 2023 11:20:43 -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 1pRbZI-0004YF-Q0; Mon, 13 Feb 2023 11:20:40 -0500 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRbZG-0007vD-RT; Mon, 13 Feb 2023 11:20:40 -0500 Received: by mail-ej1-x631.google.com with SMTP id sb24so9244869ejb.8; Mon, 13 Feb 2023 08:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CWeQEhkJ06ecAyh8L7LOO2aEbqr7bNhwpy+DgMqY1Vo=; b=nKV+BRiPyBDuKBpBkqn9HNgy41DijQu6VM/A+nU6M3AXCpLwZMx/q+YmlCe7dp8kBY 5pDCtzOx2Z1O/vNSDumF1IJcwNuEF7f8A/hA4ZZC0lzblSqqxGyikPFqtM7NBYKaze4p 2ApvoRKuyBv92hpvGChinzrSIFWIp1emMGMKStR3B9Aorqeic2dzFp7zMBzZb/BVOVcq Wwx2WjPwrrjKMonhNJ8wAXKn80VFId583SciwzILLm+ooOpL3+9cOy4v5koeiiOxiKeC /MvT3e4NCBYSzjXOSkSjwXrD61efmRxGqbXBDO9R3uwwU032InLfGJtx5+9N6uC+16gO b8/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CWeQEhkJ06ecAyh8L7LOO2aEbqr7bNhwpy+DgMqY1Vo=; b=ttpY/2L/lNqNH6Ix7q5JVczlQCu7j0OBJrqZI6vVGgjkS3eHDk8UCfiu6D5bsjYQr4 6KcXC1h/3so76NqNWjh45fDE9MR2rp037LhsfdUjHPyrcTUEFrR0KmgtvToQrhvKky3H MJeOu1XtE7zV9a2aMCfO4knnZzBgXyztUXxJTHFcd+Jz+OLIeMCLyzGDuxLd3hI1Aq/Q xOSuZQspqtvi40Y+dB5JmH/p5DtKLA/QxR/cbJJP4DhRyUxiLUo4hfskodzn5eyO/Prq /5SuyeQyAyIvxIlZLeUOumoOdyZrSYxjlzj9QiOHok8g1dSJ9CbveGuTtEs5F6aDsF51 PPVg== X-Gm-Message-State: AO0yUKWB5bVaOzEwu/HGkHNG81rBEE6eOoijtKfzEOqQWBmkCy4dWjlv qXqWWugob2EOfiHbUxdzmqfVOBBrbGI= X-Google-Smtp-Source: AK7set8aYYsDPd/KMfDz0y0+kDDszQX7lhOPzyw8fZI+ej451czJ9tiUtvmeIypTjC7DPl4Qe9BnXQ== X-Received: by 2002:a17:906:fe49:b0:8aa:c0d6:2dc6 with SMTP id wz9-20020a170906fe4900b008aac0d62dc6mr27539000ejb.29.1676305236320; Mon, 13 Feb 2023 08:20:36 -0800 (PST) Received: from localhost.localdomain (dynamic-078-055-133-198.78.55.pool.telefonica.de. [78.55.133.198]) by smtp.gmail.com with ESMTPSA id 20-20020a170906025400b008841aa86484sm6979952ejl.211.2023.02.13.08.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 08:20:35 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Sunil Muthuswamy , "Michael S. Tsirkin" , Marcel Apfelbaum , "Dr . David Alan Gilbert" , qemu-trivial@nongnu.org, Richard Henderson , Juan Quintela , Eduardo Habkost , Thomas Huth , Igor Mammedov , BALATON Zoltan , Ani Sinha , Laurent Vivier , Bernhard Beschow Subject: [PATCH v4 0/9] PC cleanups Date: Mon, 13 Feb 2023 17:19:55 +0100 Message-Id: <20230213162004.2797-1-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=shentey@gmail.com; helo=mail-ej1-x631.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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This series contains some cleanups I came across when working on the PC machines. It consists of reducing the usage of global variables and eliminating some redundancies. One notable change is that the SMRAM memory region gets moved from the i440fx and q35 host bridges into the x86 machine. This will simplify cleaning up these host bridges which will be done in a separate series. Note that the movement of the SMRAM memory region apparently doesn't change migration ABI for the pc and q35 machines (see below). Testing done: * `make check` ' `make check-avocado` * `qemu-system-x86_64 -M q35 -m 2G -cdrom \ manjaro-kde-21.3.2-220704-linux515.iso` * `qemu-system-x86_64 -M pc -m 2G -cdrom manjaro-kde-21.3.2-220704-linux515.iso` * Confirm that JSON representation of migration files (pc & q35) are empty: 1. Create four migration files {pc,q35}-{before,after}.mig by running `qemu-system-x86_64 -M {pc,q35} -S` with QEMU built from master and from this series. 2. Run `./scripts/analyze-migration.py -d desc -f *.mig > *.json` on the four files 3. Compare the diffs -> both are empty v4: * Remove ram_memory variable in pc_q35 completely (Zoltan) v3: * Add three patches regarding init_pam() and SMRAM. * Drop 'hw/i386/pc_q35: Resolve redundant q35_host variable' since Phil posted a similar patch in a more comprehensive series: https://lore.kernel.org/qemu-devel/20230203180914.49112-13-philmd@linaro.org/ * Drop 'hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus' since it inadvertantly changed the memory hierarchy. * Drop ICH9 cleanups again in favor of a separate series. v2: * Factor out 'hw/i386/pc_q35: Reuse machine parameter' from 'hw/i386/pc_q35: Resolve redundant q35_host variable' (Zoltan) * Lower type of phb to Object in 'hw/i386/pc_q35: Resolve redundant q35_host variable' (Zoltan) * Add ICH9 cleanups Bernhard Beschow (9): hw/pci-host/i440fx: Inline sysbus_add_io() hw/pci-host/q35: Inline sysbus_add_io() hw/i386/pc_q35: Reuse machine parameter hw/i386/pc_{q35,piix}: Reuse MachineClass::desc as SMB product name hw/i386/pc_{q35,piix}: Minimize usage of get_system_memory() hw/i386/pc: Initialize ram_memory variable directly hw/pci-host/pam: Make init_pam() usage more readable hw/i386/x86: Make TYPE_X86_MACHINE the owner of smram target/i386/tcg/sysemu/tcg-cpu: Avoid own opinion about smram size include/hw/i386/pc.h | 1 - include/hw/i386/x86.h | 2 ++ include/hw/pci-host/i440fx.h | 7 ++++--- include/hw/pci-host/pam.h | 5 +++-- include/hw/pci-host/q35.h | 4 +++- hw/i386/pc.c | 2 -- hw/i386/pc_piix.c | 10 +++++----- hw/i386/pc_q35.c | 17 +++++++++-------- hw/i386/x86.c | 4 ++++ hw/pci-host/i440fx.c | 28 +++++++++++++--------------- hw/pci-host/pam.c | 12 ++++++------ hw/pci-host/q35.c | 31 ++++++++++++++++--------------- target/i386/tcg/sysemu/tcg-cpu.c | 3 +-- 13 files changed, 66 insertions(+), 60 deletions(-)