From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Bernhard Beschow" <shentey@gmail.com>,
qemu-ppc@nongnu.org, "Hervé Poussineau" <hpoussin@reactos.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v4 1/4] hw/i386/pc: Pass Error** argument to pc_basic_device_init()
Date: Fri, 20 Oct 2023 19:15:05 +0200 [thread overview]
Message-ID: <20231020171509.87839-2-philmd@linaro.org> (raw)
In-Reply-To: <20231020171509.87839-1-philmd@linaro.org>
pc_basic_device_init() creates devices which can fail,
allow to propagate error to caller.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/i386/pc.h | 5 +++--
hw/i386/pc.c | 7 +++++--
hw/i386/pc_piix.c | 2 +-
hw/i386/pc_q35.c | 2 +-
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index bec38cb92c..069c27368d 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -174,11 +174,12 @@ void pc_memory_init(PCMachineState *pcms,
uint64_t pci_hole64_size);
uint64_t pc_pci_hole64_start(void);
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
-void pc_basic_device_init(struct PCMachineState *pcms,
+bool pc_basic_device_init(struct PCMachineState *pcms,
ISABus *isa_bus, qemu_irq *gsi,
ISADevice *rtc_state,
bool create_fdctrl,
- uint32_t hpet_irqs);
+ uint32_t hpet_irqs,
+ Error **errp);
void pc_cmos_init(PCMachineState *pcms,
BusState *ide0, BusState *ide1,
ISADevice *s);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f7ee638bec..2481c11e83 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1189,11 +1189,12 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl,
g_free(a20_line);
}
-void pc_basic_device_init(struct PCMachineState *pcms,
+bool pc_basic_device_init(struct PCMachineState *pcms,
ISABus *isa_bus, qemu_irq *gsi,
ISADevice *rtc_state,
bool create_fdctrl,
- uint32_t hpet_irqs)
+ uint32_t hpet_irqs,
+ Error **errp)
{
int i;
DeviceState *hpet = NULL;
@@ -1291,6 +1292,8 @@ void pc_basic_device_init(struct PCMachineState *pcms,
/* Super I/O */
pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled,
pcms->vmport != ON_OFF_AUTO_ON);
+
+ return true;
}
void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e36a3262b2..0d9cdf773e 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -320,7 +320,7 @@ static void pc_init1(MachineState *machine,
/* init basic PC hardware */
pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, true,
- 0x4);
+ 0x4, &error_fatal);
pc_nic_init(pcmc, isa_bus, pci_bus);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index a7386f2ca2..e4b05e3139 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -301,7 +301,7 @@ static void pc_q35_init(MachineState *machine)
/* init basic PC hardware */
pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, !mc->no_floppy,
- 0xff0104);
+ 0xff0104, &error_fatal);
if (pcms->sata_enabled) {
/* ahci and SATA device, for q35 1 ahci controller is built-in */
--
2.41.0
next prev parent reply other threads:[~2023-10-20 17:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 17:15 [PATCH v4 0/4] hw/audio/pcspk: Inline pcspk_init() Philippe Mathieu-Daudé
2023-10-20 17:15 ` Philippe Mathieu-Daudé [this message]
2023-10-22 16:59 ` [PATCH v4 1/4] hw/i386/pc: Pass Error** argument to pc_basic_device_init() Richard Henderson
2023-10-20 17:15 ` [PATCH v4 2/4] hw/i386/pc: Propagate error if HPET device creation failed Philippe Mathieu-Daudé
2023-10-22 17:01 ` Richard Henderson
2023-10-20 17:15 ` [PATCH v4 3/4] hw/i386/pc: Propagate error if PC_SPEAKER " Philippe Mathieu-Daudé
2023-10-22 17:01 ` Richard Henderson
2023-10-20 17:15 ` [PATCH v4 4/4] hw/isa/i82378: " Philippe Mathieu-Daudé
2023-10-22 17:02 ` Richard Henderson
2023-10-22 22:12 ` Bernhard Beschow
2023-10-22 22:23 ` [PATCH v4 0/4] hw/audio/pcspk: Inline pcspk_init() Bernhard Beschow
2023-11-03 8:56 ` Markus Armbruster
2023-11-08 10:28 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231020171509.87839-2-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=eduardo@habkost.net \
--cc=hpoussin@reactos.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).