[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 51/68] hw/i386/pc: Avoid one use of the current_machine global
From: |
Michael S. Tsirkin |
Subject: |
[PULL 51/68] hw/i386/pc: Avoid one use of the current_machine global |
Date: |
Tue, 12 Mar 2024 18:28:14 -0400 |
From: Bernhard Beschow <shentey@gmail.com>
The RTC can be accessed through the X86 machine instance, so rather than passing
the RTC it's possible to pass the machine state instead. This avoids
pc_boot_set() from having to access the current_machine global.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20240303185332.1408-3-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 98bcf4d420..4077d8162c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -425,9 +425,10 @@ static void set_boot_dev(PCMachineState *pcms,
MC146818RtcState *s,
static void pc_boot_set(void *opaque, const char *boot_device, Error **errp)
{
- PCMachineState *pcms = PC_MACHINE(current_machine);
+ PCMachineState *pcms = opaque;
+ X86MachineState *x86ms = X86_MACHINE(pcms);
- set_boot_dev(pcms, opaque, boot_device, errp);
+ set_boot_dev(pcms, MC146818_RTC(x86ms->rtc), boot_device, errp);
}
static void pc_cmos_init_floppy(MC146818RtcState *rtc_state, ISADevice *floppy)
@@ -1252,7 +1253,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
}
#endif
- qemu_register_boot_set(pc_boot_set, rtc_state);
+ qemu_register_boot_set(pc_boot_set, pcms);
if (!xen_enabled() &&
(x86ms->pit == ON_OFF_AUTO_AUTO || x86ms->pit == ON_OFF_AUTO_ON)) {
--
MST
- [PULL 42/68] hw/nvme: Use pcie_sriov_num_vfs(), (continued)
- [PULL 42/68] hw/nvme: Use pcie_sriov_num_vfs(), Michael S. Tsirkin, 2024/03/12
- [PULL 36/68] hw/misc/xlnx-versal-trng: Check returned bool in trng_prop_fault_event_set(), Michael S. Tsirkin, 2024/03/12
- [PULL 38/68] hw/vfio/iommufd: Fix missing ERRP_GUARD() in iommufd_cdev_getfd(), Michael S. Tsirkin, 2024/03/12
- [PULL 39/68] hw/intc: Check @errp to handle the error of IOAPICCommonClass.realize(), Michael S. Tsirkin, 2024/03/12
- [PULL 40/68] Implement base of SMBIOS type 9 descriptor., Michael S. Tsirkin, 2024/03/12
- [PULL 41/68] Implement SMBIOS type 9 v2.6, Michael S. Tsirkin, 2024/03/12
- [PULL 43/68] pcie_sriov: Validate NumVFs, Michael S. Tsirkin, 2024/03/12
- [PULL 48/68] Revert "hw/i386/pc_sysfw: Inline pc_system_flash_create() and remove it", Michael S. Tsirkin, 2024/03/12
- [PULL 44/68] pcie_sriov: Reset SR-IOV extended capability, Michael S. Tsirkin, 2024/03/12
- [PULL 53/68] hw/i386/pc: Inline pc_cmos_init() into pc_cmos_init_late() and remove it, Michael S. Tsirkin, 2024/03/12
- [PULL 51/68] hw/i386/pc: Avoid one use of the current_machine global,
Michael S. Tsirkin <=
- [PULL 46/68] hw/pci: Always call pcie_sriov_pf_reset(), Michael S. Tsirkin, 2024/03/12
- [PULL 45/68] pcie_sriov: Do not reset NumVFs after disabling VFs, Michael S. Tsirkin, 2024/03/12
- [PULL 47/68] pc: q35: Bump max_cpus to 4096 vcpus, Michael S. Tsirkin, 2024/03/12
- [PULL 49/68] Revert "hw/i386/pc: Confine system flash handling to pc_sysfw", Michael S. Tsirkin, 2024/03/12
- [PULL 50/68] hw/i386/pc: Remove "rtc_state" link again, Michael S. Tsirkin, 2024/03/12
- [PULL 52/68] hw/i386/pc: Set "normal" boot device order in pc_basic_device_init(), Michael S. Tsirkin, 2024/03/12
- [PULL 54/68] qom: new object to associate device to NUMA node, Michael S. Tsirkin, 2024/03/12
- [PULL 58/68] virtio-iommu: Change the default granule to the host page size, Michael S. Tsirkin, 2024/03/12
- [PULL 66/68] hmat acpi: Fix out of bounds access due to missing use of indirection, Michael S. Tsirkin, 2024/03/12
- [PULL 55/68] hw/acpi: Implement the SRAT GI affinity structure, Michael S. Tsirkin, 2024/03/12