From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: "Hervé Poussineau" <hpoussin@reactos.org>, "Michael S . Tsirkin" <mst@redhat.com>, "Paolo Bonzini" <pbonzini@redhat.com> Cc: Aurelien Jarno <aurelien@aurel32.net>, qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH v4 12/16] piix4: add a mc146818rtc controller as specified in datasheet Date: Tue, 23 Apr 2019 23:58:50 +0200 [thread overview] Message-ID: <f6179552-cc21-0935-ddea-7bbdeecddac3@redhat.com> (raw) In-Reply-To: <20180106153730.30313-13-hpoussin@reactos.org> Hi Hervé, I haven't forgot this series (still 15 months passed...) and it is now integrated in a bigger one. While retesting the whole previous to post, I noticed an error... On 1/6/18 4:37 PM, Hervé Poussineau wrote: > Remove mc146818rtc instanciated in malta board, to not have it twice. > > Acked-by: Michael S. Tsirkin <mst@redhat.com> > Acked-by: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> > --- > hw/isa/piix4.c | 12 ++++++++++++ > hw/mips/mips_malta.c | 5 ----- > 2 files changed, 12 insertions(+), 5 deletions(-) > > diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c > index 7a13e83270..0d68fcb193 100644 > --- a/hw/isa/piix4.c > +++ b/hw/isa/piix4.c > @@ -31,6 +31,7 @@ > #include "hw/char/isa.h" > #include "hw/sysbus.h" > #include "hw/timer/i8254.h" > +#include "hw/timer/mc146818rtc.h" > #include "qapi/error.h" > > PCIDevice *piix4_dev; > @@ -43,6 +44,7 @@ typedef struct PIIX4State { > FDCtrlISABus floppy; > ISASerialState serial[2]; > ISAParallelState parallel; > + RTCState rtc; > > /* Reset Control Register */ > MemoryRegion rcr_mem; > @@ -217,6 +219,15 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp) > return; > } > > + /* timer */ > + qdev_set_parent_bus(DEVICE(&s->rtc), BUS(isa_bus)); ... here. You don't set the "base_year" property. If unset, the default of 1980 is used. However ... > + object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err); > + if (err) { > + error_propagate(errp, err); > + return; > + } > + isa_init_irq(ISA_DEVICE(&s->rtc), &s->rtc.irq, RTC_ISA_IRQ); > + > piix4_dev = pci_dev; > qemu_register_reset(piix4_reset, s); > } > @@ -231,6 +242,7 @@ static void piix4_init(Object *obj) > object_initialize(&s->serial[i], sizeof(s->serial[i]), TYPE_ISA_SERIAL); > } > object_initialize(&s->parallel, sizeof(s->parallel), TYPE_ISA_PARALLEL); > + object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC); > > object_property_add_alias(obj, "floppy", OBJECT(&s->floppy), "driveA", > &error_abort); > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c > index 30fb30fc0e..3d304a6e0a 100644 > --- a/hw/mips/mips_malta.c > +++ b/hw/mips/mips_malta.c > @@ -995,7 +995,6 @@ void mips_malta_init(MachineState *machine) > uint8_t *smbus_eeprom_buf = g_malloc0(smbus_eeprom_size); > int64_t kernel_entry, bootloader_run_addr; > PCIBus *pci_bus; > - ISABus *isa_bus; > qemu_irq cbus_irq, i8259_irq; > PCIDevice *pci; > int piix4_devfn; > @@ -1197,7 +1196,6 @@ void mips_malta_init(MachineState *machine) > qdev_prop_set_chr(dev, "parallel", parallel_hds[0]); > > qdev_init_nofail(dev); > - isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); > piix4_devfn = pci->devfn; > > /* Interrupt controller */ > @@ -1213,9 +1211,6 @@ void mips_malta_init(MachineState *machine) > smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); > g_free(smbus_eeprom_buf); > > - /* Super I/O */ > - mc146818_rtc_init(isa_bus, 2000, NULL); ... here it is set to 2000. The same value is used in the PC machine (which uses the PIIX3). > - > /* Network card */ > network_init(pci_bus); > > I'll amend this snippet to your patch: -- >8 -- /* RTC */ qdev_set_parent_bus(DEVICE(&s->rtc), BUS(isa_bus)); + qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000); object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err); -- Paolo/Michael: I'll keep your Acked-by, I hope you are OK with that. Regards, Phil.
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: "Hervé Poussineau" <hpoussin@reactos.org>, "Michael S . Tsirkin" <mst@redhat.com>, "Paolo Bonzini" <pbonzini@redhat.com> Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net> Subject: Re: [Qemu-devel] [PATCH v4 12/16] piix4: add a mc146818rtc controller as specified in datasheet Date: Tue, 23 Apr 2019 23:58:50 +0200 [thread overview] Message-ID: <f6179552-cc21-0935-ddea-7bbdeecddac3@redhat.com> (raw) Message-ID: <20190423215850.vQW8Pa0nJX6K7n9LLwmykebLnpnjCDGTL3-R-MhVNdI@z> (raw) In-Reply-To: <20180106153730.30313-13-hpoussin@reactos.org> Hi Hervé, I haven't forgot this series (still 15 months passed...) and it is now integrated in a bigger one. While retesting the whole previous to post, I noticed an error... On 1/6/18 4:37 PM, Hervé Poussineau wrote: > Remove mc146818rtc instanciated in malta board, to not have it twice. > > Acked-by: Michael S. Tsirkin <mst@redhat.com> > Acked-by: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> > --- > hw/isa/piix4.c | 12 ++++++++++++ > hw/mips/mips_malta.c | 5 ----- > 2 files changed, 12 insertions(+), 5 deletions(-) > > diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c > index 7a13e83270..0d68fcb193 100644 > --- a/hw/isa/piix4.c > +++ b/hw/isa/piix4.c > @@ -31,6 +31,7 @@ > #include "hw/char/isa.h" > #include "hw/sysbus.h" > #include "hw/timer/i8254.h" > +#include "hw/timer/mc146818rtc.h" > #include "qapi/error.h" > > PCIDevice *piix4_dev; > @@ -43,6 +44,7 @@ typedef struct PIIX4State { > FDCtrlISABus floppy; > ISASerialState serial[2]; > ISAParallelState parallel; > + RTCState rtc; > > /* Reset Control Register */ > MemoryRegion rcr_mem; > @@ -217,6 +219,15 @@ static void piix4_realize(PCIDevice *pci_dev, Error **errp) > return; > } > > + /* timer */ > + qdev_set_parent_bus(DEVICE(&s->rtc), BUS(isa_bus)); ... here. You don't set the "base_year" property. If unset, the default of 1980 is used. However ... > + object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err); > + if (err) { > + error_propagate(errp, err); > + return; > + } > + isa_init_irq(ISA_DEVICE(&s->rtc), &s->rtc.irq, RTC_ISA_IRQ); > + > piix4_dev = pci_dev; > qemu_register_reset(piix4_reset, s); > } > @@ -231,6 +242,7 @@ static void piix4_init(Object *obj) > object_initialize(&s->serial[i], sizeof(s->serial[i]), TYPE_ISA_SERIAL); > } > object_initialize(&s->parallel, sizeof(s->parallel), TYPE_ISA_PARALLEL); > + object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC); > > object_property_add_alias(obj, "floppy", OBJECT(&s->floppy), "driveA", > &error_abort); > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c > index 30fb30fc0e..3d304a6e0a 100644 > --- a/hw/mips/mips_malta.c > +++ b/hw/mips/mips_malta.c > @@ -995,7 +995,6 @@ void mips_malta_init(MachineState *machine) > uint8_t *smbus_eeprom_buf = g_malloc0(smbus_eeprom_size); > int64_t kernel_entry, bootloader_run_addr; > PCIBus *pci_bus; > - ISABus *isa_bus; > qemu_irq cbus_irq, i8259_irq; > PCIDevice *pci; > int piix4_devfn; > @@ -1197,7 +1196,6 @@ void mips_malta_init(MachineState *machine) > qdev_prop_set_chr(dev, "parallel", parallel_hds[0]); > > qdev_init_nofail(dev); > - isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); > piix4_devfn = pci->devfn; > > /* Interrupt controller */ > @@ -1213,9 +1211,6 @@ void mips_malta_init(MachineState *machine) > smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); > g_free(smbus_eeprom_buf); > > - /* Super I/O */ > - mc146818_rtc_init(isa_bus, 2000, NULL); ... here it is set to 2000. The same value is used in the PC machine (which uses the PIIX3). > - > /* Network card */ > network_init(pci_bus); > > I'll amend this snippet to your patch: -- >8 -- /* RTC */ qdev_set_parent_bus(DEVICE(&s->rtc), BUS(isa_bus)); + qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000); object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err); -- Paolo/Michael: I'll keep your Acked-by, I hope you are OK with that. Regards, Phil.
next prev parent reply other threads:[~2019-04-23 21:58 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-01-06 15:37 [Qemu-devel] [PATCH v4 00/16] piix4: cleanup and improvements Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 01/16] fdc: move object structures to header file Hervé Poussineau 2018-01-15 23:07 ` John Snow 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 02/16] serial/parallel: " Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 03/16] mc146818rtc: move structure " Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 04/16] mc146818rtc: always register rtc to rtc list Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 05/16] piix4: rename some variables in realize function Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 06/16] piix4: add Reset Control Register Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 07/16] piix4: add a i8259 interrupt controller as specified in datasheet Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 08/16] piix4: add a i8257 dma " Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 09/16] piix4: add a i8254 pit " Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 10/16] piix4: add a i8042 keyboard/mouse " Hervé Poussineau 2018-01-07 16:51 ` Philippe Mathieu-Daudé 2018-01-08 2:18 ` Philippe Mathieu-Daudé 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 11/16] piix4: add a floppy controller, 1 parallel port and 2 serial ports Hervé Poussineau 2018-01-07 16:57 ` Philippe Mathieu-Daudé 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 12/16] piix4: add a mc146818rtc controller as specified in datasheet Hervé Poussineau 2019-04-23 21:58 ` Philippe Mathieu-Daudé [this message] 2019-04-23 21:58 ` Philippe Mathieu-Daudé 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 13/16] piix4: add a speaker " Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 14/16] piix4: convert reset function to QOM Hervé Poussineau 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 15/16] piix4: rename PIIX4 object to piix4-isa Hervé Poussineau 2018-01-07 16:38 ` Philippe Mathieu-Daudé 2018-01-06 15:37 ` [Qemu-devel] [PATCH v4 16/16] piix4: we can now instanciate a PIIX4 with -device Hervé Poussineau 2018-01-08 2:21 ` [Qemu-devel] [PATCH v4 00/16] piix4: cleanup and improvements 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=f6179552-cc21-0935-ddea-7bbdeecddac3@redhat.com \ --to=philmd@redhat.com \ --cc=aurelien@aurel32.net \ --cc=hpoussin@reactos.org \ --cc=mst@redhat.com \ --cc=pbonzini@redhat.com \ --cc=qemu-devel@nongnu.org \ /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: linkBe 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).