hw/ide/pci: Replace some magic numbers by constants
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Philippe Mathieu-Daudé
Reviewed-byQuoted 4 lines · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>--- hw/ide/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Mark Cave-Ayland
Reviewed-byQuoted 10 lines · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>--- hw/ide/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/ide/pci.c +0
-0
hw/ide/pci.c void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val) · line 327
Quoted 9 lines
hw/ide/pci.c +2
-1@@ -320,7 +320,8 @@ void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val)void bmdma_status_writeb (BMDMAState *bm,uint32_t val) { - bm->status = (val &0x60 ) | (bm->status &1 ) | (bm->status & ~val &0x06 ); + bm->status = (val &0x60 ) | (bm->status &BM_STATUS_DMAING ) + | (bm->status & ~val & (BM_STATUS_ERROR |BM_STATUS_INT )); } static uint64_t bmdma_addr_read(void *opaque, hwaddr addr,
ATB,
Mark.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v3 3/7] hw/isa/vt82c686: Remove via_isa_set_irq()
Quoted 8 lines · Bernhard Beschow
Now that
via_isa_set_irq()is unused it can be removed.Signed-off-by Bernhard Beschow <[email protected]>Reviewed-by Mark Cave-Ayland <[email protected]>--- include/hw/isa/vt82c686.h | 2 -- hw/isa/vt82c686.c | 6 ------ 2 files changed, 8 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mark Cave-Ayland
Reviewed-byRe: [PATCH v3 7/7] hw/ide/piix: Move registration of VMStateDescription to DeviceClass
Quoted 57 lines · Bernhard Beschow
The modern, declarative way to set up VM state handling is to assign to
DeviceClass::vmsdattribute.There shouldn't be any change in behavior since
dc->vmsdcausesvmstate_register_with_alias_id()to be called on the instance during the instance init phase.vmstate_register()was also called during the instance init phase which forwards tovmstate_register_with_alias_id()internally. Checking the migration schema before and after this patch confirms:before:
Quoted 2 lines
qemu-system-x86_64 -S
qemu > migrate -d exec:cat>before.migafter:
Quoted 6 lines
qemu-system-x86_64 -S
qemu > migrate -d exec:cat>after.mig
analyze-migration.py-d desc -f before.mig > before.jsonanalyze-migration.py-d desc -f after.mig > after.json diff before.json after.json-> empty
Signed-off-by Bernhard Beschow <[email protected]>--- hw/ide/piix.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)hw/ide/piix.c +1
-3@@ -28,7 +28,6 @@*/ #include "qemu/osdep.h" -#include "migration/vmstate.h" #include "qapi/error.h" #include "hw/pci/pci.h" #include "hw/ide/piix.h" @@ -159,8 +158,6 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)bmdma_setup_bar (d);pci_register_bar (dev,4 ,PCI_BASE_ADDRESS_SPACE_IO , &d->bmdma_bar); -vmstate_register (VMSTATE_IF (dev),0 , &vmstate_ide_pci, d); -for (unsigned i =0 ; i <2 ; i++) {if (!pci_piix_init_bus (d, i, errp)) {return ;@@ -186,6 +183,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); dc->reset = piix_ide_reset; + dc->vmsd = &vmstate_ide_pci; k->realize = pci_piix_ide_realize; k->exit = pci_piix_ide_exitfn; k->vendor_id =PCI_VENDOR_ID_INTEL ;
hw/ide/piix.c static void piix4_ide_class_init(ObjectClass *klass, void *data) · line 212
Quoted 7 lines
hw/ide/piix.c +1
-0@@ -208,6 +206,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); dc->reset = piix_ide_reset; + dc->vmsd = &vmstate_ide_pci; k->realize = pci_piix_ide_realize; k->exit = pci_piix_ide_exitfn; k->vendor_id =PCI_VENDOR_ID_INTEL ;
ATB,
Mark.
Re: [PATCH v3 0/7] VIA and general PCI IDE cleanup
In reply to a message not in the archiveAm 31. Mai 2023 21:10:36 UTC schrieb Bernhard Beschow <[email protected]>:
Quoted 78 lines
This series is split off from a more general PCI IDE refactoring aiming for a
common implementation of the PCI IDE controller specification for all
TYPE_PCI_IDEmodels [1].The first three patches resolve a circular dependency between the VIA IDE
controller and its south bridge. The next three patches resolves redundant code
accross all
TYPE_PCI_IDEmodels. The last patch modernizes VM state setup inPIIX IDE.
Testing done:
*
make check*
make check-avocado* `qemu-system-ppc -machine pegasos2 -rtc base=localtime -device \
ati-vga,guest_hwcursor=true,romfile="" -cdrom morphos-3.17.iso \-bios pegasos2.rom`
The machine booted successfully and a startup sound was hearable
* `qemu-system-ppc -machine sam460ex -rtc base=localtime -drive \
if=none,id=cd,file=morphos-3.17.iso,format=raw -device \ide-cd,drive=cd,bus=ide.1`
The machine booted successfully into graphical desktop environment
v3:
* Fix formatting (Mark) ... and split into two commits (Bernhard)
v2:
* Add missing Signed-off-by tag to last commit (Zoltan)
Changes since [1]:
* Turn legacy IRQs into named GPIOs (Mark)
* Don't make VIA IDE legacy IRQs routable; just wire up in host device (Zoltan)
* Rename extracted
bmdma_clear_status()(Zoltan)... to
bmdma_status_writeb()(Mark)[1] https://lore.kernel.org/qemu-devel/[email protected]/
Bernhard Beschow (7):
hw/ide/pci: Expose legacy interrupts as named GPIOs
hw/ide/via: Wire up IDE legacy interrupts in host device
hw/isa/vt82c686: Remove
via_isa_set_irq()
Quoted 8 lines
hw/ide: Extract IDEBus assignment into
bmdma_init()hw/ide: Extract
bmdma_status_writeb()hw/ide/pci: Replace some magic numbers by constants
hw/ide/piix: Move registration of VMStateDescription to DeviceClass
Ping
AFAICS all patches are reviewed.
Best regards,
Bernhard
Quoted 27 lines
include/hw/ide/pci.h| 1 +
include/hw/isa/vt82c686.h| 2 --
hw/ide/cmd646.c| 3 +--
hw/ide/pci.c| 16 ++++++++++++++++
hw/ide/piix.c| 8 +++-----
hw/ide/sii3112.c| 7 ++-----
hw/ide/via.c| 9 +++++----
hw/isa/vt82c686.c| 11 +++++------8 files changed, 33 insertions(+), 24 deletions(-)-- >
2.40.1
Philippe Mathieu-Daudé
AppliedRe: [PATCH v3 0/7] VIA and general PCI IDE cleanup
In reply to a message not in the archiveQuoted 5 lines · Bernhard Beschow
This series is split off from a more general PCI IDE refactoring aiming for a common implementation of the PCI IDE controller specification for all
TYPE_PCI_IDEmodels [1].
Quoted 8 lines
Bernhard Beschow (7):
hw/ide/pci: Expose legacy interrupts as named GPIOs hw/ide/via: Wire up IDE legacy interrupts in host device hw/isa/vt82c686: Removevia_isa_set_irq()
hw/ide: Extract IDEBus assignment intobmdma_init()hw/ide: Extractbmdma_status_writeb()
hw/ide/pci: Replace some magic numbers by constants hw/ide/piix: Move registration of VMStateDescription to DeviceClass
Queued to mips-next, thanks!