Skip to contentSkip to conversation

Improve 40p, make AIX 5.1 boot

PATCH Superseded Artyom Tarasenko 5 participants 16 messages Apr 12, 2019 – Apr 15, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Improve 40p, make AIX 5.1 boot

This series makes various fixes for the -M 40p target. Particularly now it's possible to boot AIX 5.1 (both from a cdrom and a hard disk).

The OFW image:
https://github.com/artyom-tarasenko/openfirmware/releases/download/20190406-AIX-boots/q40pofw-serial.rom

The command line:
qemu-system-ppc -M 40p -bios q40pofw-serial.rom -serial telnet::4441,server -hda aix-hdd.qcow2 -cdrom \
/path/to/aix-5.1-cd1.iso -vga none -nographic

More info can be found here:
https://tyom.blogspot.com/2019/04/aixprep-under-qemu-how-to.html

Artyom Tarasenko (4):
lsi53c895a: hide 53c895a registers in 53c810
40p and prep: implement PCI bus mastering target/ppc: improve performance of large BAT invalidations hw/isa/i82378.c: use 1900 as a base year

 hw/isa/i82378.c         |  4 +++-
 hw/pci-host/prep.c      | 15 +++++++++++----
 hw/scsi/lsi53c895a.c    | 31 ++++++++++++++++++++++++++-----
 target/ppc/mmu_helper.c |  7 +++++++
 4 files changed, 47 insertions(+), 10 deletions(-)
Signature · 1 line
2.7.2
#1 lore raw

PATCH 1/4 lsi53c895a: hide 53c895a registers in 53c810

AIX/PReP does access to the aliased IO registers of 53810. Implement aliasing to make the AIX driver work.

---
 hw/scsi/lsi53c895a.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)
hw/scsi/lsi53c895a.c +26 -5
index da7239d..08841e0 100644
@@ -2266,11 +2266,13 @@ static const struct SCSIBusInfo lsi_scsi_info = {
     .cancel = lsi_request_cancelled
 };
 
-static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
+static void lsi_scsi_realize_8xx(PCIDevice *dev, Error **errp, uint16_t type)
 {
     LSIState *s = LSI53C895A(dev);
     DeviceState *d = DEVICE(dev);
     uint8_t *pci_conf;
+    uint64_t mmio_size;
+    MemoryRegion *mr;
 
     pci_conf = dev->config;
 
@@ -2279,13 +2281,21 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
     /* Interrupt pin A */
     pci_conf[PCI_INTERRUPT_PIN] = 0x01;
 
-    memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
-                          "lsi-mmio", 0x400);
     memory_region_init_io(&s->ram_io, OBJECT(s), &lsi_ram_ops, s,
                           "lsi-ram", 0x2000);
     memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                           "lsi-io", 256);
-
+    if (type == PCI_DEVICE_ID_LSI_53C895A) {
+        mmio_size = 0x400;
+    } else {
+        mr = g_new(MemoryRegion, 1);
+        memory_region_init_alias(mr, OBJECT(d), "lsi-io-alias", &s->io_io,
+                                 0, 0x80);
+        memory_region_add_subregion_overlap(&s->io_io, 0x80, mr, -1);
+        mmio_size = 0x80;
+    }
+    memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
+                          "lsi-mmio", mmio_size);
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
 
@@ -2297,6 +2307,16 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
     scsi_bus_new(&s->bus, sizeof(s->bus), d, &lsi_scsi_info, NULL);
 }
 
+static void lsi_scsi_realize_895A(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C895A);
+}
+
+static void lsi_scsi_realize_810(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C810);
+}
+
 static void lsi_scsi_unrealize(DeviceState *dev, Error **errp)
 {
     LSIState *s = LSI53C895A(dev);
@@ -2309,7 +2329,7 @@ static void lsi_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->realize = lsi_scsi_realize;
+    k->realize = lsi_scsi_realize_895A;
     k->vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
     k->device_id = PCI_DEVICE_ID_LSI_53C895A;
     k->class_id = PCI_CLASS_STORAGE_SCSI;
@@ -2335,6 +2355,7 @@ static void lsi53c810_class_init(ObjectClass *klass, void *data)
 {
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    k->realize = lsi_scsi_realize_810;
     k->device_id = PCI_DEVICE_ID_LSI_53C810;
 }
 
Signature · 1 line
2.7.2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/4] lsi53c895a: hide 53c895a registers in 53c810

Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :

Quoted 13 lines

AIX/PReP does access to the aliased IO registers of 53810. Implement aliasing to make the AIX driver work.

---
  hw/scsi/lsi53c895a.c | 31 ++++++++++++++++++++++++++-----
  1 file changed, 26 insertions(+), 5 deletions(-)
hw/scsi/lsi53c895a.c +0 -0
index da7239d..08841e0 100644

hw/scsi/lsi53c895a.c static const struct SCSIBusInfo lsi_scsi_info = { · line 2269

Quoted 5 lines
hw/scsi/lsi53c895a.c +1 -1
@@ -2266,11 +2266,13 @@ static const struct SCSIBusInfo lsi_scsi_info = {
      .cancel = lsi_request_cancelled
  };
 
-static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
+static void lsi_scsi_realize_8xx(PCIDevice *dev, Error **errp, uint16_t type)

You can probably remove this change, and replace it by uint16_t type = PCI_DEVICE_GET_CLASS(dev)->device_id;

Quoted 37 lines
hw/scsi/lsi53c895a.c +13 -3
  {
      LSIState *s = LSI53C895A(dev);
      DeviceState *d = DEVICE(dev);
      uint8_t *pci_conf;
+    uint64_t mmio_size;
+    MemoryRegion *mr;
 
      pci_conf = dev->config;
 
@@ -2279,13 +2281,21 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      /* Interrupt pin A */
      pci_conf[PCI_INTERRUPT_PIN] = 0x01;
 
-    memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
-                          "lsi-mmio", 0x400);
      memory_region_init_io(&s->ram_io, OBJECT(s), &lsi_ram_ops, s,
                            "lsi-ram", 0x2000);
      memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                            "lsi-io", 256);
-
+    if (type == PCI_DEVICE_ID_LSI_53C895A) {
+        mmio_size = 0x400;
+    } else {
+        mr = g_new(MemoryRegion, 1);
+        memory_region_init_alias(mr, OBJECT(d), "lsi-io-alias", &s->io_io,
+                                 0, 0x80);
+        memory_region_add_subregion_overlap(&s->io_io, 0x80, mr, -1);
+        mmio_size = 0x80;
+    }
+    memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
+                          "lsi-mmio", mmio_size);
      address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
      qdev_init_gpio_out(d, &s->ext_irq, 1);
 
@@ -2297,6 +2307,16 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      scsi_bus_new(&s->bus, sizeof(s->bus), d, &lsi_scsi_info, NULL);
  }

hw/scsi/lsi53c895a.c static void lsi_scsi_realize(PCIDevice *dev, Error **errp) · line 2318

Quoted 10 lines
hw/scsi/lsi53c895a.c +9 -0
 
+static void lsi_scsi_realize_895A(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C895A);
+}
+
+static void lsi_scsi_realize_810(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C810);
+}

... so you can also remove these functions

hw/scsi/lsi53c895a.c static void lsi_class_init(ObjectClass *klass, void *data) · line 2332

Quoted 10 lines
hw/scsi/lsi53c895a.c +2 -1
+
  static void lsi_scsi_unrealize(DeviceState *dev, Error **errp)
  {
      LSIState *s = LSI53C895A(dev);
@@ -2309,7 +2329,7 @@ static void lsi_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->realize = lsi_scsi_realize;
+    k->realize = lsi_scsi_realize_895A;

... so you can also remove this change

hw/scsi/lsi53c895a.c static void lsi53c810_class_init(ObjectClass *klass, void *data) · line 2358

Quoted 8 lines
hw/scsi/lsi53c895a.c +1 -0
      k->vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
      k->device_id = PCI_DEVICE_ID_LSI_53C895A;
      k->class_id = PCI_CLASS_STORAGE_SCSI;
@@ -2335,6 +2355,7 @@ static void lsi53c810_class_init(ObjectClass *klass, void *data)
  {
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    k->realize = lsi_scsi_realize_810;

... and this one.

hw/scsi/lsi53c895a.c static void lsi53c810_class_init(ObjectClass *klass, void *data) · line 2361

Quoted 4 lines
hw/scsi/lsi53c895a.c +0 -0
      k->device_id = PCI_DEVICE_ID_LSI_53C810;
  }
 

Hervé

#3 lore raw

Re: [Qemu-devel] [PATCH 1/4] lsi53c895a: hide 53c895a registers in 53c810

Quoted 18 lines · Hervé Poussineau
Quoted 16 lines · Artyom Tarasenko

AIX/PReP does access to the aliased IO registers of 53810. Implement aliasing to make the AIX driver work.

---
  hw/scsi/lsi53c895a.c | 31 ++++++++++++++++++++++++++-----
  1 file changed, 26 insertions(+), 5 deletions(-)
hw/scsi/lsi53c895a.c +0 -0
index da7239d..08841e0 100644
@@ -2266,11 +2266,13 @@ static const struct SCSIBusInfo lsi_scsi_info = {
      .cancel = lsi_request_cancelled
  };
 
Quoted 5 lines

hw/scsi/lsi53c895a.c static const struct SCSIBusInfo lsi_scsi_info = { · line 2269

Quoted 2 lines
hw/scsi/lsi53c895a.c +1 -1
-static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
+static void lsi_scsi_realize_8xx(PCIDevice *dev, Error **errp, uint16_t type)

You can probably remove this change, and replace it by uint16_t type = PCI_DEVICE_GET_CLASS(dev)->device_id;

Brilliant! Will do in V2, thainks.

Regards,
Artyom

Quoted 77 lines
Quoted 37 lines
hw/scsi/lsi53c895a.c +13 -3
  {
      LSIState *s = LSI53C895A(dev);
      DeviceState *d = DEVICE(dev);
      uint8_t *pci_conf;
+    uint64_t mmio_size;
+    MemoryRegion *mr;
 
      pci_conf = dev->config;
 
@@ -2279,13 +2281,21 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      /* Interrupt pin A */
      pci_conf[PCI_INTERRUPT_PIN] = 0x01;
 
-    memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
-                          "lsi-mmio", 0x400);
      memory_region_init_io(&s->ram_io, OBJECT(s), &lsi_ram_ops, s,
                            "lsi-ram", 0x2000);
      memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                            "lsi-io", 256);
-
+    if (type == PCI_DEVICE_ID_LSI_53C895A) {
+        mmio_size = 0x400;
+    } else {
+        mr = g_new(MemoryRegion, 1);
+        memory_region_init_alias(mr, OBJECT(d), "lsi-io-alias", &s->io_io,
+                                 0, 0x80);
+        memory_region_add_subregion_overlap(&s->io_io, 0x80, mr, -1);
+        mmio_size = 0x80;
+    }
+    memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
+                          "lsi-mmio", mmio_size);
      address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
      qdev_init_gpio_out(d, &s->ext_irq, 1);
 
@@ -2297,6 +2307,16 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      scsi_bus_new(&s->bus, sizeof(s->bus), d, &lsi_scsi_info, NULL);
  }

hw/scsi/lsi53c895a.c static void lsi_scsi_realize(PCIDevice *dev, Error **errp) · line 2318

Quoted 10 lines
hw/scsi/lsi53c895a.c +9 -0
 
+static void lsi_scsi_realize_895A(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C895A);
+}
+
+static void lsi_scsi_realize_810(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C810);
+}

... so you can also remove these functions

hw/scsi/lsi53c895a.c static void lsi_class_init(ObjectClass *klass, void *data) · line 2332

Quoted 10 lines
hw/scsi/lsi53c895a.c +2 -1
+
  static void lsi_scsi_unrealize(DeviceState *dev, Error **errp)
  {
      LSIState *s = LSI53C895A(dev);
@@ -2309,7 +2329,7 @@ static void lsi_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->realize = lsi_scsi_realize;
+    k->realize = lsi_scsi_realize_895A;

... so you can also remove this change

hw/scsi/lsi53c895a.c static void lsi53c810_class_init(ObjectClass *klass, void *data) · line 2358

Quoted 8 lines
hw/scsi/lsi53c895a.c +1 -0
      k->vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
      k->device_id = PCI_DEVICE_ID_LSI_53C895A;
      k->class_id = PCI_CLASS_STORAGE_SCSI;
@@ -2335,6 +2355,7 @@ static void lsi53c810_class_init(ObjectClass *klass, void *data)
  {
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    k->realize = lsi_scsi_realize_810;

... and this one.

hw/scsi/lsi53c895a.c static void lsi53c810_class_init(ObjectClass *klass, void *data) · line 2361

Quoted 4 lines
hw/scsi/lsi53c895a.c +0 -0
      k->device_id = PCI_DEVICE_ID_LSI_53C810;
  }
 

Hervé

Signature · 4 lines
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
#4 lore raw

Re: [Qemu-devel] [PATCH 1/4] lsi53c895a: hide 53c895a registers in 53c810

Quoted 3 lines · Artyom Tarasenko
Quoted 2 lines

You can probably remove this change, and replace it by uint16_t type = PCI_DEVICE_GET_CLASS(dev)->device_id;

Brilliant! Will do in V2, thainks.

Either that, or you could keep the current structure and make mmio_size the last parameter of lsi_scsi_realize.

Paolo

#5 lore raw

PATCH 2/4 40p and prep: implement PCI bus mastering

In reply to Artyom Tarasenko
---
 hw/pci-host/prep.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
hw/pci-host/prep.c +12 -4
index 8b9e1fd..94b7465 100644
@@ -62,6 +62,7 @@ typedef struct PRePPCIState {
     AddressSpace pci_io_as;
     MemoryRegion pci_io;
     MemoryRegion pci_io_non_contiguous;
+    MemoryRegion pci_io_system;
     MemoryRegion pci_memory;
     MemoryRegion pci_intack;
     MemoryRegion bm;
@@ -146,7 +147,7 @@ static uint64_t raven_io_read(void *opaque, hwaddr addr,
     uint8_t buf[4];
 
     addr = raven_io_address(s, addr);
-    address_space_read(&s->pci_io_as, addr + 0x80000000,
+    address_space_read(&s->pci_io_as, addr,
                        MEMTXATTRS_UNSPECIFIED, buf, size);
 
     if (size == 1) {
@@ -178,7 +179,7 @@ static void raven_io_write(void *opaque, hwaddr addr,
         g_assert_not_reached();
     }
 
-    address_space_write(&s->pci_io_as, addr + 0x80000000,
+    address_space_write(&s->pci_io_as, addr,
                         MEMTXATTRS_UNSPECIFIED, buf, size);
 }
 
@@ -276,14 +277,21 @@ static void raven_pcihost_initfn(Object *obj)
     MemoryRegion *address_space_mem = get_system_memory();
     DeviceState *pci_dev;
 
-    memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000);
+    memory_region_init(&s->pci_io, obj, "pci-io", UINT32_MAX);
     memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s,
                           "pci-io-non-contiguous", 0x00800000);
     memory_region_init(&s->pci_memory, obj, "pci-memory", 0x3f000000);
     address_space_init(&s->pci_io_as, &s->pci_io, "raven-io");
 
     /* CPU address space */
-    memory_region_add_subregion(address_space_mem, 0x80000000, &s->pci_io);
+    memory_region_add_subregion_overlap(address_space_mem, 0x0,
+                                        &s->pci_io, -1);
+
+    memory_region_init_alias(&s->pci_io_system,  obj, "pci-io-system",
+                             &s->pci_io, 0x0000000, 0x3f800000);
+
+    memory_region_add_subregion(address_space_mem, 0x80000000,
+                                &s->pci_io_system);
     memory_region_add_subregion_overlap(address_space_mem, 0x80000000,
                                         &s->pci_io_non_contiguous, 1);
     memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_memory);
Signature · 1 line
2.7.2
#7 lore raw

PATCH 3/4 target/ppc: improve performance of large BAT invalidations

In reply to Artyom Tarasenko

Performing a complete flush is ~ 100 times faster than flushing 256MiB of 4KiB pages. Set a limit of 1024 pages and perform a complete flush afterwards.

This patch significantly speeds up AIX 5.1 and NetBSD-ofppc.

---
 target/ppc/mmu_helper.c | 7 +++++++
 1 file changed, 7 insertions(+)
target/ppc/mmu_helper.c +7 -0
index 4a6be4d..d7eed3a 100644
@@ -1809,6 +1809,13 @@ static inline void do_invalidate_BAT(CPUPPCState *env, target_ulong BATu,
 
     base = BATu & ~0x0001FFFF;
     end = base + mask + 0x00020000;
+    if (((end - base) >> TARGET_PAGE_BITS) > 1024) {
+        /* Flushing 1024 4K pages is slower than a complete flush */
+        LOG_BATS("Flush all BATs\n");
+        tlb_flush(CPU(cs));
+        LOG_BATS("Flush done\n");
+        return;
+    }
     LOG_BATS("Flush BAT from " TARGET_FMT_lx " to " TARGET_FMT_lx " ("
              TARGET_FMT_lx ")\n", base, end, mask);
     for (page = base; page != end; page += TARGET_PAGE_SIZE) {
Signature · 1 line
2.7.2
Reviewed-by on v1 3/4
#8 lore raw

Re: [Qemu-devel] [PATCH 3/4] target/ppc: improve performance of large BAT invalidations

Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :

Quoted 10 lines

Performing a complete flush is ~ 100 times faster than flushing 256MiB of 4KiB pages. Set a limit of 1024 pages and perform a complete flush afterwards.

This patch significantly speeds up AIX 5.1 and NetBSD-ofppc.

---
  target/ppc/mmu_helper.c | 7 +++++++
  1 file changed, 7 insertions(+)
#9 lore raw

Re: [Qemu-devel] [PATCH 3/4] target/ppc: improve performance of large BAT invalidations

In reply to Artyom Tarasenko
Quoted 7 lines · Artyom Tarasenko

Performing a complete flush is ~ 100 times faster than flushing 256MiB of 4KiB pages. Set a limit of 1024 pages and perform a complete flush afterwards.

This patch significantly speeds up AIX 5.1 and NetBSD-ofppc.

LGTM, applied to ppc-for-4.1.

Quoted 22 lines
---
 target/ppc/mmu_helper.c | 7 +++++++
 1 file changed, 7 insertions(+)
target/ppc/mmu_helper.c +7 -0
index 4a6be4d..d7eed3a 100644
@@ -1809,6 +1809,13 @@ static inline void do_invalidate_BAT(CPUPPCState *env, target_ulong BATu,
 
     base = BATu & ~0x0001FFFF;
     end = base + mask + 0x00020000;
+    if (((end - base) >> TARGET_PAGE_BITS) > 1024) {
+        /* Flushing 1024 4K pages is slower than a complete flush */
+        LOG_BATS("Flush all BATs\n");
+        tlb_flush(CPU(cs));
+        LOG_BATS("Flush done\n");
+        return;
+    }
     LOG_BATS("Flush BAT from " TARGET_FMT_lx " to " TARGET_FMT_lx " ("
              TARGET_FMT_lx ")\n", base, end, mask);
     for (page = base; page != end; page += TARGET_PAGE_SIZE) {
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#10 lore raw

PATCH 4/4 hw/isa/i82378.c: use 1900 as a base year

In reply to Artyom Tarasenko

AIX 5.1 expects the base year to be 1900. Adjust accordingly.

---
 hw/isa/i82378.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/isa/i82378.c +3 -1
index a5d67bc..546c928 100644
@@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
     isa = isa_create_simple(isabus, "i82374");
 
     /* timer */
-    isa_create_simple(isabus, TYPE_MC146818_RTC);
+    isa = isa_create(isabus, TYPE_MC146818_RTC);
+    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
+    qdev_init_nofail(DEVICE(isa));
 }
 
 static void i82378_init(Object *obj)
Signature · 1 line
2.7.2
#11 lore raw

Re: [Qemu-devel] [PATCH 4/4] hw/isa/i82378.c: use 1900 as a base year

Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :

Quoted 12 lines

AIX 5.1 expects the base year to be 1900. Adjust accordingly.

---
  hw/isa/i82378.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/isa/i82378.c +0 -0
index a5d67bc..546c928 100644

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error **errp) · line 112

Quoted 7 lines
hw/isa/i82378.c +3 -1
@@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
      isa = isa_create_simple(isabus, "i82374");
 
      /* timer */
-    isa_create_simple(isabus, TYPE_MC146818_RTC);
+    isa = isa_create(isabus, TYPE_MC146818_RTC);
+    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
+    qdev_init_nofail(DEVICE(isa));

I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year. Maybe you can you add a base_year property to i82378, and forward it to mc146818 with object_property_add_alias? Then, change 40p machine to set it to 1900, without changing it for prep machine.

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error **errp) · line 115

Quoted 4 lines
hw/isa/i82378.c +0 -0
  }
 
  static void i82378_init(Object *obj)

Hervé

#12 lore raw

Re: [Qemu-devel] [PATCH 4/4] hw/isa/i82378.c: use 1900 as a base year

Quoted 16 lines · Hervé Poussineau
Quoted 14 lines · Artyom Tarasenko

AIX 5.1 expects the base year to be 1900. Adjust accordingly.

---
  hw/isa/i82378.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/isa/i82378.c +0 -0
index a5d67bc..546c928 100644
@@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
      isa = isa_create_simple(isabus, "i82374");
 
Quoted 7 lines

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error **errp) · line 112

Quoted 5 lines
hw/isa/i82378.c +3 -1
      /* timer */
-    isa_create_simple(isabus, TYPE_MC146818_RTC);
+    isa = isa_create(isabus, TYPE_MC146818_RTC);
+    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
+    qdev_init_nofail(DEVICE(isa));

I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year.

I doubt it to be honest. How would it work in the hardware? Is there a pin which would switch a year?
I do believe the different i823xx may have the different base years though.

Quoted 2 lines

Maybe you can you add a base_year property to i82378, and forward it to mc146818 with object_property_add_alias? Then, change 40p machine to set it to 1900, without changing it for prep machine.

Were you not going to drop the -M prep ? Because I sort of dropped the support for it in OFW.
I had a branch were I added some registers to -M prep enough that it would be able to turn itself out as a PowerStack II Utah,
but then again I couldn't find any advantage of having two PReP machines. AFAIK, the only OS which can run on Powerstack, but not on 40p is Motorola AIX. But since we can have IBM AIX, I don't see why would we want to keep -M prep.

On the other hand, if you plan to revive it, I'll think about adding the support for it to OFW.
PowerStack had a Cirrus VGA which we already have.

Quoted 6 lines

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error **errp) · line 115

Quoted 4 lines
hw/isa/i82378.c +0 -0
  }
 
  static void i82378_init(Object *obj)

Hervé

Signature · 4 lines
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
Reviewed-by
#13 lore raw

Re: [Qemu-devel] [PATCH 4/4] hw/isa/i82378.c: use 1900 as a base year

Le 14/04/2019 à 20:53, Artyom Tarasenko a écrit :

Quoted 25 lines · Hervé Poussineau
Quoted 16 lines · Artyom Tarasenko
Quoted 14 lines

AIX 5.1 expects the base year to be 1900. Adjust accordingly.

---
   hw/isa/i82378.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
hw/isa/i82378.c +0 -0
index a5d67bc..546c928 100644
@@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
       isa = isa_create_simple(isabus, "i82374");
 
Quoted 7 lines

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error **errp) · line 112

Quoted 5 lines
hw/isa/i82378.c +3 -1
       /* timer */
-    isa_create_simple(isabus, TYPE_MC146818_RTC);
+    isa = isa_create(isabus, TYPE_MC146818_RTC);
+    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
+    qdev_init_nofail(DEVICE(isa));

I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year.

Quoted 3 lines

I doubt it to be honest. How would it work in the hardware? Is there a pin which would switch a year?
I do believe the different i823xx may have the different base years though.

OK, I don't really know. So, your patch looks fine.

Quoted 11 lines
Quoted 3 lines

Maybe you can you add a base_year property to i82378, and forward it to mc146818 with object_property_add_alias? Then, change 40p machine to set it to 1900, without changing it for prep machine.

Were you not going to drop the -M prep ? Because I sort of dropped the support for it in OFW.
I had a branch were I added some registers to -M prep enough that it would be able to turn itself out as a PowerStack II Utah,
but then again I couldn't find any advantage of having two PReP machines. AFAIK, the only OS which can run on Powerstack, but not on 40p is Motorola AIX. But since we can have IBM AIX, I don't see why would we want to keep -M prep.

I really want to drop support for prep. But, as long as prep is in code base, we shouldn't regress it too much.

Quoted 14 lines

On the other hand, if you plan to revive it, I'll think about adding the support for it to OFW.
PowerStack had a Cirrus VGA which we already have.

Quoted 6 lines

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error **errp) · line 115

Quoted 4 lines
hw/isa/i82378.c +0 -0
   }
 
   static void i82378_init(Object *obj)

Hervé

#14 lore raw

Re: [Qemu-devel] [PATCH 4/4] hw/isa/i82378.c: use 1900 as a base year

Quoted 33 lines · Hervé Poussineau

Le 14/04/2019 à 20:53, Artyom Tarasenko a écrit :

Quoted 32 lines
Quoted 17 lines · Hervé Poussineau
Quoted 15 lines · Artyom Tarasenko

AIX 5.1 expects the base year to be 1900. Adjust accordingly.

---
   hw/isa/i82378.c | 4 +++-

   1 file changed, 3 insertions(+), 1 deletion(-)
hw/isa/i82378.c +0 -0
index a5d67bc..546c928 100644
@@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error
 **errp)
        isa = isa_create_simple(isabus, "i82374");
 
Quoted 8 lines

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error **errp) · line 112

Quoted 5 lines
hw/isa/i82378.c +3 -1
        /* timer */
-    isa_create_simple(isabus, TYPE_MC146818_RTC);
+    isa = isa_create(isabus, TYPE_MC146818_RTC);
+    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
+    qdev_init_nofail(DEVICE(isa));

I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year.

I doubt it to be honest. How would it work in the hardware? Is there a pin which would switch a year?
I do believe the different i823xx may have the different base years though.

There is no RTC on the i82378, this should be moved to the board code and set the date there. Do you want me to send this patch?

Regards,

Phil.

#15 lore raw

Re: [Qemu-devel] [PATCH 4/4] hw/isa/i82378.c: use 1900 as a base year

Quoted 31 lines · Philippe Mathieu-Daudé
Quoted 29 lines · Hervé Poussineau
Quoted 28 lines · Artyom Tarasenko
Quoted 25 lines · Hervé Poussineau
Quoted 12 lines · Artyom Tarasenko

AIX 5.1 expects the base year to be 1900. Adjust accordingly.

---
   hw/isa/i82378.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
hw/isa/i82378.c +0 -0
index a5d67bc..546c928 100644

hw/isa/i82378.c static void i82378_realize(PCIDevice *pci, Error · line 113

Quoted 8 lines
hw/isa/i82378.c +3 -1
@@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error
 **errp)
       isa = isa_create_simple(isabus, "i82374");
 
       /* timer */
-    isa_create_simple(isabus, TYPE_MC146818_RTC);
+    isa = isa_create(isabus, TYPE_MC146818_RTC);
+    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
+    qdev_init_nofail(DEVICE(isa));

I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

I doubt it to be honest. How would it work in the hardware? Is there a pin which would switch a year?
I do believe the different i823xx may have the different base years though.

There is no RTC on the i82378, this should be moved to the board code and set the date there. Do you want me to send this patch?

Please do. I won't have a chance to get to it till the next weekend.

Artyom

Signature · 4 lines
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu