Skip to contentSkip to conversation

hw/mips/fuloong2e: PoC to fix hang after reboot

PATCH In review Philippe Mathieu-Daudé 4 participants 36 messages May 10, 2020 – May 26, 2020

lore
Share & tools
lore
#0 lore raw

cover hw/mips/fuloong2e: PoC to fix hang after reboot

The PMON firmware behave differently regarding it is run after a cold/warm reset. A simple bit flip fix the issue, however we need to know the type of reset to set it. Currently QEMU only supports COLD reset.

This series contains various of my current Fuloong queue,
- Welcome Huacai Chen as co-maintainer,
- Fix typo in machine name,
- Few cleanups in Bonito64,
- Report various Bonito64 accesses as UNIMP,
- Proof-of-concept fix for the reset bit.

The last patch is not for merging, but is included to see if the Multi-phase reset mechanism can fix the problem.

Regards,

Phil.

Huacai Chen (1):
MAINTAINERS: Add Huacai Chen as fuloong2e co-maintainer

Philippe Mathieu-Daudé (11):
hw/mips/fuloong2e: Rename PMON BIOS name hw/mips/fuloong2e: Move code and update a comment hw/mips/fuloong2e: Fix typo in Fuloong machine name hw/pci-host: Use CONFIG_PCI_BONITO to select the Bonito North Bridge hw/pci-host/bonito: Fix DPRINTF() format strings hw/pci-host/bonito: Map peripheral using physical address hw/pci-host/bonito: Map all the Bonito64 I/O range hw/pci-host/bonito: Map the different PCI ranges more detailled hw/pci-host/bonito: Better describe the I/O CS regions hw/pci-host/bonito: Set the Config register reset value with

    FIELD_DP32

POC hw/pci-host/bonito: Fix BONGENCFG value after a warm-reset

 docs/system/target-mips.rst              |  2 +-
 default-configs/mips64el-softmmu.mak     |  2 +-
 hw/isa/vt82c686.c                        |  2 +-
 hw/mips/{mips_fulong2e.c => fuloong2e.c} | 41 +++++------
 hw/pci-host/bonito.c                     | 92 +++++++++++++++++++-----
 tests/qtest/endianness-test.c            |  2 +-
 MAINTAINERS                              |  6 +-
 hw/mips/Kconfig                          |  3 +-
 hw/mips/Makefile.objs                    |  2 +-
 hw/pci-host/Kconfig                      |  5 ++
 hw/pci-host/Makefile.objs                |  2 +-
 11 files changed, 114 insertions(+), 45 deletions(-)
 rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)
Signature · 1 line
2.21.3
#1 lore raw

PATCH 1/12 MAINTAINERS: Add Huacai Chen as fuloong2e co-maintainer

From: Huacai Chen <[email protected]>

I submitted the MIPS/fuloong2e support about ten years ago, and after that I became a MIPS kernel developer. Last year, Philippe Mathieu- Daudé asked me that whether I can be a reviewer of MIPS/fuloong2e, and I promised that I will do some QEMU work in the next year (i.e., 2020 and later). I think now (and also in future) I can have some spare time, so I can finally do some real work on QEMU/MIPS. And if possible, I hope I can be a co-maintainer of MIPS/fuloong2e.

Message-Id: <[email protected]>

[PMD: Added Jiaxun Yang as reviewer]
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
index 1f84e3ae2c..aa5c54c75a 100644
@@ -1075,8 +1075,10 @@ S: Obsolete
 F: hw/mips/mips_r4k.c
 
 Fulong 2E
+M: Huacai Chen <[email protected]>
 M: Philippe Mathieu-Daudé <[email protected]>
 M: Aleksandar Markovic <[email protected]>
+R: Jiaxun Yang <[email protected]>
 S: Odd Fixes
 F: hw/mips/mips_fulong2e.c
 F: hw/isa/vt82c686.c
Signature · 1 line
2.21.3
Reviewed-by on v1 1/12
#2 lore raw

Re: [PATCH 01/12] MAINTAINERS: Add Huacai Chen as fuloong2e co-maintainer

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 12 lines

From: Huacai Chen <[email protected]>

I submitted the MIPS/fuloong2e support about ten years ago, and after that I became a MIPS kernel developer. Last year, Philippe Mathieu- Daudé asked me that whether I can be a reviewer of MIPS/fuloong2e, and I promised that I will do some QEMU work in the next year (i.e., 2020 and later). I think now (and also in future) I can have some spare time, so I can finally do some real work on QEMU/MIPS. And if possible, I hope I can be a co-maintainer of MIPS/fuloong2e.

Quoted 9 lines

Message-Id: <[email protected]>

[PMD: Added Jiaxun Yang as reviewer]
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
Quoted 18 lines
MAINTAINERS +2 -1
index 1f84e3ae2c..aa5c54c75a 100644
@@ -1075,8 +1075,10 @@ S: Obsolete
 F: hw/mips/mips_r4k.c
 
 Fulong 2E
+M: Huacai Chen <[email protected]>
 M: Philippe Mathieu-Daudé <[email protected]>
 M: Aleksandar Markovic <[email protected]>
+R: Jiaxun Yang <[email protected]>
 S: Odd Fixes
 F: hw/mips/mips_fulong2e.c
 F: hw/isa/vt82c686.c
--

2.21.3

#3 lore raw

PATCH 2/12 hw/mips/fuloong2e: Rename PMON BIOS name

In reply to Philippe Mathieu-Daudé

I'm not sure where 'pmon_fulong2e.bin' comes from. As I always found this bios named 'pmon_2e.bin', rename the definition.

---
 hw/mips/mips_fulong2e.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/mips/mips_fulong2e.c +1 -1
index ef02d54b33..f067fa9720 100644
@@ -69,7 +69,7 @@
  * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
  * in the "Compile Guide".
  */
-#define FULONG_BIOSNAME "pmon_fulong2e.bin"
+#define FULONG_BIOSNAME "pmon_2e.bin"
 
 /* PCI SLOT in fulong 2e */
 #define FULONG2E_VIA_SLOT        5
Signature · 1 line
2.21.3
#4 lore raw

Re: [PATCH 02/12] hw/mips/fuloong2e: Rename PMON BIOS name

Hi, Philippe,

Quoted 4 lines · Philippe Mathieu-Daudé

I'm not sure where 'pmon_fulong2e.bin' comes from. As I always found this bios named 'pmon_2e.bin', rename the definition.

The Fuloong BIOS doesn't integrated in QEMU, so its name can be anything. So, let's keep the old name (I think the old name more distsinguishable)?

Huacai

Quoted 22 lines
---
 hw/mips/mips_fulong2e.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/mips/mips_fulong2e.c +1 -2
index ef02d54b33..f067fa9720 100644
@@ -69,7 +69,7 @@
  * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
  * in the "Compile Guide".
  */
-#define FULONG_BIOSNAME "pmon_fulong2e.bin"
+#define FULONG_BIOSNAME "pmon_2e.bin"
 
 /* PCI SLOT in fulong 2e */
 #define FULONG2E_VIA_SLOT        5
--

2.21.3

Signature · 1 line
Huacai Chen
#5 lore raw

PATCH 3/12 hw/mips/fuloong2e: Move code and update a comment

In reply to Philippe Mathieu-Daudé

Move the RAM-related call closer to the RAM creation block, rename the ROM comment.

---
 hw/mips/mips_fulong2e.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
hw/mips/mips_fulong2e.c +2 -3
index f067fa9720..4e1a3646af 100644
@@ -316,12 +316,11 @@ static void mips_fulong2e_init(MachineState *machine)
         error_report("Invalid RAM size, should be 256MB");
         exit(EXIT_FAILURE);
     }
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* allocate RAM */
+    /* Boot ROM */
     memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
                            &error_fatal);
-
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
     memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
     /*
Signature · 1 line
2.21.3
Reviewed-by Huacai Chen on v1 3/12
#6 lore raw

Re: [PATCH 03/12] hw/mips/fuloong2e: Move code and update a comment

Quoted 32 lines · Philippe Mathieu-Daudé

Move the RAM-related call closer to the RAM creation block, rename the ROM comment.

---
 hw/mips/mips_fulong2e.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
hw/mips/mips_fulong2e.c +2 -4
index f067fa9720..4e1a3646af 100644
@@ -316,12 +316,11 @@ static void mips_fulong2e_init(MachineState *machine)
         error_report("Invalid RAM size, should be 256MB");
         exit(EXIT_FAILURE);
     }
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* allocate RAM */
+    /* Boot ROM */
     memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
                            &error_fatal);
-
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
     memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
     /*
--

2.21.3

Signature · 1 line
Huacai Chen
#7 lore raw

PATCH 4/12 hw/mips/fuloong2e: Fix typo in Fuloong machine name

In reply to Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

---
 docs/system/target-mips.rst              |  2 +-
 default-configs/mips64el-softmmu.mak     |  2 +-
 hw/isa/vt82c686.c                        |  2 +-
 hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------
 hw/pci-host/bonito.c                     |  8 ++---
 tests/qtest/endianness-test.c            |  2 +-
 MAINTAINERS                              |  4 +--
 hw/mips/Kconfig                          |  2 +-
 hw/mips/Makefile.objs                    |  2 +-
 9 files changed, 36 insertions(+), 34 deletions(-)
 rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)
docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
 -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
 -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
 include mips-softmmu-common.mak
 CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
 CONFIG_ATI_VGA=y
 CONFIG_RTL8139_PCI=y
 CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_via;
     /*
      * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
      */
     dc->user_creatable = false;
 }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22

115 lines not on this page · raw message

hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
  */
 
 /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
  */
 
 /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
     slot = (pci_dev->devfn >> 3);
 
     switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
         return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
         return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
         return 5 + BONITO_IRQ_BASE;
     case 8 ... 12: /* PCI slot 1 to 4 */
         return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
     { "mips64", "pica61", 0x90000000, .bswap = true },
     { "mips64", "mips", 0x14000000, .bswap = true },
     { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
     { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
     { "ppc", "40p", 0x80000000, .bswap = true },
     { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
 S: Obsolete
 F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
 M: Huacai Chen <[email protected]>
 M: Philippe Mathieu-Daudé <[email protected]>
 M: Aleksandar Markovic <[email protected]>
 R: Jiaxun Yang <[email protected]>
 S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
 F: hw/isa/vt82c686.c
 F: hw/pci-host/bonito.c
 F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
     select DS1225Y
     select JAZZ_LED
 
-config FULONG
+config FULOONG
     bool
 
 config MIPS_CPS
hw/mips/Makefile.objs +1 -1
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
 obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
 obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
 obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
 obj-$(CONFIG_MIPS_CPS) += cps.o
 obj-$(CONFIG_MIPS_BOSTON) += boston.o
Signature · 1 line
2.21.3
#8 lore raw

Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name

Hi, Philippe,

Quoted 5 lines · Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

Quoted 7 lines
---
 docs/system/target-mips.rst              |  2 +-
 default-configs/mips64el-softmmu.mak     |  2 +-
 hw/isa/vt82c686.c                        |  2 +-
 hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------

Use mips_fuloong2e.c instead of fuloong2e.c? Other machine file names also have a "mips_" prefix.

Huacai

Quoted 269 lines
 hw/pci-host/bonito.c                     |  8 ++---
 tests/qtest/endianness-test.c            |  2 +-
 MAINTAINERS                              |  4 +--
 hw/mips/Kconfig                          |  2 +-
 hw/mips/Makefile.objs                    |  2 +-
 9 files changed, 36 insertions(+), 34 deletions(-)
 rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)
docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
 -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
 -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
 include mips-softmmu-common.mak
 CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
 CONFIG_ATI_VGA=y
 CONFIG_RTL8139_PCI=y
 CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_via;
     /*
      * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
      */
     dc->user_creatable = false;
 }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22
similarity index 91%
rename from hw/mips/mips_fulong2e.c
rename to hw/mips/fuloong2e.c
index 4e1a3646af..624c46a4fd 100644
@@ -1,5 +1,5 @@
 /*
- * QEMU fulong 2e mini pc support
+ * QEMU fuloong 2e mini pc support
  *
  * Copyright (c) 2008 yajin ([email protected])
  * Copyright (c) 2009 chenming ([email protected])
@@ -11,8 +11,8 @@
  */
 
 /*
- * Fulong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
- * http://www.linux-mips.org/wiki/Fulong
+ * Fuloong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
+ * https://www.linux-mips.org/wiki/Fuloong_2E
  *
  * Loongson 2e user manual:
  * http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf
@@ -46,13 +46,13 @@
 #include "sysemu/reset.h"
 #include "qemu/error-report.h"
 
-#define DEBUG_FULONG2E_INIT
+#define DEBUG_FULOONG2E_INIT
 
 #define ENVP_ADDR               0x80002000l
 #define ENVP_NB_ENTRIES         16
 #define ENVP_ENTRY_SIZE         256
 
-/* fulong 2e has a 512k flash: Winbond W39L040AP70Z */
+/* Fuloong 2e has a 512k flash: Winbond W39L040AP70Z */
 #define BIOS_SIZE               (512 * KiB)
 #define MAX_IDE_BUS             2
 
@@ -69,12 +69,12 @@
  * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
  * in the "Compile Guide".
  */
-#define FULONG_BIOSNAME "pmon_2e.bin"
+#define FULOONG_BIOSNAME "pmon_2e.bin"
 
-/* PCI SLOT in fulong 2e */
-#define FULONG2E_VIA_SLOT        5
-#define FULONG2E_ATI_SLOT        6
-#define FULONG2E_RTL8139_SLOT    7
+/* PCI SLOT in Fuloong 2e */
+#define FULOONG2E_VIA_SLOT        5
+#define FULOONG2E_ATI_SLOT        6
+#define FULOONG2E_RTL8139_SLOT    7
 
 static struct _loaderparams {
     int ram_size;
@@ -279,7 +279,7 @@ static void network_init(PCIBus *pci_bus)
         const char *default_devaddr = NULL;
 
         if (i == 0 && (!nd->model || strcmp(nd->model, "rtl8139") == 0)) {
-            /* The fulong board has a RTL8139 card using PCI SLOT 7 */
+            /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */
             default_devaddr = "07";
         }
 
@@ -287,7 +287,7 @@ static void network_init(PCIBus *pci_bus)
     }
 }
 
-static void mips_fulong2e_init(MachineState *machine)
+static void mips_fuloong2e_init(MachineState *machine)
 {
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
@@ -316,11 +316,12 @@ static void mips_fulong2e_init(MachineState *machine)
         error_report("Invalid RAM size, should be 256MB");
         exit(EXIT_FAILURE);
     }
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* Boot ROM */
-    memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
+    /* allocate RAM */
+    memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE,
                            &error_fatal);
+
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
     memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
     /*
@@ -337,7 +338,7 @@ static void mips_fulong2e_init(MachineState *machine)
         write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
     } else {
         if (bios_name == NULL) {
-                bios_name = FULONG_BIOSNAME;
+                bios_name = FULOONG_BIOSNAME;
         }
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         if (filename) {
@@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine)
     pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
     /* South bridge -> IP5 */
-    vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
+    vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
                                &smbus, &isa_bus);
 
     /* GPU */
@@ -384,14 +385,15 @@ static void mips_fulong2e_init(MachineState *machine)
     network_init(pci_bus);
 }
 
-static void mips_fulong2e_machine_init(MachineClass *mc)
+static void mips_fuloong2e_machine_init(MachineClass *mc)
 {
-    mc->desc = "Fulong 2e mini pc";
-    mc->init = mips_fulong2e_init;
+    mc->desc = "Fuloong 2e mini pc";
+    mc->alias = "fulong2e";             /* Incorrect name used up to QEMU 4.2 */
+    mc->init = mips_fuloong2e_init;
     mc->block_default_type = IF_IDE;
     mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
     mc->default_ram_size = 256 * MiB;
-    mc->default_ram_id = "fulong2e.ram";
+    mc->default_ram_id = "fuloong2e.ram";
 }
 
-DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init)
+DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
  */
 
 /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
  */
 
 /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
     slot = (pci_dev->devfn >> 3);
 
     switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
         return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
         return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
         return 5 + BONITO_IRQ_BASE;
     case 8 ... 12: /* PCI slot 1 to 4 */
         return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
     { "mips64", "pica61", 0x90000000, .bswap = true },
     { "mips64", "mips", 0x14000000, .bswap = true },
     { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
     { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
     { "ppc", "40p", 0x80000000, .bswap = true },
     { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
 S: Obsolete
 F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
 M: Huacai Chen <[email protected]>
 M: Philippe Mathieu-Daudé <[email protected]>
 M: Aleksandar Markovic <[email protected]>
 R: Jiaxun Yang <[email protected]>
 S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
 F: hw/isa/vt82c686.c
 F: hw/pci-host/bonito.c
 F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
     select DS1225Y
     select JAZZ_LED
 
-config FULONG
+config FULOONG
     bool
 
 config MIPS_CPS
hw/mips/Makefile.objs +1 -2
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
 obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
 obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
 obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
 obj-$(CONFIG_MIPS_CPS) += cps.o
 obj-$(CONFIG_MIPS_BOSTON) += boston.o
--

2.21.3

Signature · 1 line
Huacai Chen
#9 lore raw

Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name

пон, 11. мај 2020. у 03:11 chen huacai <[email protected]> је написао/ла:

Quoted 16 lines

Hi, Philippe,

Quoted 5 lines · Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

Quoted 7 lines
---
 docs/system/target-mips.rst              |  2 +-
 default-configs/mips64el-softmmu.mak     |  2 +-
 hw/isa/vt82c686.c                        |  2 +-
 hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------
Quoted 3 lines

Use mips_fuloong2e.c instead of fuloong2e.c? Other machine file names also have a "mips_" prefix.

I would leave mips_ prefix for Fuloong, and actually add it to Boston source file, so that we are finally consistent across all MIPS machines.

What do you think?

Aleksandar

Quoted 274 lines

Huacai

Quoted 266 lines
 hw/pci-host/bonito.c                     |  8 ++---
 tests/qtest/endianness-test.c            |  2 +-
 MAINTAINERS                              |  4 +--
 hw/mips/Kconfig                          |  2 +-
 hw/mips/Makefile.objs                    |  2 +-
 9 files changed, 36 insertions(+), 34 deletions(-)
 rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)
docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
 -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
 -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
 include mips-softmmu-common.mak
 CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
 CONFIG_ATI_VGA=y
 CONFIG_RTL8139_PCI=y
 CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_via;
     /*
      * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
      */
     dc->user_creatable = false;
 }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22
similarity index 91%
rename from hw/mips/mips_fulong2e.c
rename to hw/mips/fuloong2e.c
index 4e1a3646af..624c46a4fd 100644
@@ -1,5 +1,5 @@
 /*
- * QEMU fulong 2e mini pc support
+ * QEMU fuloong 2e mini pc support
  *
  * Copyright (c) 2008 yajin ([email protected])
  * Copyright (c) 2009 chenming ([email protected])
@@ -11,8 +11,8 @@
  */
 
 /*
- * Fulong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
- * http://www.linux-mips.org/wiki/Fulong
+ * Fuloong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
+ * https://www.linux-mips.org/wiki/Fuloong_2E
  *
  * Loongson 2e user manual:
  * http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf
@@ -46,13 +46,13 @@
 #include "sysemu/reset.h"
 #include "qemu/error-report.h"
 
-#define DEBUG_FULONG2E_INIT
+#define DEBUG_FULOONG2E_INIT
 
 #define ENVP_ADDR               0x80002000l
 #define ENVP_NB_ENTRIES         16
 #define ENVP_ENTRY_SIZE         256
 
-/* fulong 2e has a 512k flash: Winbond W39L040AP70Z */
+/* Fuloong 2e has a 512k flash: Winbond W39L040AP70Z */
 #define BIOS_SIZE               (512 * KiB)
 #define MAX_IDE_BUS             2
 
@@ -69,12 +69,12 @@
  * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
  * in the "Compile Guide".
  */
-#define FULONG_BIOSNAME "pmon_2e.bin"
+#define FULOONG_BIOSNAME "pmon_2e.bin"
 
-/* PCI SLOT in fulong 2e */
-#define FULONG2E_VIA_SLOT        5
-#define FULONG2E_ATI_SLOT        6
-#define FULONG2E_RTL8139_SLOT    7
+/* PCI SLOT in Fuloong 2e */
+#define FULOONG2E_VIA_SLOT        5
+#define FULOONG2E_ATI_SLOT        6
+#define FULOONG2E_RTL8139_SLOT    7
 
 static struct _loaderparams {
     int ram_size;
@@ -279,7 +279,7 @@ static void network_init(PCIBus *pci_bus)
         const char *default_devaddr = NULL;
 
         if (i == 0 && (!nd->model || strcmp(nd->model, "rtl8139") == 0)) {
-            /* The fulong board has a RTL8139 card using PCI SLOT 7 */
+            /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */
             default_devaddr = "07";
         }
 
@@ -287,7 +287,7 @@ static void network_init(PCIBus *pci_bus)
     }
 }
 
-static void mips_fulong2e_init(MachineState *machine)
+static void mips_fuloong2e_init(MachineState *machine)
 {
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
@@ -316,11 +316,12 @@ static void mips_fulong2e_init(MachineState *machine)
         error_report("Invalid RAM size, should be 256MB");
         exit(EXIT_FAILURE);
     }
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* Boot ROM */
-    memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
+    /* allocate RAM */
+    memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE,
                            &error_fatal);
+
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
     memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
     /*
@@ -337,7 +338,7 @@ static void mips_fulong2e_init(MachineState *machine)
         write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
     } else {
         if (bios_name == NULL) {
-                bios_name = FULONG_BIOSNAME;
+                bios_name = FULOONG_BIOSNAME;
         }
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         if (filename) {
@@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine)
     pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
     /* South bridge -> IP5 */
-    vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
+    vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
                                &smbus, &isa_bus);
 
     /* GPU */
@@ -384,14 +385,15 @@ static void mips_fulong2e_init(MachineState *machine)
     network_init(pci_bus);
 }
 
-static void mips_fulong2e_machine_init(MachineClass *mc)
+static void mips_fuloong2e_machine_init(MachineClass *mc)
 {
-    mc->desc = "Fulong 2e mini pc";
-    mc->init = mips_fulong2e_init;
+    mc->desc = "Fuloong 2e mini pc";
+    mc->alias = "fulong2e";             /* Incorrect name used up to QEMU 4.2 */
+    mc->init = mips_fuloong2e_init;
     mc->block_default_type = IF_IDE;
     mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
     mc->default_ram_size = 256 * MiB;
-    mc->default_ram_id = "fulong2e.ram";
+    mc->default_ram_id = "fuloong2e.ram";
 }
 
-DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init)
+DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
  */
 
 /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
  */
 
 /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
     slot = (pci_dev->devfn >> 3);
 
     switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
         return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
         return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
         return 5 + BONITO_IRQ_BASE;
     case 8 ... 12: /* PCI slot 1 to 4 */
         return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
     { "mips64", "pica61", 0x90000000, .bswap = true },
     { "mips64", "mips", 0x14000000, .bswap = true },
     { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
     { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
     { "ppc", "40p", 0x80000000, .bswap = true },
     { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
 S: Obsolete
 F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
 M: Huacai Chen <[email protected]>
 M: Philippe Mathieu-Daudé <[email protected]>
 M: Aleksandar Markovic <[email protected]>
 R: Jiaxun Yang <[email protected]>
 S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
 F: hw/isa/vt82c686.c
 F: hw/pci-host/bonito.c
 F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
     select DS1225Y
     select JAZZ_LED
 
-config FULONG
+config FULOONG
     bool
 
 config MIPS_CPS
hw/mips/Makefile.objs +1 -2
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
 obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
 obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
 obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
 obj-$(CONFIG_MIPS_CPS) += cps.o
 obj-$(CONFIG_MIPS_BOSTON) += boston.o
--
Quoted 3 lines

2.21.3

--
Huacai Chen

#10 lore raw

Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name

Quoted 21 lines · Aleksandar Markovic

пон, 11. мај 2020. у 03:11 chen huacai <[email protected]> је написао/ла:

Quoted 16 lines

Hi, Philippe,

Quoted 5 lines · Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

Quoted 7 lines
---
  docs/system/target-mips.rst              |  2 +-
  default-configs/mips64el-softmmu.mak     |  2 +-
  hw/isa/vt82c686.c                        |  2 +-
  hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------
Quoted 3 lines

Use mips_fuloong2e.c instead of fuloong2e.c? Other machine file names also have a "mips_" prefix.

Quoted 5 lines

I would leave mips_ prefix for Fuloong, and actually add it to Boston source file, so that we are finally consistent across all MIPS machines.

What do you think?

These names were used years ago when all hardware was in the same hw/ directory, not sorted per target. Now new machines don't use the target as prefix name. I'd clean the other way around, and dropping the 'mips_' prefix. The positive side is we can 5 more characters to better describe a patch while limited by the 72 chars in the subject :)

Quoted 278 lines

Aleksandar

Quoted 274 lines

Huacai

Quoted 266 lines
  hw/pci-host/bonito.c                     |  8 ++---
  tests/qtest/endianness-test.c            |  2 +-
  MAINTAINERS                              |  4 +--
  hw/mips/Kconfig                          |  2 +-
  hw/mips/Makefile.objs                    |  2 +-
  9 files changed, 36 insertions(+), 34 deletions(-)

rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)

docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
  -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
  -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
  include mips-softmmu-common.mak
  CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
  CONFIG_ATI_VGA=y
  CONFIG_RTL8139_PCI=y
  CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
      dc->vmsd = &vmstate_via;
      /*
       * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
       */
      dc->user_creatable = false;
  }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22
similarity index 91%
rename from hw/mips/mips_fulong2e.c
rename to hw/mips/fuloong2e.c
index 4e1a3646af..624c46a4fd 100644
@@ -1,5 +1,5 @@
  /*
- * QEMU fulong 2e mini pc support
+ * QEMU fuloong 2e mini pc support
   *
   * Copyright (c) 2008 yajin ([email protected])
   * Copyright (c) 2009 chenming ([email protected])
@@ -11,8 +11,8 @@
   */
 
  /*
- * Fulong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
- * http://www.linux-mips.org/wiki/Fulong
+ * Fuloong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
+ * https://www.linux-mips.org/wiki/Fuloong_2E
   *
   * Loongson 2e user manual:
   * http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf
@@ -46,13 +46,13 @@
  #include "sysemu/reset.h"
  #include "qemu/error-report.h"
 
-#define DEBUG_FULONG2E_INIT
+#define DEBUG_FULOONG2E_INIT
 
  #define ENVP_ADDR               0x80002000l
  #define ENVP_NB_ENTRIES         16
  #define ENVP_ENTRY_SIZE         256
 
-/* fulong 2e has a 512k flash: Winbond W39L040AP70Z */
+/* Fuloong 2e has a 512k flash: Winbond W39L040AP70Z */
  #define BIOS_SIZE               (512 * KiB)
  #define MAX_IDE_BUS             2
 
@@ -69,12 +69,12 @@
   * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
   * in the "Compile Guide".
   */
-#define FULONG_BIOSNAME "pmon_2e.bin"
+#define FULOONG_BIOSNAME "pmon_2e.bin"
 
-/* PCI SLOT in fulong 2e */
-#define FULONG2E_VIA_SLOT        5
-#define FULONG2E_ATI_SLOT        6
-#define FULONG2E_RTL8139_SLOT    7
+/* PCI SLOT in Fuloong 2e */
+#define FULOONG2E_VIA_SLOT        5
+#define FULOONG2E_ATI_SLOT        6
+#define FULOONG2E_RTL8139_SLOT    7
 
  static struct _loaderparams {
      int ram_size;
@@ -279,7 +279,7 @@ static void network_init(PCIBus *pci_bus)
          const char *default_devaddr = NULL;
 
          if (i == 0 && (!nd->model || strcmp(nd->model, "rtl8139") == 0)) {
-            /* The fulong board has a RTL8139 card using PCI SLOT 7 */
+            /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */
              default_devaddr = "07";
          }
 
@@ -287,7 +287,7 @@ static void network_init(PCIBus *pci_bus)
      }
  }
 
-static void mips_fulong2e_init(MachineState *machine)
+static void mips_fuloong2e_init(MachineState *machine)
  {
      const char *kernel_filename = machine->kernel_filename;
      const char *kernel_cmdline = machine->kernel_cmdline;
@@ -316,11 +316,12 @@ static void mips_fulong2e_init(MachineState *machine)
          error_report("Invalid RAM size, should be 256MB");
          exit(EXIT_FAILURE);
      }
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* Boot ROM */
-    memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
+    /* allocate RAM */
+    memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE,
                             &error_fatal);
+
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
      memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
      /*
@@ -337,7 +338,7 @@ static void mips_fulong2e_init(MachineState *machine)
          write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
      } else {
          if (bios_name == NULL) {
-                bios_name = FULONG_BIOSNAME;
+                bios_name = FULOONG_BIOSNAME;
          }
          filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
          if (filename) {
@@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine)
      pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
      /* South bridge -> IP5 */
-    vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
+    vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
                                 &smbus, &isa_bus);
 
      /* GPU */
@@ -384,14 +385,15 @@ static void mips_fulong2e_init(MachineState *machine)
      network_init(pci_bus);
  }
 
-static void mips_fulong2e_machine_init(MachineClass *mc)
+static void mips_fuloong2e_machine_init(MachineClass *mc)
  {
-    mc->desc = "Fulong 2e mini pc";
-    mc->init = mips_fulong2e_init;
+    mc->desc = "Fuloong 2e mini pc";
+    mc->alias = "fulong2e";             /* Incorrect name used up to QEMU 4.2 */
+    mc->init = mips_fuloong2e_init;
      mc->block_default_type = IF_IDE;
      mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
      mc->default_ram_size = 256 * MiB;
-    mc->default_ram_id = "fulong2e.ram";
+    mc->default_ram_id = "fuloong2e.ram";
  }
 
-DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init)
+DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
   */
 
  /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
   */
 
  /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
      slot = (pci_dev->devfn >> 3);
 
      switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
          return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
          return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
          return 5 + BONITO_IRQ_BASE;
      case 8 ... 12: /* PCI slot 1 to 4 */
          return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
      { "mips64", "pica61", 0x90000000, .bswap = true },
      { "mips64", "mips", 0x14000000, .bswap = true },
      { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
      { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
      { "ppc", "40p", 0x80000000, .bswap = true },
      { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
  S: Obsolete
  F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
  M: Huacai Chen <[email protected]>
  M: Philippe Mathieu-Daudé <[email protected]>
  M: Aleksandar Markovic <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
  F: hw/isa/vt82c686.c
  F: hw/pci-host/bonito.c
  F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
      select DS1225Y
      select JAZZ_LED
 
-config FULONG
+config FULOONG
      bool
 
  config MIPS_CPS
hw/mips/Makefile.objs +1 -2
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
  obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
  obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
  obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
  obj-$(CONFIG_MIPS_CPS) += cps.o
  obj-$(CONFIG_MIPS_BOSTON) += boston.o
--
Quoted 3 lines

2.21.3

--
Huacai Chen

#11 lore raw

Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name

Hi, Philippe and Alexandar,

Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Aleksandar Markovic

пон, 11. мај 2020. у 03:11 chen huacai <[email protected]> је написао/ла:

Quoted 16 lines

Hi, Philippe,

Quoted 5 lines · Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

Quoted 7 lines
---
  docs/system/target-mips.rst              |  2 +-
  default-configs/mips64el-softmmu.mak     |  2 +-
  hw/isa/vt82c686.c                        |  2 +-
  hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------
Quoted 3 lines

Use mips_fuloong2e.c instead of fuloong2e.c? Other machine file names also have a "mips_" prefix.

I would leave mips_ prefix for Fuloong, and actually add it to Boston source file, so that we are finally consistent across all MIPS machines.

Quoted 7 lines
Quoted 1 line

What do you think?

These names were used years ago when all hardware was in the same hw/ directory, not sorted per target. Now new machines don't use the target as prefix name. I'd clean the other way around, and dropping the 'mips_' prefix. The positive side is we can 5 more characters to better describe a patch while limited by the 72 chars in the subject :)

All having the prefix, or all dropping the prefix, are both good for me, just keep consistency.

Huacai

Quoted 279 lines
Quoted 279 lines

Aleksandar

Quoted 274 lines

Huacai

Quoted 266 lines
  hw/pci-host/bonito.c                     |  8 ++---
  tests/qtest/endianness-test.c            |  2 +-
  MAINTAINERS                              |  4 +--
  hw/mips/Kconfig                          |  2 +-
  hw/mips/Makefile.objs                    |  2 +-
  9 files changed, 36 insertions(+), 34 deletions(-)

rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)

docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
  -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
  -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
  include mips-softmmu-common.mak
  CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
  CONFIG_ATI_VGA=y
  CONFIG_RTL8139_PCI=y
  CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
      dc->vmsd = &vmstate_via;
      /*
       * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
       */
      dc->user_creatable = false;
  }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22
similarity index 91%
rename from hw/mips/mips_fulong2e.c
rename to hw/mips/fuloong2e.c
index 4e1a3646af..624c46a4fd 100644
@@ -1,5 +1,5 @@
  /*
- * QEMU fulong 2e mini pc support
+ * QEMU fuloong 2e mini pc support
   *
   * Copyright (c) 2008 yajin ([email protected])
   * Copyright (c) 2009 chenming ([email protected])
@@ -11,8 +11,8 @@
   */
 
  /*
- * Fulong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
- * http://www.linux-mips.org/wiki/Fulong
+ * Fuloong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
+ * https://www.linux-mips.org/wiki/Fuloong_2E
   *
   * Loongson 2e user manual:
   * http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf
@@ -46,13 +46,13 @@
  #include "sysemu/reset.h"
  #include "qemu/error-report.h"
 
-#define DEBUG_FULONG2E_INIT
+#define DEBUG_FULOONG2E_INIT
 
  #define ENVP_ADDR               0x80002000l
  #define ENVP_NB_ENTRIES         16
  #define ENVP_ENTRY_SIZE         256
 
-/* fulong 2e has a 512k flash: Winbond W39L040AP70Z */
+/* Fuloong 2e has a 512k flash: Winbond W39L040AP70Z */
  #define BIOS_SIZE               (512 * KiB)
  #define MAX_IDE_BUS             2
 
@@ -69,12 +69,12 @@
   * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
   * in the "Compile Guide".
   */
-#define FULONG_BIOSNAME "pmon_2e.bin"
+#define FULOONG_BIOSNAME "pmon_2e.bin"
 
-/* PCI SLOT in fulong 2e */
-#define FULONG2E_VIA_SLOT        5
-#define FULONG2E_ATI_SLOT        6
-#define FULONG2E_RTL8139_SLOT    7
+/* PCI SLOT in Fuloong 2e */
+#define FULOONG2E_VIA_SLOT        5
+#define FULOONG2E_ATI_SLOT        6
+#define FULOONG2E_RTL8139_SLOT    7
 
  static struct _loaderparams {
      int ram_size;
@@ -279,7 +279,7 @@ static void network_init(PCIBus *pci_bus)
          const char *default_devaddr = NULL;
 
          if (i == 0 && (!nd->model || strcmp(nd->model, "rtl8139") == 0)) {
-            /* The fulong board has a RTL8139 card using PCI SLOT 7 */
+            /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */
              default_devaddr = "07";
          }
 
@@ -287,7 +287,7 @@ static void network_init(PCIBus *pci_bus)
      }
  }
 
-static void mips_fulong2e_init(MachineState *machine)
+static void mips_fuloong2e_init(MachineState *machine)
  {
      const char *kernel_filename = machine->kernel_filename;
      const char *kernel_cmdline = machine->kernel_cmdline;
@@ -316,11 +316,12 @@ static void mips_fulong2e_init(MachineState *machine)
          error_report("Invalid RAM size, should be 256MB");
          exit(EXIT_FAILURE);
      }
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* Boot ROM */
-    memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
+    /* allocate RAM */
+    memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE,
                             &error_fatal);
+
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
      memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
      /*
@@ -337,7 +338,7 @@ static void mips_fulong2e_init(MachineState *machine)
          write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
      } else {
          if (bios_name == NULL) {
-                bios_name = FULONG_BIOSNAME;
+                bios_name = FULOONG_BIOSNAME;
          }
          filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
          if (filename) {
@@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine)
      pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
      /* South bridge -> IP5 */
-    vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
+    vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
                                 &smbus, &isa_bus);
 
      /* GPU */
@@ -384,14 +385,15 @@ static void mips_fulong2e_init(MachineState *machine)
      network_init(pci_bus);
  }
 
-static void mips_fulong2e_machine_init(MachineClass *mc)
+static void mips_fuloong2e_machine_init(MachineClass *mc)
  {
-    mc->desc = "Fulong 2e mini pc";
-    mc->init = mips_fulong2e_init;
+    mc->desc = "Fuloong 2e mini pc";
+    mc->alias = "fulong2e";             /* Incorrect name used up to QEMU 4.2 */
+    mc->init = mips_fuloong2e_init;
      mc->block_default_type = IF_IDE;
      mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
      mc->default_ram_size = 256 * MiB;
-    mc->default_ram_id = "fulong2e.ram";
+    mc->default_ram_id = "fuloong2e.ram";
  }
 
-DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init)
+DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
   */
 
  /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
   */
 
  /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
      slot = (pci_dev->devfn >> 3);
 
      switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
          return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
          return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
          return 5 + BONITO_IRQ_BASE;
      case 8 ... 12: /* PCI slot 1 to 4 */
          return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
      { "mips64", "pica61", 0x90000000, .bswap = true },
      { "mips64", "mips", 0x14000000, .bswap = true },
      { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
      { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
      { "ppc", "40p", 0x80000000, .bswap = true },
      { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
  S: Obsolete
  F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
  M: Huacai Chen <[email protected]>
  M: Philippe Mathieu-Daudé <[email protected]>
  M: Aleksandar Markovic <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
  F: hw/isa/vt82c686.c
  F: hw/pci-host/bonito.c
  F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
      select DS1225Y
      select JAZZ_LED
 
-config FULONG
+config FULOONG
      bool
 
  config MIPS_CPS
hw/mips/Makefile.objs +1 -2
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
  obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
  obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
  obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
  obj-$(CONFIG_MIPS_CPS) += cps.o
  obj-$(CONFIG_MIPS_BOSTON) += boston.o
--
Quoted 3 lines

2.21.3

--
Huacai Chen

Signature · 1 line
Huacai Chen
#12 lore raw

Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name

пон, 11. мај 2020. у 08:52 chen huacai <[email protected]> је написао/ла:

Quoted 39 lines

Hi, Philippe and Alexandar,

Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Aleksandar Markovic

пон, 11. мај 2020. у 03:11 chen huacai <[email protected]> је написао/ла:

Quoted 16 lines

Hi, Philippe,

Quoted 5 lines · Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

Quoted 7 lines
---
  docs/system/target-mips.rst              |  2 +-
  default-configs/mips64el-softmmu.mak     |  2 +-
  hw/isa/vt82c686.c                        |  2 +-
  hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------
Quoted 3 lines

Use mips_fuloong2e.c instead of fuloong2e.c? Other machine file names also have a "mips_" prefix.

I would leave mips_ prefix for Fuloong, and actually add it to Boston source file, so that we are finally consistent across all MIPS machines.

Quoted 7 lines
Quoted 1 line

What do you think?

These names were used years ago when all hardware was in the same hw/ directory, not sorted per target. Now new machines don't use the target as prefix name. I'd clean the other way around, and dropping the 'mips_' prefix. The positive side is we can 5 more characters to better describe a patch while limited by the 72 chars in the subject :)

Quoted 5 lines

All having the prefix, or all dropping the prefix, are both good for me, just keep consistency.

Huacai

Philippe, Huacai,

Prefix or not, I have mixed feelings. I had consistency more in mind than prefix.

So it seems the prevailing opinion is slightly on the side of dropping prefix "mips_".

Philippe, if it is not too difficult, could you perhaps make dropping that prefix for all source file names in hw/mips a part of the this series (not to complicate situation with a separate series) in its follow-up version (but perhaps keep that change(s) in separate patch(es))?

Sincerely,
Aleksandar

Quoted 284 lines
Quoted 271 lines
Quoted 271 lines

Aleksandar

Quoted 267 lines

Huacai

Quoted 266 lines
  hw/pci-host/bonito.c                     |  8 ++---
  tests/qtest/endianness-test.c            |  2 +-
  MAINTAINERS                              |  4 +--
  hw/mips/Kconfig                          |  2 +-
  hw/mips/Makefile.objs                    |  2 +-
  9 files changed, 36 insertions(+), 34 deletions(-)

rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)

docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
  -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
  -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
  include mips-softmmu-common.mak
  CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
  CONFIG_ATI_VGA=y
  CONFIG_RTL8139_PCI=y
  CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
      dc->vmsd = &vmstate_via;
      /*
       * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
       */
      dc->user_creatable = false;
  }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22
similarity index 91%
rename from hw/mips/mips_fulong2e.c
rename to hw/mips/fuloong2e.c
index 4e1a3646af..624c46a4fd 100644
@@ -1,5 +1,5 @@
  /*
- * QEMU fulong 2e mini pc support
+ * QEMU fuloong 2e mini pc support
   *
   * Copyright (c) 2008 yajin ([email protected])
   * Copyright (c) 2009 chenming ([email protected])
@@ -11,8 +11,8 @@
   */
 
  /*
- * Fulong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
- * http://www.linux-mips.org/wiki/Fulong
+ * Fuloong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
+ * https://www.linux-mips.org/wiki/Fuloong_2E
   *
   * Loongson 2e user manual:
   * http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf
@@ -46,13 +46,13 @@
  #include "sysemu/reset.h"
  #include "qemu/error-report.h"
 
-#define DEBUG_FULONG2E_INIT
+#define DEBUG_FULOONG2E_INIT
 
  #define ENVP_ADDR               0x80002000l
  #define ENVP_NB_ENTRIES         16
  #define ENVP_ENTRY_SIZE         256
 
-/* fulong 2e has a 512k flash: Winbond W39L040AP70Z */
+/* Fuloong 2e has a 512k flash: Winbond W39L040AP70Z */
  #define BIOS_SIZE               (512 * KiB)
  #define MAX_IDE_BUS             2
 
@@ -69,12 +69,12 @@
   * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
   * in the "Compile Guide".
   */
-#define FULONG_BIOSNAME "pmon_2e.bin"
+#define FULOONG_BIOSNAME "pmon_2e.bin"
 
-/* PCI SLOT in fulong 2e */
-#define FULONG2E_VIA_SLOT        5
-#define FULONG2E_ATI_SLOT        6
-#define FULONG2E_RTL8139_SLOT    7
+/* PCI SLOT in Fuloong 2e */
+#define FULOONG2E_VIA_SLOT        5
+#define FULOONG2E_ATI_SLOT        6
+#define FULOONG2E_RTL8139_SLOT    7
 
  static struct _loaderparams {
      int ram_size;
@@ -279,7 +279,7 @@ static void network_init(PCIBus *pci_bus)
          const char *default_devaddr = NULL;
 
          if (i == 0 && (!nd->model || strcmp(nd->model, "rtl8139") == 0)) {
-            /* The fulong board has a RTL8139 card using PCI SLOT 7 */
+            /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */
              default_devaddr = "07";
          }
 
@@ -287,7 +287,7 @@ static void network_init(PCIBus *pci_bus)
      }
  }
 
-static void mips_fulong2e_init(MachineState *machine)
+static void mips_fuloong2e_init(MachineState *machine)
  {
      const char *kernel_filename = machine->kernel_filename;
      const char *kernel_cmdline = machine->kernel_cmdline;
@@ -316,11 +316,12 @@ static void mips_fulong2e_init(MachineState *machine)
          error_report("Invalid RAM size, should be 256MB");
          exit(EXIT_FAILURE);
      }
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* Boot ROM */
-    memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
+    /* allocate RAM */
+    memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE,
                             &error_fatal);
+
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
      memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
      /*
@@ -337,7 +338,7 @@ static void mips_fulong2e_init(MachineState *machine)
          write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
      } else {
          if (bios_name == NULL) {
-                bios_name = FULONG_BIOSNAME;
+                bios_name = FULOONG_BIOSNAME;
          }
          filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
          if (filename) {
@@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine)
      pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
      /* South bridge -> IP5 */
-    vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
+    vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
                                 &smbus, &isa_bus);
 
      /* GPU */
@@ -384,14 +385,15 @@ static void mips_fulong2e_init(MachineState *machine)
      network_init(pci_bus);
  }
 
-static void mips_fulong2e_machine_init(MachineClass *mc)
+static void mips_fuloong2e_machine_init(MachineClass *mc)
  {
-    mc->desc = "Fulong 2e mini pc";
-    mc->init = mips_fulong2e_init;
+    mc->desc = "Fuloong 2e mini pc";
+    mc->alias = "fulong2e";             /* Incorrect name used up to QEMU 4.2 */
+    mc->init = mips_fuloong2e_init;
      mc->block_default_type = IF_IDE;
      mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
      mc->default_ram_size = 256 * MiB;
-    mc->default_ram_id = "fulong2e.ram";
+    mc->default_ram_id = "fuloong2e.ram";
  }
 
-DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init)
+DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
   */
 
  /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
   */
 
  /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
      slot = (pci_dev->devfn >> 3);
 
      switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
          return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
          return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
          return 5 + BONITO_IRQ_BASE;
      case 8 ... 12: /* PCI slot 1 to 4 */
          return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
      { "mips64", "pica61", 0x90000000, .bswap = true },
      { "mips64", "mips", 0x14000000, .bswap = true },
      { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
      { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
      { "ppc", "40p", 0x80000000, .bswap = true },
      { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
  S: Obsolete
  F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
  M: Huacai Chen <[email protected]>
  M: Philippe Mathieu-Daudé <[email protected]>
  M: Aleksandar Markovic <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
  F: hw/isa/vt82c686.c
  F: hw/pci-host/bonito.c
  F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
      select DS1225Y
      select JAZZ_LED
 
-config FULONG
+config FULOONG
      bool
 
  config MIPS_CPS
hw/mips/Makefile.objs +1 -2
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
  obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
  obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
  obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
  obj-$(CONFIG_MIPS_CPS) += cps.o
  obj-$(CONFIG_MIPS_BOSTON) += boston.o
--
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

2.21.3

--
Huacai Chen

--
Huacai Chen

#13 lore raw

Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name

пон, 11. мај 2020. у 10:12 Aleksandar Markovic
<[email protected]> је написао/ла:

Quoted 52 lines

пон, 11. мај 2020. у 08:52 chen huacai <[email protected]> је написао/ла:

Quoted 39 lines

Hi, Philippe and Alexandar,

Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Aleksandar Markovic

пон, 11. мај 2020. у 03:11 chen huacai <[email protected]> је написао/ла:

Quoted 16 lines

Hi, Philippe,

Quoted 5 lines · Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

Quoted 7 lines
---
  docs/system/target-mips.rst              |  2 +-
  default-configs/mips64el-softmmu.mak     |  2 +-
  hw/isa/vt82c686.c                        |  2 +-
  hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------
Quoted 3 lines

Use mips_fuloong2e.c instead of fuloong2e.c? Other machine file names also have a "mips_" prefix.

I would leave mips_ prefix for Fuloong, and actually add it to Boston source file, so that we are finally consistent across all MIPS machines.

Quoted 7 lines
Quoted 1 line

What do you think?

These names were used years ago when all hardware was in the same hw/ directory, not sorted per target. Now new machines don't use the target as prefix name. I'd clean the other way around, and dropping the 'mips_' prefix. The positive side is we can 5 more characters to better describe a patch while limited by the 72 chars in the subject :)

Quoted 5 lines

All having the prefix, or all dropping the prefix, are both good for me, just keep consistency.

Huacai

Philippe, Huacai,

Prefix or not, I have mixed feelings. I had consistency more in mind than prefix.

Quoted 9 lines

So it seems the prevailing opinion is slightly on the side of dropping prefix "mips_".

Philippe, if it is not too difficult, could you perhaps make dropping that prefix for all source file names in hw/mips a part of the this series (not to complicate situation with a separate series) in its follow-up version (but perhaps keep that change(s) in separate patch(es))?

Conveniently enough, most of involved files do not have checkpatch warnings and errors:

$ ../../scripts/checkpatch.pl --strict -f ./mips_fulong2e.c
total: 0 errors, 0 warnings, 404 lines checked

./mips_fulong2e.c has no obvious style problems and is ready for submission.

$ ../../scripts/checkpatch.pl --strict -f ./mips_malta.c
ERROR: if this code is redundant consider removing it
#430: FILE: ./mips_malta.c:430:
+#if 0

ERROR: if this code is redundant consider removing it #518: FILE: ./mips_malta.c:518:
+#if 0

total: 2 errors, 0 warnings, 1458 lines checked

./mips_malta.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

$ ../../scripts/checkpatch.pl --strict -f ./mips_mipssim.c
total: 0 errors, 0 warnings, 246 lines checked

./mips_mipssim.c has no obvious style problems and is ready for submission.

$ ../../scripts/checkpatch.pl --strict -f ./mips_r4k.c
total: 0 errors, 0 warnings, 318 lines checked

./mips_r4k.c has no obvious style problems and is ready for submission.

Maybe we should also finally get rid of these segments in mips_malta.c:

#if 0
        printf("malta_fpga_read: Bad register offset 0x" TARGET_FMT_lx "\n",
               addr);

#endif

and

#if 0
        printf("malta_fpga_write: Bad register offset 0x" TARGET_FMT_lx "\n",
               addr);

#endif

possibly replacing them with some logging?

Philippe?

Thanks,
Aleksandar

Quoted 287 lines

Sincerely,
Aleksandar

Quoted 284 lines
Quoted 271 lines
Quoted 271 lines

Aleksandar

Quoted 267 lines

Huacai

Quoted 266 lines
  hw/pci-host/bonito.c                     |  8 ++---
  tests/qtest/endianness-test.c            |  2 +-
  MAINTAINERS                              |  4 +--
  hw/mips/Kconfig                          |  2 +-
  hw/mips/Makefile.objs                    |  2 +-
  9 files changed, 36 insertions(+), 34 deletions(-)

rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)

docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
  -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
  -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
  include mips-softmmu-common.mak
  CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
  CONFIG_ATI_VGA=y
  CONFIG_RTL8139_PCI=y
  CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
      dc->vmsd = &vmstate_via;
      /*
       * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
       */
      dc->user_creatable = false;
  }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22
similarity index 91%
rename from hw/mips/mips_fulong2e.c
rename to hw/mips/fuloong2e.c
index 4e1a3646af..624c46a4fd 100644
@@ -1,5 +1,5 @@
  /*
- * QEMU fulong 2e mini pc support
+ * QEMU fuloong 2e mini pc support
   *
   * Copyright (c) 2008 yajin ([email protected])
   * Copyright (c) 2009 chenming ([email protected])
@@ -11,8 +11,8 @@
   */
 
  /*
- * Fulong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
- * http://www.linux-mips.org/wiki/Fulong
+ * Fuloong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
+ * https://www.linux-mips.org/wiki/Fuloong_2E
   *
   * Loongson 2e user manual:
   * http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf
@@ -46,13 +46,13 @@
  #include "sysemu/reset.h"
  #include "qemu/error-report.h"
 
-#define DEBUG_FULONG2E_INIT
+#define DEBUG_FULOONG2E_INIT
 
  #define ENVP_ADDR               0x80002000l
  #define ENVP_NB_ENTRIES         16
  #define ENVP_ENTRY_SIZE         256
 
-/* fulong 2e has a 512k flash: Winbond W39L040AP70Z */
+/* Fuloong 2e has a 512k flash: Winbond W39L040AP70Z */
  #define BIOS_SIZE               (512 * KiB)
  #define MAX_IDE_BUS             2
 
@@ -69,12 +69,12 @@
   * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
   * in the "Compile Guide".
   */
-#define FULONG_BIOSNAME "pmon_2e.bin"
+#define FULOONG_BIOSNAME "pmon_2e.bin"
 
-/* PCI SLOT in fulong 2e */
-#define FULONG2E_VIA_SLOT        5
-#define FULONG2E_ATI_SLOT        6
-#define FULONG2E_RTL8139_SLOT    7
+/* PCI SLOT in Fuloong 2e */
+#define FULOONG2E_VIA_SLOT        5
+#define FULOONG2E_ATI_SLOT        6
+#define FULOONG2E_RTL8139_SLOT    7
 
  static struct _loaderparams {
      int ram_size;
@@ -279,7 +279,7 @@ static void network_init(PCIBus *pci_bus)
          const char *default_devaddr = NULL;
 
          if (i == 0 && (!nd->model || strcmp(nd->model, "rtl8139") == 0)) {
-            /* The fulong board has a RTL8139 card using PCI SLOT 7 */
+            /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */
              default_devaddr = "07";
          }
 
@@ -287,7 +287,7 @@ static void network_init(PCIBus *pci_bus)
      }
  }
 
-static void mips_fulong2e_init(MachineState *machine)
+static void mips_fuloong2e_init(MachineState *machine)
  {
      const char *kernel_filename = machine->kernel_filename;
      const char *kernel_cmdline = machine->kernel_cmdline;
@@ -316,11 +316,12 @@ static void mips_fulong2e_init(MachineState *machine)
          error_report("Invalid RAM size, should be 256MB");
          exit(EXIT_FAILURE);
      }
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* Boot ROM */
-    memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
+    /* allocate RAM */
+    memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE,
                             &error_fatal);
+
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
      memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
      /*
@@ -337,7 +338,7 @@ static void mips_fulong2e_init(MachineState *machine)
          write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
      } else {
          if (bios_name == NULL) {
-                bios_name = FULONG_BIOSNAME;
+                bios_name = FULOONG_BIOSNAME;
          }
          filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
          if (filename) {
@@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine)
      pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
      /* South bridge -> IP5 */
-    vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
+    vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
                                 &smbus, &isa_bus);
 
      /* GPU */
@@ -384,14 +385,15 @@ static void mips_fulong2e_init(MachineState *machine)
      network_init(pci_bus);
  }
 
-static void mips_fulong2e_machine_init(MachineClass *mc)
+static void mips_fuloong2e_machine_init(MachineClass *mc)
  {
-    mc->desc = "Fulong 2e mini pc";
-    mc->init = mips_fulong2e_init;
+    mc->desc = "Fuloong 2e mini pc";
+    mc->alias = "fulong2e";             /* Incorrect name used up to QEMU 4.2 */
+    mc->init = mips_fuloong2e_init;
      mc->block_default_type = IF_IDE;
      mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
      mc->default_ram_size = 256 * MiB;
-    mc->default_ram_id = "fulong2e.ram";
+    mc->default_ram_id = "fuloong2e.ram";
  }
 
-DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init)
+DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
   */
 
  /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
   */
 
  /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
      slot = (pci_dev->devfn >> 3);
 
      switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
          return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
          return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
          return 5 + BONITO_IRQ_BASE;
      case 8 ... 12: /* PCI slot 1 to 4 */
          return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
      { "mips64", "pica61", 0x90000000, .bswap = true },
      { "mips64", "mips", 0x14000000, .bswap = true },
      { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
      { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
      { "ppc", "40p", 0x80000000, .bswap = true },
      { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
  S: Obsolete
  F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
  M: Huacai Chen <[email protected]>
  M: Philippe Mathieu-Daudé <[email protected]>
  M: Aleksandar Markovic <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
  F: hw/isa/vt82c686.c
  F: hw/pci-host/bonito.c
  F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
      select DS1225Y
      select JAZZ_LED
 
-config FULONG
+config FULOONG
      bool
 
  config MIPS_CPS
hw/mips/Makefile.objs +1 -2
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
  obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
  obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
  obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
  obj-$(CONFIG_MIPS_CPS) += cps.o
  obj-$(CONFIG_MIPS_BOSTON) += boston.o
--
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

2.21.3

--
Huacai Chen

--
Huacai Chen

#14 lore raw

Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name

Quoted 62 lines · Aleksandar Markovic

пон, 11. мај 2020. у 10:12 Aleksandar Markovic
<[email protected]> је написао/ла:

Quoted 60 lines

пон, 11. мај 2020. у 08:52 chen huacai <[email protected]> је написао/ла:

Quoted 39 lines

Hi, Philippe and Alexandar,

Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Aleksandar Markovic

пон, 11. мај 2020. у 03:11 chen huacai <[email protected]> је написао/ла:

Quoted 16 lines

Hi, Philippe,

Quoted 5 lines · Philippe Mathieu-Daudé

We always miswrote the Fuloong machine... Fix its name. Add an machine alias to the previous name for backward compatibility.

Quoted 7 lines
---
   docs/system/target-mips.rst              |  2 +-
   default-configs/mips64el-softmmu.mak     |  2 +-
   hw/isa/vt82c686.c                        |  2 +-
   hw/mips/{mips_fulong2e.c => fuloong2e.c} | 46 ++++++++++++------------
Quoted 3 lines

Use mips_fuloong2e.c instead of fuloong2e.c? Other machine file names also have a "mips_" prefix.

I would leave mips_ prefix for Fuloong, and actually add it to Boston source file, so that we are finally consistent across all MIPS machines.

Quoted 7 lines
Quoted 1 line

What do you think?

These names were used years ago when all hardware was in the same hw/ directory, not sorted per target. Now new machines don't use the target as prefix name. I'd clean the other way around, and dropping the 'mips_' prefix. The positive side is we can 5 more characters to better describe a patch while limited by the 72 chars in the subject :)

Quoted 5 lines

All having the prefix, or all dropping the prefix, are both good for me, just keep consistency.

Huacai

Philippe, Huacai,

Prefix or not, I have mixed feelings. I had consistency more in mind than prefix.

So it seems the prevailing opinion is slightly on the side of dropping prefix "mips_".

Philippe, if it is not too difficult, could you perhaps make dropping that prefix for all source file names in hw/mips a part of the this series (not to complicate situation with a separate series) in its follow-up version (but perhaps keep that change(s) in separate patch(es))?

Certainly not difficult, but I won't take that as a priority.
I already spend more time trying to document better the MIPS commits, as it is important to you, and it also serves the community. Regarding unifying the file names I don't care much, so I'll not rename this file to stop bikeshredding on futile topics and keep focus on the technical changes of the patches.

Quoted 40 lines
Quoted 1 line

Conveniently enough, most of involved files do not have checkpatch warnings and errors:

$ ../../scripts/checkpatch.pl --strict -f ./mips_fulong2e.c
total: 0 errors, 0 warnings, 404 lines checked

./mips_fulong2e.c has no obvious style problems and is ready for submission.

$ ../../scripts/checkpatch.pl --strict -f ./mips_malta.c
ERROR: if this code is redundant consider removing it
#430: FILE: ./mips_malta.c:430:
+#if 0

ERROR: if this code is redundant consider removing it #518: FILE: ./mips_malta.c:518:
+#if 0

total: 2 errors, 0 warnings, 1458 lines checked

./mips_malta.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

$ ../../scripts/checkpatch.pl --strict -f ./mips_mipssim.c
total: 0 errors, 0 warnings, 246 lines checked

./mips_mipssim.c has no obvious style problems and is ready for submission.

$ ../../scripts/checkpatch.pl --strict -f ./mips_r4k.c
total: 0 errors, 0 warnings, 318 lines checked

./mips_r4k.c has no obvious style problems and is ready for submission.

Maybe we should also finally get rid of these segments in mips_malta.c:

#if 0
         printf("malta_fpga_read: Bad register offset 0x" TARGET_FMT_lx "\n",
                addr);

#endif

Quoted 8 lines

and

#if 0
         printf("malta_fpga_write: Bad register offset 0x" TARGET_FMT_lx "\n",
                addr);

#endif

possibly replacing them with some logging?

Yes, I had it done before the checkpatch fixes on hw/mips/, now I have to rebase. Instead I postpone for the day I find interest in playing with the Malta. Remember this is a hobbyist board (the Boston being the corporate quality one).

Quoted 296 lines

Philippe?

Thanks,
Aleksandar

Quoted 287 lines

Sincerely,
Aleksandar

Quoted 284 lines
Quoted 271 lines
Quoted 271 lines

Aleksandar

Quoted 267 lines

Huacai

Quoted 266 lines
   hw/pci-host/bonito.c                     |  8 ++---
   tests/qtest/endianness-test.c            |  2 +-
   MAINTAINERS                              |  4 +--
   hw/mips/Kconfig                          |  2 +-
   hw/mips/Makefile.objs                    |  2 +-
   9 files changed, 36 insertions(+), 34 deletions(-)

rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)

docs/system/target-mips.rst +1 -1
index 2736fd0509..cd2a931edf 100644
@@ -74,7 +74,7 @@ The MIPS Magnum R4000 emulation supports:
 
   -  G364 framebuffer
 
-The Fulong 2E emulation supports:
+The Fuloong 2E emulation supports:
 
   -  Loongson 2E CPU
 
default-configs/mips64el-softmmu.mak +1 -1
index 8b0c9b1e15..9f8a3ef156 100644
@@ -2,7 +2,7 @@
 
   include mips-softmmu-common.mak
   CONFIG_IDE_VIA=y
-CONFIG_FULONG=y
+CONFIG_FULOONG=y
   CONFIG_ATI_VGA=y
   CONFIG_RTL8139_PCI=y
   CONFIG_JAZZ=y
hw/isa/vt82c686.c +1 -1
index d9b51fce8d..fac4e56b7d 100644
@@ -503,7 +503,7 @@ static void via_class_init(ObjectClass *klass, void *data)
       dc->vmsd = &vmstate_via;
       /*
        * Reason: part of VIA VT82C686 southbridge, needs to be wired up,
-     * e.g. by mips_fulong2e_init()
+     * e.g. by mips_fuloong2e_init()
        */
       dc->user_creatable = false;
   }
hw/mips/fuloong2e.c renamed from hw/mips/mips_fulong2e.c +24 -22
similarity index 91%
rename from hw/mips/mips_fulong2e.c
rename to hw/mips/fuloong2e.c
index 4e1a3646af..624c46a4fd 100644
@@ -1,5 +1,5 @@
   /*
- * QEMU fulong 2e mini pc support
+ * QEMU fuloong 2e mini pc support
    *
    * Copyright (c) 2008 yajin ([email protected])
    * Copyright (c) 2009 chenming ([email protected])
@@ -11,8 +11,8 @@
    */
 
   /*
- * Fulong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
- * http://www.linux-mips.org/wiki/Fulong
+ * Fuloong 2e mini pc is based on ICT/ST Loongson 2e CPU (MIPS III like, 800MHz)
+ * https://www.linux-mips.org/wiki/Fuloong_2E
    *
    * Loongson 2e user manual:
    * http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf
@@ -46,13 +46,13 @@
   #include "sysemu/reset.h"
   #include "qemu/error-report.h"
 
-#define DEBUG_FULONG2E_INIT
+#define DEBUG_FULOONG2E_INIT
 
   #define ENVP_ADDR               0x80002000l
   #define ENVP_NB_ENTRIES         16
   #define ENVP_ENTRY_SIZE         256
 
-/* fulong 2e has a 512k flash: Winbond W39L040AP70Z */
+/* Fuloong 2e has a 512k flash: Winbond W39L040AP70Z */
   #define BIOS_SIZE               (512 * KiB)
   #define MAX_IDE_BUS             2
 
@@ -69,12 +69,12 @@
    * 2, use "Bonito2edev" to replace "dir_corresponding_to_your_target_hardware"
    * in the "Compile Guide".
    */
-#define FULONG_BIOSNAME "pmon_2e.bin"
+#define FULOONG_BIOSNAME "pmon_2e.bin"
 
-/* PCI SLOT in fulong 2e */
-#define FULONG2E_VIA_SLOT        5
-#define FULONG2E_ATI_SLOT        6
-#define FULONG2E_RTL8139_SLOT    7
+/* PCI SLOT in Fuloong 2e */
+#define FULOONG2E_VIA_SLOT        5
+#define FULOONG2E_ATI_SLOT        6
+#define FULOONG2E_RTL8139_SLOT    7
 
   static struct _loaderparams {
       int ram_size;
@@ -279,7 +279,7 @@ static void network_init(PCIBus *pci_bus)
           const char *default_devaddr = NULL;
 
           if (i == 0 && (!nd->model || strcmp(nd->model, "rtl8139") == 0)) {
-            /* The fulong board has a RTL8139 card using PCI SLOT 7 */
+            /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */
               default_devaddr = "07";
           }
 
@@ -287,7 +287,7 @@ static void network_init(PCIBus *pci_bus)
       }
   }
 
-static void mips_fulong2e_init(MachineState *machine)
+static void mips_fuloong2e_init(MachineState *machine)
   {
       const char *kernel_filename = machine->kernel_filename;
       const char *kernel_cmdline = machine->kernel_cmdline;
@@ -316,11 +316,12 @@ static void mips_fulong2e_init(MachineState *machine)
           error_report("Invalid RAM size, should be 256MB");
           exit(EXIT_FAILURE);
       }
-    memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
-    /* Boot ROM */
-    memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
+    /* allocate RAM */
+    memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE,
                              &error_fatal);
+
+    memory_region_add_subregion(address_space_mem, 0, machine->ram);
       memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
 
       /*
@@ -337,7 +338,7 @@ static void mips_fulong2e_init(MachineState *machine)
           write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
       } else {
           if (bios_name == NULL) {
-                bios_name = FULONG_BIOSNAME;
+                bios_name = FULOONG_BIOSNAME;
           }
           filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
           if (filename) {
@@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine)
       pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
       /* South bridge -> IP5 */
-    vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
+    vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
                                  &smbus, &isa_bus);
 
       /* GPU */
@@ -384,14 +385,15 @@ static void mips_fulong2e_init(MachineState *machine)
       network_init(pci_bus);
   }
 
-static void mips_fulong2e_machine_init(MachineClass *mc)
+static void mips_fuloong2e_machine_init(MachineClass *mc)
   {
-    mc->desc = "Fulong 2e mini pc";
-    mc->init = mips_fulong2e_init;
+    mc->desc = "Fuloong 2e mini pc";
+    mc->alias = "fulong2e";             /* Incorrect name used up to QEMU 4.2 */
+    mc->init = mips_fuloong2e_init;
       mc->block_default_type = IF_IDE;
       mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
       mc->default_ram_size = 256 * MiB;
-    mc->default_ram_id = "fulong2e.ram";
+    mc->default_ram_id = "fuloong2e.ram";
   }
 
-DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init)
+DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
hw/pci-host/bonito.c +4 -4
index cc6545c8a8..b9bfe3c417 100644
@@ -11,7 +11,7 @@
    */
 
   /*
- * fulong 2e mini pc has a bonito north bridge.
+ * fuloong 2e mini pc has a bonito north bridge.
    */
 
   /*
@@ -559,11 +559,11 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
       slot = (pci_dev->devfn >> 3);
 
       switch (slot) {
-    case 5:   /* FULONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+    case 5:   /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
           return irq_num % 4 + BONITO_IRQ_BASE;
-    case 6:   /* FULONG2E_ATI_SLOT, VGA */
+    case 6:   /* FULOONG2E_ATI_SLOT, VGA */
           return 4 + BONITO_IRQ_BASE;
-    case 7:   /* FULONG2E_RTL_SLOT, RTL8139 */
+    case 7:   /* FULOONG2E_RTL_SLOT, RTL8139 */
           return 5 + BONITO_IRQ_BASE;
       case 8 ... 12: /* PCI slot 1 to 4 */
           return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
tests/qtest/endianness-test.c +1 -1
index 2798802c63..cc088ac01a 100644
@@ -33,7 +33,7 @@ static const TestCase test_cases[] = {
       { "mips64", "pica61", 0x90000000, .bswap = true },
       { "mips64", "mips", 0x14000000, .bswap = true },
       { "mips64", "malta", 0x10000000, .bswap = true },
-    { "mips64el", "fulong2e", 0x1fd00000 },
+    { "mips64el", "fuloong2e", 0x1fd00000 },
       { "ppc", "g3beige", 0xfe000000, .bswap = true, .superio = "i82378" },
       { "ppc", "40p", 0x80000000, .bswap = true },
       { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" },
MAINTAINERS +2 -2
index aa5c54c75a..50f6a5f1bb 100644
@@ -1074,13 +1074,13 @@ R: Aleksandar Rikalo <[email protected]>
   S: Obsolete
   F: hw/mips/mips_r4k.c
 
-Fulong 2E
+Fuloong 2E
   M: Huacai Chen <[email protected]>
   M: Philippe Mathieu-Daudé <[email protected]>
   M: Aleksandar Markovic <[email protected]>
   R: Jiaxun Yang <[email protected]>
   S: Odd Fixes
-F: hw/mips/mips_fulong2e.c
+F: hw/mips/fuloong2e.c
   F: hw/isa/vt82c686.c
   F: hw/pci-host/bonito.c
   F: include/hw/isa/vt82c686.h
hw/mips/Kconfig +1 -1
index 2c2adbc42a..cd38546689 100644
@@ -41,7 +41,7 @@ config JAZZ
       select DS1225Y
       select JAZZ_LED
 
-config FULONG
+config FULOONG
       bool
 
   config MIPS_CPS
hw/mips/Makefile.objs +1 -2
index 525809af07..8ab41edc3f 100644
@@ -3,6 +3,6 @@ obj-$(CONFIG_R4K) += mips_r4k.o
   obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
   obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
   obj-$(CONFIG_JAZZ) += mips_jazz.o
-obj-$(CONFIG_FULONG) += mips_fulong2e.o
+obj-$(CONFIG_FULOONG) += fuloong2e.o
   obj-$(CONFIG_MIPS_CPS) += cps.o
   obj-$(CONFIG_MIPS_BOSTON) += boston.o
--
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

2.21.3

--
Huacai Chen

--
Huacai Chen

#15 lore raw

PATCH 5/12 hw/pci-host: Use CONFIG_PCI_BONITO to select the Bonito North Bridge

In reply to Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

Ease the kconfig selection by introducing CONFIG_PCI_BONITO to select the Bonito North Bridge.

---
 hw/mips/Kconfig           | 1 +
 hw/pci-host/Kconfig       | 4 ++++
 hw/pci-host/Makefile.objs | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
hw/mips/Kconfig +1 -0
index cd38546689..67d39c56a4 100644
@@ -43,6 +43,7 @@ config JAZZ
 
 config FULOONG
     bool
+    select PCI_BONITO
 
 config MIPS_CPS
     bool
hw/pci-host/Kconfig +4 -0
index 9642c77e98..8db41edc7e 100644
@@ -55,3 +55,7 @@ config PCI_EXPRESS_DESIGNWARE
     bool
     select PCI_EXPRESS
     select MSI_NONBROKEN
+
+config PCI_BONITO
+    select PCI
+    bool
hw/pci-host/Makefile.objs +1 -1
index 8c87e8494d..e422e0aca0 100644
@@ -12,7 +12,7 @@ common-obj-$(CONFIG_PPCE500_PCI) += ppce500.o
 common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
 
 common-obj-$(CONFIG_PCI_SABRE) += sabre.o
-common-obj-$(CONFIG_FULONG) += bonito.o
+common-obj-$(CONFIG_PCI_BONITO) += bonito.o
 common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
 common-obj-$(CONFIG_XEN_IGD_PASSTHROUGH) += xen_igd_pt.o
 common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o
Signature · 1 line
2.21.3
Reviewed-by Huacai Chen on v1 5/12
#16 lore raw

Re: [PATCH 05/12] hw/pci-host: Use CONFIG_PCI_BONITO to select the Bonito North Bridge

Quoted 55 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

Ease the kconfig selection by introducing CONFIG_PCI_BONITO to select the Bonito North Bridge.

---
 hw/mips/Kconfig           | 1 +
 hw/pci-host/Kconfig       | 4 ++++
 hw/pci-host/Makefile.objs | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
hw/mips/Kconfig +1 -0
index cd38546689..67d39c56a4 100644
@@ -43,6 +43,7 @@ config JAZZ
 
 config FULOONG
     bool
+    select PCI_BONITO
 
 config MIPS_CPS
     bool
hw/pci-host/Kconfig +4 -0
index 9642c77e98..8db41edc7e 100644
@@ -55,3 +55,7 @@ config PCI_EXPRESS_DESIGNWARE
     bool
     select PCI_EXPRESS
     select MSI_NONBROKEN
+
+config PCI_BONITO
+    select PCI
+    bool
hw/pci-host/Makefile.objs +1 -2
index 8c87e8494d..e422e0aca0 100644
@@ -12,7 +12,7 @@ common-obj-$(CONFIG_PPCE500_PCI) += ppce500.o
 common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
 
 common-obj-$(CONFIG_PCI_SABRE) += sabre.o
-common-obj-$(CONFIG_FULONG) += bonito.o
+common-obj-$(CONFIG_PCI_BONITO) += bonito.o
 common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
 common-obj-$(CONFIG_XEN_IGD_PASSTHROUGH) += xen_igd_pt.o
 common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o
--

2.21.3

Signature · 1 line
Huacai Chen
#17 lore raw

PATCH 6/12 hw/pci-host/bonito: Fix DPRINTF() format strings

In reply to Philippe Mathieu-Daudé
---
 hw/pci-host/bonito.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/pci-host/bonito.c +3 -3
index b9bfe3c417..10ead31e4f 100644
@@ -239,7 +239,7 @@ static void bonito_writel(void *opaque, hwaddr addr,
 
     saddr = addr >> 2;
 
-    DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n",
+    DPRINTF("bonito_writel "TARGET_FMT_plx" val %lx saddr %x\n",
             addr, val, saddr);
     switch (saddr) {
     case BONITO_BONPONCFG:
@@ -327,7 +327,7 @@ static void bonito_pciconf_writel(void *opaque, hwaddr addr,
     PCIBonitoState *s = opaque;
     PCIDevice *d = PCI_DEVICE(s);
 
-    DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val);
+    DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %lx\n", addr, val);
     d->config_write(d, addr, val, 4);
 }
 
@@ -474,7 +474,7 @@ static void bonito_spciconf_write(void *opaque, hwaddr addr, uint64_t val,
     uint32_t pciaddr;
     uint16_t status;
 
-    DPRINTF("bonito_spciconf_write "TARGET_FMT_plx" size %d val %x\n",
+    DPRINTF("bonito_spciconf_write "TARGET_FMT_plx" size %d val %lx\n",
             addr, size, val);
 
     pciaddr = bonito_sbridge_pciaddr(s, addr);
Signature · 1 line
2.21.3
Reviewed-by Huacai Chen on v1 6/12
#18 lore raw

Re: [PATCH 06/12] hw/pci-host/bonito: Fix DPRINTF() format strings

Quoted 41 lines · Philippe Mathieu-Daudé
---
 hw/pci-host/bonito.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/pci-host/bonito.c +3 -4
index b9bfe3c417..10ead31e4f 100644
@@ -239,7 +239,7 @@ static void bonito_writel(void *opaque, hwaddr addr,
 
     saddr = addr >> 2;
 
-    DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n",
+    DPRINTF("bonito_writel "TARGET_FMT_plx" val %lx saddr %x\n",
             addr, val, saddr);
     switch (saddr) {
     case BONITO_BONPONCFG:
@@ -327,7 +327,7 @@ static void bonito_pciconf_writel(void *opaque, hwaddr addr,
     PCIBonitoState *s = opaque;
     PCIDevice *d = PCI_DEVICE(s);
 
-    DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val);
+    DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %lx\n", addr, val);
     d->config_write(d, addr, val, 4);
 }
 
@@ -474,7 +474,7 @@ static void bonito_spciconf_write(void *opaque, hwaddr addr, uint64_t val,
     uint32_t pciaddr;
     uint16_t status;
 
-    DPRINTF("bonito_spciconf_write "TARGET_FMT_plx" size %d val %x\n",
+    DPRINTF("bonito_spciconf_write "TARGET_FMT_plx" size %d val %lx\n",
             addr, size, val);
 
     pciaddr = bonito_sbridge_pciaddr(s, addr);
--

2.21.3

Signature · 1 line
Huacai Chen
#19 lore raw

PATCH 7/12 hw/pci-host/bonito: Map peripheral using physical address

In reply to Philippe Mathieu-Daudé

Peripherals are mapped at physical address on busses. Only CPU/IOMMU can use virtual addresses.

---
 hw/pci-host/bonito.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/bonito.c +2 -2
index 10ead31e4f..7ed462ffb5 100644
@@ -647,12 +647,12 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     memory_region_init_io(&s->iomem_ldma, OBJECT(s), &bonito_ldma_ops, s,
                           "ldma", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_ldma);
-    sysbus_mmio_map(sysbus, 3, 0xbfe00200);
+    sysbus_mmio_map(sysbus, 3, 0x1fe00200);
 
     memory_region_init_io(&s->iomem_cop, OBJECT(s), &bonito_cop_ops, s,
                           "cop", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_cop);
-    sysbus_mmio_map(sysbus, 4, 0xbfe00300);
+    sysbus_mmio_map(sysbus, 4, 0x1fe00300);
 
     /* Map PCI IO Space  0x1fd0 0000 - 0x1fd1 0000 */
     memory_region_init_alias(&s->bonito_pciio, OBJECT(s), "isa_mmio",
Signature · 1 line
2.21.3
Reviewed-by on v1 7/12
#20 lore raw

Re: [PATCH 07/12] hw/pci-host/bonito: Map peripheral using physical address

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 9 lines

Peripherals are mapped at physical address on busses. Only CPU/IOMMU can use virtual addresses.

---
 hw/pci-host/bonito.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 22 lines
hw/pci-host/bonito.c +2 -3
index 10ead31e4f..7ed462ffb5 100644
@@ -647,12 +647,12 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     memory_region_init_io(&s->iomem_ldma, OBJECT(s), &bonito_ldma_ops, s,
                           "ldma", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_ldma);
-    sysbus_mmio_map(sysbus, 3, 0xbfe00200);
+    sysbus_mmio_map(sysbus, 3, 0x1fe00200);
 
     memory_region_init_io(&s->iomem_cop, OBJECT(s), &bonito_cop_ops, s,
                           "cop", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_cop);
-    sysbus_mmio_map(sysbus, 4, 0xbfe00300);
+    sysbus_mmio_map(sysbus, 4, 0x1fe00300);
 
     /* Map PCI IO Space  0x1fd0 0000 - 0x1fd1 0000 */
     memory_region_init_alias(&s->bonito_pciio, OBJECT(s), "isa_mmio",
--

2.21.3

#21 lore raw

PATCH 8/12 hw/pci-host/bonito: Map all the Bonito64 I/O range

In reply to Philippe Mathieu-Daudé

To ease following guest accesses to the Bonito64 chipset, map its I/O range as UnimplementedDevice.
We can now see the accesses to unimplemented peripheral using the '-d unimp' command line option.

---
 hw/pci-host/bonito.c | 3 +++
 hw/pci-host/Kconfig  | 1 +
 2 files changed, 4 insertions(+)
hw/pci-host/bonito.c +3 -0
index 7ed462ffb5..9761780f44 100644
@@ -48,6 +48,7 @@
 #include "sysemu/reset.h"
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
+#include "hw/misc/unimp.h"
 
 /* #define DEBUG_BONITO */
 
@@ -644,6 +645,8 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &phb->data_mem);
     sysbus_mmio_map(sysbus, 2, BONITO_SPCICONFIG_BASE);
 
+    create_unimplemented_device("bonito", BONITO_REG_BASE, BONITO_REG_SIZE);
+
     memory_region_init_io(&s->iomem_ldma, OBJECT(s), &bonito_ldma_ops, s,
                           "ldma", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_ldma);
hw/pci-host/Kconfig +1 -0
index 8db41edc7e..036a61877a 100644
@@ -58,4 +58,5 @@ config PCI_EXPRESS_DESIGNWARE
 
 config PCI_BONITO
     select PCI
+    select UNIMP
     bool
Signature · 1 line
2.21.3
Reviewed-by on v1 8/12
#22 lore raw

Re: [PATCH 08/12] hw/pci-host/bonito: Map all the Bonito64 I/O range

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 6 lines

To ease following guest accesses to the Bonito64 chipset, map its I/O range as UnimplementedDevice.
We can now see the accesses to unimplemented peripheral using the '-d unimp' command line option.

Quoted 6 lines
---
 hw/pci-host/bonito.c | 3 +++
 hw/pci-host/Kconfig  | 1 +
 2 files changed, 4 insertions(+)
Quoted 34 lines
hw/pci-host/bonito.c +3 -0
index 7ed462ffb5..9761780f44 100644
@@ -48,6 +48,7 @@
 #include "sysemu/reset.h"
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
+#include "hw/misc/unimp.h"
 
 /* #define DEBUG_BONITO */
 
@@ -644,6 +645,8 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &phb->data_mem);
     sysbus_mmio_map(sysbus, 2, BONITO_SPCICONFIG_BASE);
 
+    create_unimplemented_device("bonito", BONITO_REG_BASE, BONITO_REG_SIZE);
+
     memory_region_init_io(&s->iomem_ldma, OBJECT(s), &bonito_ldma_ops, s,
                           "ldma", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_ldma);
hw/pci-host/Kconfig +1 -1
index 8db41edc7e..036a61877a 100644
@@ -58,4 +58,5 @@ config PCI_EXPRESS_DESIGNWARE
 
 config PCI_BONITO
     select PCI
+    select UNIMP
     bool
--

2.21.3

#23 lore raw

PATCH 9/12 hw/pci-host/bonito: Map the different PCI ranges more detailled

In reply to Philippe Mathieu-Daudé

Better describe the Bonito64 MEM HI/LO and I/O PCI ranges, add more PCI regions as unimplemented.

---
 hw/pci-host/bonito.c | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)
hw/pci-host/bonito.c +26 -4
index 9761780f44..90a6c52a38 100644
@@ -39,6 +39,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "qemu/error-report.h"
 #include "hw/pci/pci.h"
 #include "hw/irq.h"
@@ -82,7 +83,7 @@
 #define BONITO_PCILO1_BASE      0x14000000
 #define BONITO_PCILO2_BASE      0x18000000
 #define BONITO_PCIHI_BASE       0x20000000
-#define BONITO_PCIHI_SIZE       0x20000000
+#define BONITO_PCIHI_SIZE       0x60000000
 #define BONITO_PCIHI_TOP        (BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE - 1)
 #define BONITO_PCIIO_BASE       0x1fd00000
 #define BONITO_PCIIO_BASE_VA    0xbfd00000
@@ -606,13 +607,25 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp)
     PCIHostState *phb = PCI_HOST_BRIDGE(dev);
     BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev);
 
-    memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCILO_SIZE);
+    memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE);
     phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
                                      pci_bonito_set_irq, pci_bonito_map_irq,
                                      dev, &bs->pci_mem, get_system_io(),
                                      0x28, 32, TYPE_PCI_BUS);
-    memory_region_add_subregion(get_system_memory(), BONITO_PCILO_BASE,
-                                &bs->pci_mem);
+
+    MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3);
+    for (size_t i = 0; i < 3; i++) {
+        char *name = g_strdup_printf("pci.lomem%zu", i);
+
+        memory_region_init_alias(&pcimem_lo_alias[i], NULL, name,
+                                 &bs->pci_mem, i * 64 * MiB, 64 * MiB);
+        memory_region_add_subregion(get_system_memory(),
+                                    BONITO_PCILO_BASE + i * 64 * MiB,
+                                    &pcimem_lo_alias[i]);
+        g_free(name);
+    }
+
+    create_unimplemented_device("pci.io", 0x1fd00000, 1 * MiB);
 }
 
 static void bonito_realize(PCIDevice *dev, Error **errp)
@@ -620,6 +633,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     PCIBonitoState *s = PCI_BONITO(dev);
     SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost);
     PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);
+    BonitoState *bs = BONITO_PCI_HOST_BRIDGE(s->pcihost);
 
     /*
      * Bonito North Bridge, built on FPGA,
@@ -652,6 +666,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &s->iomem_ldma);
     sysbus_mmio_map(sysbus, 3, 0x1fe00200);
 
+    /* PCI copier */
     memory_region_init_io(&s->iomem_cop, OBJECT(s), &bonito_cop_ops, s,
                           "cop", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_cop);
@@ -669,6 +684,13 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &s->bonito_localio);
     sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE);
 
+    MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);
+    memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
+                             &bs->pci_mem, 0, BONITO_PCIHI_SIZE);
+    memory_region_add_subregion(get_system_memory(),
+                                0x20000000ul, pcimem_alias);
+    create_unimplemented_device("PCI_2", 0x80000000ul, 2 * GiB); /* pci_hi */
+
     /* set the default value of north bridge pci config */
     pci_set_word(dev->config + PCI_COMMAND, 0x0000);
     pci_set_word(dev->config + PCI_STATUS, 0x0000);
Signature · 1 line
2.21.3
#24 lore raw

Re: [PATCH 09/12] hw/pci-host/bonito: Map the different PCI ranges more detailled

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 46 lines

Better describe the Bonito64 MEM HI/LO and I/O PCI ranges, add more PCI regions as unimplemented.

---
 hw/pci-host/bonito.c | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)
hw/pci-host/bonito.c +7 -4
index 9761780f44..90a6c52a38 100644
@@ -39,6 +39,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "qemu/error-report.h"
 #include "hw/pci/pci.h"
 #include "hw/irq.h"
@@ -82,7 +83,7 @@
 #define BONITO_PCILO1_BASE      0x14000000
 #define BONITO_PCILO2_BASE      0x18000000
 #define BONITO_PCIHI_BASE       0x20000000
-#define BONITO_PCIHI_SIZE       0x20000000
+#define BONITO_PCIHI_SIZE       0x60000000
 #define BONITO_PCIHI_TOP        (BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE - 1)
 #define BONITO_PCIIO_BASE       0x1fd00000
 #define BONITO_PCIIO_BASE_VA    0xbfd00000
@@ -606,13 +607,25 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp)
     PCIHostState *phb = PCI_HOST_BRIDGE(dev);
     BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev);
 
-    memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCILO_SIZE);
+    memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE);
     phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
                                      pci_bonito_set_irq, pci_bonito_map_irq,
                                      dev, &bs->pci_mem, get_system_io(),
                                      0x28, 32, TYPE_PCI_BUS);
-    memory_region_add_subregion(get_system_memory(), BONITO_PCILO_BASE,
-                                &bs->pci_mem);
+
+    MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3);
+    for (size_t i = 0; i < 3; i++) {
+        char *name = g_strdup_printf("pci.lomem%zu", i);

hw/pci-host/bonito.c static void bonito_pcihost_realize(DeviceState *dev, Error **errp) · line 628

Quoted 10 lines
hw/pci-host/bonito.c +10 -0
+
+        memory_region_init_alias(&pcimem_lo_alias[i], NULL, name,
+                                 &bs->pci_mem, i * 64 * MiB, 64 * MiB);
+        memory_region_add_subregion(get_system_memory(),
+                                    BONITO_PCILO_BASE + i * 64 * MiB,
+                                    &pcimem_lo_alias[i]);
+        g_free(name);
+    }
+
+    create_unimplemented_device("pci.io", 0x1fd00000, 1 * MiB);

Hi, Philippe.

I am delighted with the whole series, finally cleaning Bonito code feels good.

I just want to ask you if it possible to get rid of constants like 0x1fd00000 (generally in this code, not limited to this patch), and give the some nice "#define" names?

Yours,
Aleksandar

Quoted 36 lines
hw/pci-host/bonito.c +9 -1
 }
 
 static void bonito_realize(PCIDevice *dev, Error **errp)
@@ -620,6 +633,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     PCIBonitoState *s = PCI_BONITO(dev);
     SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost);
     PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);
+    BonitoState *bs = BONITO_PCI_HOST_BRIDGE(s->pcihost);
 
     /*
      * Bonito North Bridge, built on FPGA,
@@ -652,6 +666,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &s->iomem_ldma);
     sysbus_mmio_map(sysbus, 3, 0x1fe00200);
 
+    /* PCI copier */
     memory_region_init_io(&s->iomem_cop, OBJECT(s), &bonito_cop_ops, s,
                           "cop", 0x100);
     sysbus_init_mmio(sysbus, &s->iomem_cop);
@@ -669,6 +684,13 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &s->bonito_localio);
     sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE);
 
+    MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);
+    memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
+                             &bs->pci_mem, 0, BONITO_PCIHI_SIZE);
+    memory_region_add_subregion(get_system_memory(),
+                                0x20000000ul, pcimem_alias);
+    create_unimplemented_device("PCI_2", 0x80000000ul, 2 * GiB); /* pci_hi */
+
     /* set the default value of north bridge pci config */
     pci_set_word(dev->config + PCI_COMMAND, 0x0000);
     pci_set_word(dev->config + PCI_STATUS, 0x0000);
--

2.21.3

#25 lore raw

Re: [PATCH 09/12] hw/pci-host/bonito: Map the different PCI ranges more detailled

Quoted 61 lines · Aleksandar Markovic

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 46 lines

Better describe the Bonito64 MEM HI/LO and I/O PCI ranges, add more PCI regions as unimplemented.

---
  hw/pci-host/bonito.c | 30 ++++++++++++++++++++++++++----
  1 file changed, 26 insertions(+), 4 deletions(-)
hw/pci-host/bonito.c +7 -4
index 9761780f44..90a6c52a38 100644
@@ -39,6 +39,7 @@
   */
 
  #include "qemu/osdep.h"
+#include "qemu/units.h"
  #include "qemu/error-report.h"
  #include "hw/pci/pci.h"
  #include "hw/irq.h"
@@ -82,7 +83,7 @@
  #define BONITO_PCILO1_BASE      0x14000000
  #define BONITO_PCILO2_BASE      0x18000000
  #define BONITO_PCIHI_BASE       0x20000000
-#define BONITO_PCIHI_SIZE       0x20000000
+#define BONITO_PCIHI_SIZE       0x60000000
  #define BONITO_PCIHI_TOP        (BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE - 1)
  #define BONITO_PCIIO_BASE       0x1fd00000
  #define BONITO_PCIIO_BASE_VA    0xbfd00000
@@ -606,13 +607,25 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp)
      PCIHostState *phb = PCI_HOST_BRIDGE(dev);
      BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev);
 
-    memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCILO_SIZE);
+    memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE);
      phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
                                       pci_bonito_set_irq, pci_bonito_map_irq,
                                       dev, &bs->pci_mem, get_system_io(),
                                       0x28, 32, TYPE_PCI_BUS);
-    memory_region_add_subregion(get_system_memory(), BONITO_PCILO_BASE,
-                                &bs->pci_mem);
+
+    MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3);
+    for (size_t i = 0; i < 3; i++) {
+        char *name = g_strdup_printf("pci.lomem%zu", i);

hw/pci-host/bonito.c static void bonito_pcihost_realize(DeviceState *dev, Error **errp) · line 628

Quoted 10 lines
hw/pci-host/bonito.c +10 -0
+
+        memory_region_init_alias(&pcimem_lo_alias[i], NULL, name,
+                                 &bs->pci_mem, i * 64 * MiB, 64 * MiB);
+        memory_region_add_subregion(get_system_memory(),
+                                    BONITO_PCILO_BASE + i * 64 * MiB,
+                                    &pcimem_lo_alias[i]);
+        g_free(name);
+    }
+
+    create_unimplemented_device("pci.io", 0x1fd00000, 1 * MiB);

Hi, Philippe.

Quoted 5 lines

I am delighted with the whole series, finally cleaning Bonito code feels good.

I just want to ask you if it possible to get rid of constants like 0x1fd00000 (generally in this code, not limited to this patch), and give the some nice "#define" names?

Yes sure. These patches are almost 1year old, gathering the result of a debugging session. Also ...

Quoted 27 lines

Yours,
Aleksandar

Quoted 23 lines
hw/pci-host/bonito.c +2 -0
  }
 
  static void bonito_realize(PCIDevice *dev, Error **errp)
@@ -620,6 +633,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
      PCIBonitoState *s = PCI_BONITO(dev);
      SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost);
      PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);
+    BonitoState *bs = BONITO_PCI_HOST_BRIDGE(s->pcihost);
 
      /*
       * Bonito North Bridge, built on FPGA,
@@ -652,6 +666,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
      sysbus_init_mmio(sysbus, &s->iomem_ldma);
      sysbus_mmio_map(sysbus, 3, 0x1fe00200);
 
+    /* PCI copier */
      memory_region_init_io(&s->iomem_cop, OBJECT(s), &bonito_cop_ops, s,
                            "cop", 0x100);
      sysbus_init_mmio(sysbus, &s->iomem_cop);
@@ -669,6 +684,13 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
      sysbus_init_mmio(sysbus, &s->bonito_localio);
      sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE);
 
Quoted 1 line

hw/pci-host/bonito.c static void bonito_realize(PCIDevice *dev, Error **errp) · line 687

Quoted 1 line
hw/pci-host/bonito.c +1 -0
+    MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);

... I'll declare the variable during function prologue ;)

Quoted 5 lines

hw/pci-host/bonito.c static void bonito_realize(PCIDevice *dev, Error **errp) · line 692

Quoted 5 lines
hw/pci-host/bonito.c +5 -0
+    memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
+                             &bs->pci_mem, 0, BONITO_PCIHI_SIZE);
+    memory_region_add_subregion(get_system_memory(),
+                                0x20000000ul, pcimem_alias);
+    create_unimplemented_device("PCI_2", 0x80000000ul, 2 * GiB); /* pci_hi */

... And add definitions for these addresses.

Thanks for the other reviews in this series!

Quoted 8 lines
Quoted 7 lines
hw/pci-host/bonito.c +1 -1
+
      /* set the default value of north bridge pci config */
      pci_set_word(dev->config + PCI_COMMAND, 0x0000);
      pci_set_word(dev->config + PCI_STATUS, 0x0000);
--

2.21.3

#26 lore raw

PATCH 10/12 hw/pci-host/bonito: Better describe the I/O CS regions

In reply to Philippe Mathieu-Daudé

Better describe the I/O CS regions, add the ROMCS region.

---
 hw/pci-host/bonito.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
hw/pci-host/bonito.c +11 -2
index 90a6c52a38..335c7787eb 100644
@@ -672,6 +672,8 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &s->iomem_cop);
     sysbus_mmio_map(sysbus, 4, 0x1fe00300);
 
+    create_unimplemented_device("ROMCS", 0x1c000000, 60 * MiB);
+
     /* Map PCI IO Space  0x1fd0 0000 - 0x1fd1 0000 */
     memory_region_init_alias(&s->bonito_pciio, OBJECT(s), "isa_mmio",
                              get_system_io(), 0, BONITO_PCIIO_SIZE);
@@ -679,10 +681,17 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_mmio_map(sysbus, 5, BONITO_PCIIO_BASE);
 
     /* add pci local io mapping */
-    memory_region_init_alias(&s->bonito_localio, OBJECT(s), "isa_mmio",
-                             get_system_io(), 0, BONITO_DEV_SIZE);
+
+    memory_region_init_alias(&s->bonito_localio, OBJECT(s), "IOCS[0]",
+                             get_system_io(), 0, 256 * KiB);
     sysbus_init_mmio(sysbus, &s->bonito_localio);
     sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE);
+    create_unimplemented_device("IOCS[1]", BONITO_DEV_BASE + 1 * 256 * KiB,
+                                256 * KiB);
+    create_unimplemented_device("IOCS[2]", BONITO_DEV_BASE + 2 * 256 * KiB,
+                                256 * KiB);
+    create_unimplemented_device("IOCS[3]", BONITO_DEV_BASE + 3 * 256 * KiB,
+                                256 * KiB);
 
     MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);
     memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
Signature · 1 line
2.21.3
Reviewed-by on v1 10/12
#27 lore raw

Re: [PATCH 10/12] hw/pci-host/bonito: Better describe the I/O CS regions

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 8 lines

Better describe the I/O CS regions, add the ROMCS region.

---
 hw/pci-host/bonito.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Quoted 36 lines
hw/pci-host/bonito.c +11 -3
index 90a6c52a38..335c7787eb 100644
@@ -672,6 +672,8 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_init_mmio(sysbus, &s->iomem_cop);
     sysbus_mmio_map(sysbus, 4, 0x1fe00300);
 
+    create_unimplemented_device("ROMCS", 0x1c000000, 60 * MiB);
+
     /* Map PCI IO Space  0x1fd0 0000 - 0x1fd1 0000 */
     memory_region_init_alias(&s->bonito_pciio, OBJECT(s), "isa_mmio",
                              get_system_io(), 0, BONITO_PCIIO_SIZE);
@@ -679,10 +681,17 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
     sysbus_mmio_map(sysbus, 5, BONITO_PCIIO_BASE);
 
     /* add pci local io mapping */
-    memory_region_init_alias(&s->bonito_localio, OBJECT(s), "isa_mmio",
-                             get_system_io(), 0, BONITO_DEV_SIZE);
+
+    memory_region_init_alias(&s->bonito_localio, OBJECT(s), "IOCS[0]",
+                             get_system_io(), 0, 256 * KiB);
     sysbus_init_mmio(sysbus, &s->bonito_localio);
     sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE);
+    create_unimplemented_device("IOCS[1]", BONITO_DEV_BASE + 1 * 256 * KiB,
+                                256 * KiB);
+    create_unimplemented_device("IOCS[2]", BONITO_DEV_BASE + 2 * 256 * KiB,
+                                256 * KiB);
+    create_unimplemented_device("IOCS[3]", BONITO_DEV_BASE + 3 * 256 * KiB,
+                                256 * KiB);
 
     MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);
     memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
--

2.21.3

#28 lore raw

PATCH 11/12 hw/pci-host/bonito: Set the Config register reset value with FIELD_DP32

In reply to Philippe Mathieu-Daudé

Describe some Config registers fields with the registerfields API. Use the FIELD_DP32() macro to set the BONGENCFG register bits at reset.

---
 hw/pci-host/bonito.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
hw/pci-host/bonito.c +20 -1
index 335c7787eb..86aceb333a 100644
@@ -50,6 +50,7 @@
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
 #include "hw/misc/unimp.h"
+#include "hw/registerfields.h"
 
 /* #define DEBUG_BONITO */
 
@@ -112,8 +113,19 @@
 /* Power on register */
 
 #define BONITO_BONPONCFG        (0x00 >> 2)      /* 0x100 */
+
+/* PCI configuration register */
 #define BONITO_BONGENCFG_OFFSET 0x4
 #define BONITO_BONGENCFG        (BONITO_BONGENCFG_OFFSET >> 2)   /*0x104 */
+REG32(BONGENCFG,        0x104)
+FIELD(BONGENCFG, DEBUGMODE,      0, 1)
+FIELD(BONGENCFG, SNOOP,          1, 1)
+FIELD(BONGENCFG, CPUSELFRESET,   2, 1)
+FIELD(BONGENCFG, BYTESWAP,       6, 1)
+FIELD(BONGENCFG, UNCACHED,       7, 1)
+FIELD(BONGENCFG, PREFETCH,       8, 1)
+FIELD(BONGENCFG, WRITEBEHIND,    9, 1)
+FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 
 /* 2. IO & IDE configuration */
 #define BONITO_IODEVCFG         (0x08 >> 2)      /* 0x108 */
@@ -577,11 +589,18 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
 static void bonito_reset(void *opaque)
 {
     PCIBonitoState *s = opaque;
+    uint32_t val = 0;
 
     /* set the default value of north bridge registers */
 
     s->regs[BONITO_BONPONCFG] = 0xc40;
-    s->regs[BONITO_BONGENCFG] = 0x1384;
+    val = FIELD_DP32(val, BONGENCFG, PCIQUEUE, 1);
+    val = FIELD_DP32(val, BONGENCFG, WRITEBEHIND, 1);
+    val = FIELD_DP32(val, BONGENCFG, PREFETCH, 1);
+    val = FIELD_DP32(val, BONGENCFG, UNCACHED, 1);
+    val = FIELD_DP32(val, BONGENCFG, CPUSELFRESET, 1);
+    s->regs[BONITO_BONGENCFG] = val;
+
     s->regs[BONITO_IODEVCFG] = 0x2bff8010;
     s->regs[BONITO_SDCFG] = 0x255e0091;
 
Signature · 1 line
2.21.3
#29 lore raw

Re: [PATCH 11/12] hw/pci-host/bonito: Set the Config register reset value with FIELD_DP32

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 10 lines

Describe some Config registers fields with the registerfields API. Use the FIELD_DP32() macro to set the BONGENCFG register bits at reset.

---
 hw/pci-host/bonito.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

Some Config registers? Is there any reason not to cover all Bonito config registers? Or, the commit message was inprecise?

But, in general, I salute the intent of this patch.

Sincerely,
Aleksandar

Quoted 55 lines
hw/pci-host/bonito.c +20 -2
index 335c7787eb..86aceb333a 100644
@@ -50,6 +50,7 @@
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
 #include "hw/misc/unimp.h"
+#include "hw/registerfields.h"
 
 /* #define DEBUG_BONITO */
 
@@ -112,8 +113,19 @@
 /* Power on register */
 
 #define BONITO_BONPONCFG        (0x00 >> 2)      /* 0x100 */
+
+/* PCI configuration register */
 #define BONITO_BONGENCFG_OFFSET 0x4
 #define BONITO_BONGENCFG        (BONITO_BONGENCFG_OFFSET >> 2)   /*0x104 */
+REG32(BONGENCFG,        0x104)
+FIELD(BONGENCFG, DEBUGMODE,      0, 1)
+FIELD(BONGENCFG, SNOOP,          1, 1)
+FIELD(BONGENCFG, CPUSELFRESET,   2, 1)
+FIELD(BONGENCFG, BYTESWAP,       6, 1)
+FIELD(BONGENCFG, UNCACHED,       7, 1)
+FIELD(BONGENCFG, PREFETCH,       8, 1)
+FIELD(BONGENCFG, WRITEBEHIND,    9, 1)
+FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 
 /* 2. IO & IDE configuration */
 #define BONITO_IODEVCFG         (0x08 >> 2)      /* 0x108 */
@@ -577,11 +589,18 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
 static void bonito_reset(void *opaque)
 {
     PCIBonitoState *s = opaque;
+    uint32_t val = 0;
 
     /* set the default value of north bridge registers */
 
     s->regs[BONITO_BONPONCFG] = 0xc40;
-    s->regs[BONITO_BONGENCFG] = 0x1384;
+    val = FIELD_DP32(val, BONGENCFG, PCIQUEUE, 1);
+    val = FIELD_DP32(val, BONGENCFG, WRITEBEHIND, 1);
+    val = FIELD_DP32(val, BONGENCFG, PREFETCH, 1);
+    val = FIELD_DP32(val, BONGENCFG, UNCACHED, 1);
+    val = FIELD_DP32(val, BONGENCFG, CPUSELFRESET, 1);
+    s->regs[BONITO_BONGENCFG] = val;
+
     s->regs[BONITO_IODEVCFG] = 0x2bff8010;
     s->regs[BONITO_SDCFG] = 0x255e0091;
 
--

2.21.3

#30 lore raw

Re: [PATCH 11/12] hw/pci-host/bonito: Set the Config register reset value with FIELD_DP32

Quoted 7 lines · Aleksandar Markovic

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 5 lines

Describe some Config registers fields with the registerfields API. Use the FIELD_DP32() macro to set the BONGENCFG register bits at reset.

Quoted 8 lines
Quoted 5 lines
---
  hw/pci-host/bonito.c | 21 ++++++++++++++++++++-
  1 file changed, 20 insertions(+), 1 deletion(-)

Some Config registers? Is there any reason not to cover all Bonito config registers? Or, the commit message was inprecise?

The commit message is not correct English, I wanted to say "some bits of the Config register" (I don't want to overload the file defining bits we'll never use).

Quoted 2 lines

But, in general, I salute the intent of this patch.

Thanks! I'll reword the description.

Quoted 60 lines

Sincerely,
Aleksandar

Quoted 55 lines
hw/pci-host/bonito.c +20 -2
index 335c7787eb..86aceb333a 100644
@@ -50,6 +50,7 @@
  #include "sysemu/runstate.h"
  #include "exec/address-spaces.h"
  #include "hw/misc/unimp.h"
+#include "hw/registerfields.h"
 
  /* #define DEBUG_BONITO */
 
@@ -112,8 +113,19 @@
  /* Power on register */
 
  #define BONITO_BONPONCFG        (0x00 >> 2)      /* 0x100 */
+
+/* PCI configuration register */
  #define BONITO_BONGENCFG_OFFSET 0x4
  #define BONITO_BONGENCFG        (BONITO_BONGENCFG_OFFSET >> 2)   /*0x104 */
+REG32(BONGENCFG,        0x104)
+FIELD(BONGENCFG, DEBUGMODE,      0, 1)
+FIELD(BONGENCFG, SNOOP,          1, 1)
+FIELD(BONGENCFG, CPUSELFRESET,   2, 1)
+FIELD(BONGENCFG, BYTESWAP,       6, 1)
+FIELD(BONGENCFG, UNCACHED,       7, 1)
+FIELD(BONGENCFG, PREFETCH,       8, 1)
+FIELD(BONGENCFG, WRITEBEHIND,    9, 1)
+FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 
  /* 2. IO & IDE configuration */
  #define BONITO_IODEVCFG         (0x08 >> 2)      /* 0x108 */
@@ -577,11 +589,18 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
  static void bonito_reset(void *opaque)
  {
      PCIBonitoState *s = opaque;
+    uint32_t val = 0;
 
      /* set the default value of north bridge registers */
 
      s->regs[BONITO_BONPONCFG] = 0xc40;
-    s->regs[BONITO_BONGENCFG] = 0x1384;
+    val = FIELD_DP32(val, BONGENCFG, PCIQUEUE, 1);
+    val = FIELD_DP32(val, BONGENCFG, WRITEBEHIND, 1);
+    val = FIELD_DP32(val, BONGENCFG, PREFETCH, 1);
+    val = FIELD_DP32(val, BONGENCFG, UNCACHED, 1);
+    val = FIELD_DP32(val, BONGENCFG, CPUSELFRESET, 1);
+    s->regs[BONITO_BONGENCFG] = val;
+
      s->regs[BONITO_IODEVCFG] = 0x2bff8010;
      s->regs[BONITO_SDCFG] = 0x255e0091;
 
--

2.21.3

#31 lore raw

Re: [PATCH 11/12] hw/pci-host/bonito: Set the Config register reset value with FIELD_DP32

пон, 11. мај 2020. у 08:30 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 18 lines · Aleksandar Markovic
Quoted 7 lines

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 5 lines

Describe some Config registers fields with the registerfields API. Use the FIELD_DP32() macro to set the BONGENCFG register bits at reset.

Quoted 8 lines
Quoted 5 lines
---
  hw/pci-host/bonito.c | 21 ++++++++++++++++++++-
  1 file changed, 20 insertions(+), 1 deletion(-)

Some Config registers? Is there any reason not to cover all Bonito config registers? Or, the commit message was inprecise?

Quoted 9 lines

The commit message is not correct English, I wanted to say "some bits of the Config register" (I don't want to overload the file defining bits we'll never use).

Quoted 2 lines

But, in general, I salute the intent of this patch.

Thanks! I'll reword the description.

OK, then, with that little rewording, certainly, a good patch:

Quoted 60 lines
Quoted 60 lines

Sincerely,
Aleksandar

Quoted 55 lines
hw/pci-host/bonito.c +20 -2
index 335c7787eb..86aceb333a 100644
@@ -50,6 +50,7 @@
  #include "sysemu/runstate.h"
  #include "exec/address-spaces.h"
  #include "hw/misc/unimp.h"
+#include "hw/registerfields.h"
 
  /* #define DEBUG_BONITO */
 
@@ -112,8 +113,19 @@
  /* Power on register */
 
  #define BONITO_BONPONCFG        (0x00 >> 2)      /* 0x100 */
+
+/* PCI configuration register */
  #define BONITO_BONGENCFG_OFFSET 0x4
  #define BONITO_BONGENCFG        (BONITO_BONGENCFG_OFFSET >> 2)   /*0x104 */
+REG32(BONGENCFG,        0x104)
+FIELD(BONGENCFG, DEBUGMODE,      0, 1)
+FIELD(BONGENCFG, SNOOP,          1, 1)
+FIELD(BONGENCFG, CPUSELFRESET,   2, 1)
+FIELD(BONGENCFG, BYTESWAP,       6, 1)
+FIELD(BONGENCFG, UNCACHED,       7, 1)
+FIELD(BONGENCFG, PREFETCH,       8, 1)
+FIELD(BONGENCFG, WRITEBEHIND,    9, 1)
+FIELD(BONGENCFG, PCIQUEUE,      12, 1)
 
  /* 2. IO & IDE configuration */
  #define BONITO_IODEVCFG         (0x08 >> 2)      /* 0x108 */
@@ -577,11 +589,18 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
  static void bonito_reset(void *opaque)
  {
      PCIBonitoState *s = opaque;
+    uint32_t val = 0;
 
      /* set the default value of north bridge registers */
 
      s->regs[BONITO_BONPONCFG] = 0xc40;
-    s->regs[BONITO_BONGENCFG] = 0x1384;
+    val = FIELD_DP32(val, BONGENCFG, PCIQUEUE, 1);
+    val = FIELD_DP32(val, BONGENCFG, WRITEBEHIND, 1);
+    val = FIELD_DP32(val, BONGENCFG, PREFETCH, 1);
+    val = FIELD_DP32(val, BONGENCFG, UNCACHED, 1);
+    val = FIELD_DP32(val, BONGENCFG, CPUSELFRESET, 1);
+    s->regs[BONITO_BONGENCFG] = val;
+
      s->regs[BONITO_IODEVCFG] = 0x2bff8010;
      s->regs[BONITO_SDCFG] = 0x255e0091;
 
--

2.21.3

#32 lore raw

PATCH 12/12 POC hw/pci-host/bonito: Fix BONGENCFG value after a warm-reset

In reply to Philippe Mathieu-Daudé

The CPUSELFRESET bit should only be set on COLD reset. To have the PMON firmware behave correctly after WARM reset, we need to clear this bit.

---
Cc: Damien Hedde <[email protected]>

---
 hw/pci-host/bonito.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
hw/pci-host/bonito.c +8 -1
index 86aceb333a..60eab867f0 100644
@@ -586,6 +586,12 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
     }
 }
 
+static ResetType bonito_reset_type(PCIBonitoState *s)
+{
+    /* TODO: Use resettable_get_type(s) to also return RESET_TYPE_WARM */
+    return RESET_TYPE_COLD;
+}
+
 static void bonito_reset(void *opaque)
 {
     PCIBonitoState *s = opaque;
@@ -598,7 +604,8 @@ static void bonito_reset(void *opaque)
     val = FIELD_DP32(val, BONGENCFG, WRITEBEHIND, 1);
     val = FIELD_DP32(val, BONGENCFG, PREFETCH, 1);
     val = FIELD_DP32(val, BONGENCFG, UNCACHED, 1);
-    val = FIELD_DP32(val, BONGENCFG, CPUSELFRESET, 1);
+    val = FIELD_DP32(val, BONGENCFG, CPUSELFRESET,
+                     bonito_reset_type(s) == RESET_TYPE_COLD);
     s->regs[BONITO_BONGENCFG] = val;
 
     s->regs[BONITO_IODEVCFG] = 0x2bff8010;
Signature · 1 line
2.21.3
#33 lore raw
In reply to Philippe Mathieu-Daudé

нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 13 lines

The PMON firmware behave differently regarding it is run after a cold/warm reset. A simple bit flip fix the issue, however we need to know the type of reset to set it. Currently QEMU only supports COLD reset.

This series contains various of my current Fuloong queue,
- Welcome Huacai Chen as co-maintainer,
- Fix typo in machine name,
- Few cleanups in Bonito64,
- Report various Bonito64 accesses as UNIMP,
- Proof-of-concept fix for the reset bit.

Quoted 3 lines

The last patch is not for merging, but is included to see if the Multi-phase reset mechanism can fix the problem.

Perhaps you can change the title of the series in its next version to:

target/mips: Fuloong2e and ither mips fixes and improvements

or similar, since its scope is wider than the current title conveys.

Regards,
Aleksandar

Quoted 38 lines

Regards,

Phil.

Huacai Chen (1):
MAINTAINERS: Add Huacai Chen as fuloong2e co-maintainer

Philippe Mathieu-Daudé (11):
hw/mips/fuloong2e: Rename PMON BIOS name hw/mips/fuloong2e: Move code and update a comment hw/mips/fuloong2e: Fix typo in Fuloong machine name hw/pci-host: Use CONFIG_PCI_BONITO to select the Bonito North Bridge hw/pci-host/bonito: Fix DPRINTF() format strings hw/pci-host/bonito: Map peripheral using physical address hw/pci-host/bonito: Map all the Bonito64 I/O range hw/pci-host/bonito: Map the different PCI ranges more detailled hw/pci-host/bonito: Better describe the I/O CS regions hw/pci-host/bonito: Set the Config register reset value with

    FIELD_DP32

POC hw/pci-host/bonito: Fix BONGENCFG value after a warm-reset

 docs/system/target-mips.rst              |  2 +-
 default-configs/mips64el-softmmu.mak     |  2 +-
 hw/isa/vt82c686.c                        |  2 +-
 hw/mips/{mips_fulong2e.c => fuloong2e.c} | 41 +++++------
 hw/pci-host/bonito.c                     | 92 +++++++++++++++++++-----
 tests/qtest/endianness-test.c            |  2 +-
 MAINTAINERS                              |  6 +-
 hw/mips/Kconfig                          |  3 +-
 hw/mips/Makefile.objs                    |  2 +-
 hw/pci-host/Kconfig                      |  5 ++
 hw/pci-host/Makefile.objs                |  2 +-
 11 files changed, 114 insertions(+), 45 deletions(-)
 rename hw/mips/{mips_fulong2e.c => fuloong2e.c} (91%)

--
2.21.3

#34 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 33 lines · Philippe Mathieu-Daudé

The PMON firmware behave differently regarding it is run after a cold/warm reset. A simple bit flip fix the issue, however we need to know the type of reset to set it. Currently QEMU only supports COLD reset.

This series contains various of my current Fuloong queue,
- Welcome Huacai Chen as co-maintainer,
- Fix typo in machine name,
- Few cleanups in Bonito64,
- Report various Bonito64 accesses as UNIMP,
- Proof-of-concept fix for the reset bit.

The last patch is not for merging, but is included to see if the Multi-phase reset mechanism can fix the problem.

Regards,

Phil.

Huacai Chen (1):
MAINTAINERS: Add Huacai Chen as fuloong2e co-maintainer

Philippe Mathieu-Daudé (11):
hw/mips/fuloong2e: Rename PMON BIOS name hw/mips/fuloong2e: Move code and update a comment hw/mips/fuloong2e: Fix typo in Fuloong machine name hw/pci-host: Use CONFIG_PCI_BONITO to select the Bonito North Bridge hw/pci-host/bonito: Fix DPRINTF() format strings hw/pci-host/bonito: Map peripheral using physical address hw/pci-host/bonito: Map all the Bonito64 I/O range hw/pci-host/bonito: Map the different PCI ranges more detailled hw/pci-host/bonito: Better describe the I/O CS regions hw/pci-host/bonito: Set the Config register reset value with

Quoted 2 lines
    FIELD_DP32

POC hw/pci-host/bonito: Fix BONGENCFG value after a warm-reset

Thanks, patches 1, 3-11 queued to mips-next after addressing Aleksandar comments.

#35 lore raw

уто, 26. мај 2020. у 09:47 Philippe Mathieu-Daudé <[email protected]> је написао/ла:

Quoted 38 lines · Philippe Mathieu-Daudé
Quoted 33 lines

The PMON firmware behave differently regarding it is run after a cold/warm reset. A simple bit flip fix the issue, however we need to know the type of reset to set it. Currently QEMU only supports COLD reset.

This series contains various of my current Fuloong queue,
- Welcome Huacai Chen as co-maintainer,
- Fix typo in machine name,
- Few cleanups in Bonito64,
- Report various Bonito64 accesses as UNIMP,
- Proof-of-concept fix for the reset bit.

The last patch is not for merging, but is included to see if the Multi-phase reset mechanism can fix the problem.

Regards,

Phil.

Huacai Chen (1):
MAINTAINERS: Add Huacai Chen as fuloong2e co-maintainer

Philippe Mathieu-Daudé (11):
hw/mips/fuloong2e: Rename PMON BIOS name hw/mips/fuloong2e: Move code and update a comment hw/mips/fuloong2e: Fix typo in Fuloong machine name hw/pci-host: Use CONFIG_PCI_BONITO to select the Bonito North Bridge hw/pci-host/bonito: Fix DPRINTF() format strings hw/pci-host/bonito: Map peripheral using physical address hw/pci-host/bonito: Map all the Bonito64 I/O range hw/pci-host/bonito: Map the different PCI ranges more detailled hw/pci-host/bonito: Better describe the I/O CS regions hw/pci-host/bonito: Set the Config register reset value with

Quoted 2 lines
    FIELD_DP32

POC hw/pci-host/bonito: Fix BONGENCFG value after a warm-reset

Quoted 3 lines

Thanks, patches 1, 3-11 queued to mips-next after addressing Aleksandar comments.

Over all, I think you should have sent a new version of the series rather than starting applying to the queueu.
Philippe, I think you should "unqueue" everything, and start from scratch you queue.
In future, I think you should coordinate better queuing, possibly in some separate off-list messages.
Patch 4/12 - does it have r-b?

Patch 9/12 - I don't want to block you r work, but you are making some missteps that are not good here:

- i did not see how you addressed mu comments
- I didnt give the patch R-b, neither I remember anyone else
- I am against pull request with patches without r-b, if that is the case with 9/12, and insist on applying the same principle to hw/mips