* [PATCH v2 1/7] hw/mips/Kconfig: Introduce CONFIG_GT64120 to select gt64xxx_pci.c
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
@ 2022-12-20 11:34 ` Philippe Mathieu-Daudé
2022-12-20 11:34 ` [PATCH v2 2/7] hw/mips/gt64xxx_pci: Let the GT64120 manage the lower 512MiB hole Philippe Mathieu-Daudé
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:34 UTC (permalink / raw)
To: qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé, Philippe Mathieu-Daudé,
Bernhard Beschow, Richard Henderson
From: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20221209151533.69516-2-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/mips/Kconfig | 6 ++++++
hw/mips/meson.build | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
index 725525358d..d6bbbe7069 100644
--- a/hw/mips/Kconfig
+++ b/hw/mips/Kconfig
@@ -1,5 +1,6 @@
config MALTA
bool
+ select GT64120
select ISA_SUPERIO
config MIPSSIM
@@ -59,3 +60,8 @@ config MIPS_BOSTON
config FW_CFG_MIPS
bool
+
+config GT64120
+ bool
+ select PCI
+ select I8259
diff --git a/hw/mips/meson.build b/hw/mips/meson.build
index dd0101ad4d..6ccd385df0 100644
--- a/hw/mips/meson.build
+++ b/hw/mips/meson.build
@@ -2,7 +2,8 @@ mips_ss = ss.source_set()
mips_ss.add(files('bootloader.c', 'mips_int.c'))
mips_ss.add(when: 'CONFIG_FW_CFG_MIPS', if_true: files('fw_cfg.c'))
mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c', 'loongson3_virt.c'))
-mips_ss.add(when: 'CONFIG_MALTA', if_true: files('gt64xxx_pci.c', 'malta.c'))
+mips_ss.add(when: 'CONFIG_MALTA', if_true: files('malta.c'))
+mips_ss.add(when: 'CONFIG_GT64120', if_true: files('gt64xxx_pci.c'))
mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))
if 'CONFIG_TCG' in config_all
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/7] hw/mips/gt64xxx_pci: Let the GT64120 manage the lower 512MiB hole
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
2022-12-20 11:34 ` [PATCH v2 1/7] hw/mips/Kconfig: Introduce CONFIG_GT64120 to select gt64xxx_pci.c Philippe Mathieu-Daudé
@ 2022-12-20 11:34 ` Philippe Mathieu-Daudé
2022-12-20 11:34 ` [PATCH v2 3/7] hw/mips/gt64xxx_pci: Manage endian bits with the RegisterFields API Philippe Mathieu-Daudé
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:34 UTC (permalink / raw)
To: qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé, Philippe Mathieu-Daudé,
Richard Henderson
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Per the comment in the Malta board, the [0x0000.0000-0x2000.0000]
range is decoded by the GT64120, so move the "empty_slot" there.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20221209151533.69516-3-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
configs/devices/mips-softmmu/common.mak | 1 -
hw/mips/Kconfig | 1 +
hw/mips/gt64xxx_pci.c | 8 ++++++++
hw/mips/malta.c | 7 -------
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/configs/devices/mips-softmmu/common.mak b/configs/devices/mips-softmmu/common.mak
index 416161f833..c2b5f322fc 100644
--- a/configs/devices/mips-softmmu/common.mak
+++ b/configs/devices/mips-softmmu/common.mak
@@ -26,7 +26,6 @@ CONFIG_IDE_ISA=y
CONFIG_PFLASH_CFI01=y
CONFIG_I8259=y
CONFIG_MC146818RTC=y
-CONFIG_EMPTY_SLOT=y
CONFIG_MIPS_CPS=y
CONFIG_MIPS_ITU=y
CONFIG_MALTA=y
diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
index d6bbbe7069..8f7bce38fb 100644
--- a/hw/mips/Kconfig
+++ b/hw/mips/Kconfig
@@ -64,4 +64,5 @@ config FW_CFG_MIPS
config GT64120
bool
select PCI
+ select EMPTY_SLOT
select I8259
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 19d0d9889f..1b9ac7f792 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -28,6 +28,7 @@
#include "qemu/log.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_host.h"
+#include "hw/misc/empty_slot.h"
#include "migration/vmstate.h"
#include "hw/intc/i8259.h"
#include "hw/irq.h"
@@ -1162,6 +1163,13 @@ static void gt64120_realize(DeviceState *dev, Error **errp)
PCI_DEVFN(18, 0), TYPE_PCI_BUS);
pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "gt64120_pci");
+
+ /*
+ * The whole address space decoded by the GT-64120A doesn't generate
+ * exception when accessing invalid memory. Create an empty slot to
+ * emulate this feature.
+ */
+ empty_slot_init("GT64120", 0, 0x20000000);
}
static void gt64120_pci_realize(PCIDevice *d, Error **errp)
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index c0a2e0ab04..ba92022f87 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -53,7 +53,6 @@
#include "sysemu/runstate.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
-#include "hw/misc/empty_slot.h"
#include "sysemu/kvm.h"
#include "semihosting/semihost.h"
#include "hw/mips/cps.h"
@@ -1393,12 +1392,6 @@ void mips_malta_init(MachineState *machine)
/* Northbridge */
dev = sysbus_create_simple("gt64120", -1, NULL);
pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci"));
- /*
- * The whole address space decoded by the GT-64120A doesn't generate
- * exception when accessing invalid memory. Create an empty slot to
- * emulate this feature.
- */
- empty_slot_init("GT64120", 0, 0x20000000);
/* Southbridge */
piix4 = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), true,
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/7] hw/mips/gt64xxx_pci: Manage endian bits with the RegisterFields API
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
2022-12-20 11:34 ` [PATCH v2 1/7] hw/mips/Kconfig: Introduce CONFIG_GT64120 to select gt64xxx_pci.c Philippe Mathieu-Daudé
2022-12-20 11:34 ` [PATCH v2 2/7] hw/mips/gt64xxx_pci: Let the GT64120 manage the lower 512MiB hole Philippe Mathieu-Daudé
@ 2022-12-20 11:34 ` Philippe Mathieu-Daudé
2022-12-21 0:54 ` Richard Henderson
2022-12-20 11:34 ` [PATCH v2 4/7] hw/mips/gt64xxx_pci: Add a 'cpu-little-endian' qdev property Philippe Mathieu-Daudé
` (4 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:34 UTC (permalink / raw)
To: qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221209151533.69516-4-philmd@linaro.org>
---
hw/mips/gt64xxx_pci.c | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 1b9ac7f792..f6fa309ef7 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -26,6 +26,7 @@
#include "qapi/error.h"
#include "qemu/units.h"
#include "qemu/log.h"
+#include "hw/registerfields.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_host.h"
#include "hw/misc/empty_slot.h"
@@ -41,6 +42,9 @@
#define GT_CPU (0x000 >> 2)
#define GT_MULTI (0x120 >> 2)
+REG32(GT_CPU, 0x000)
+FIELD(GT_CPU, Endianness, 12, 1)
+
/* CPU Address Decode */
#define GT_SCS10LD (0x008 >> 2)
#define GT_SCS10HD (0x010 >> 2)
@@ -210,6 +214,17 @@
#define GT_PCI0_CFGADDR (0xcf8 >> 2)
#define GT_PCI0_CFGDATA (0xcfc >> 2)
+REG32(GT_PCI0_CMD, 0xc00)
+FIELD(GT_PCI0_CMD, MByteSwap, 0, 1)
+FIELD(GT_PCI0_CMD, SByteSwap, 16, 1)
+#define R_GT_PCI0_CMD_ByteSwap_MASK \
+ (R_GT_PCI0_CMD_MByteSwap_MASK | R_GT_PCI0_CMD_SByteSwap_MASK)
+REG32(GT_PCI1_CMD, 0xc80)
+FIELD(GT_PCI1_CMD, MByteSwap, 0, 1)
+FIELD(GT_PCI1_CMD, SByteSwap, 16, 1)
+#define R_GT_PCI1_CMD_ByteSwap_MASK \
+ (R_GT_PCI1_CMD_MByteSwap_MASK | R_GT_PCI1_CMD_SByteSwap_MASK)
+
/* Interrupts */
#define GT_INTRCAUSE (0xc18 >> 2)
#define GT_INTRMASK (0xc1c >> 2)
@@ -983,15 +998,16 @@ static const MemoryRegionOps isd_mem_ops = {
static void gt64120_reset(DeviceState *dev)
{
GT64120State *s = GT64120_PCI_HOST_BRIDGE(dev);
+#if TARGET_BIG_ENDIAN
+ bool cpu_little_endian = false;
+#else
+ bool cpu_little_endian = true;
+#endif
/* FIXME: Malta specific hw assumptions ahead */
/* CPU Configuration */
-#if TARGET_BIG_ENDIAN
- s->regs[GT_CPU] = 0x00000000;
-#else
- s->regs[GT_CPU] = 0x00001000;
-#endif
+ s->regs[GT_CPU] = cpu_little_endian ? R_GT_CPU_Endianness_MASK : 0;
s->regs[GT_MULTI] = 0x00000003;
/* CPU Address decode */
@@ -1098,11 +1114,7 @@ static void gt64120_reset(DeviceState *dev)
s->regs[GT_TC_CONTROL] = 0x00000000;
/* PCI Internal */
-#if TARGET_BIG_ENDIAN
- s->regs[GT_PCI0_CMD] = 0x00000000;
-#else
- s->regs[GT_PCI0_CMD] = 0x00010001;
-#endif
+ s->regs[GT_PCI0_CMD] = cpu_little_endian ? R_GT_PCI0_CMD_ByteSwap_MASK : 0;
s->regs[GT_PCI0_TOR] = 0x0000070f;
s->regs[GT_PCI0_BS_SCS10] = 0x00fff000;
s->regs[GT_PCI0_BS_SCS32] = 0x00fff000;
@@ -1119,11 +1131,7 @@ static void gt64120_reset(DeviceState *dev)
s->regs[GT_PCI0_SSCS10_BAR] = 0x00000000;
s->regs[GT_PCI0_SSCS32_BAR] = 0x01000000;
s->regs[GT_PCI0_SCS3BT_BAR] = 0x1f000000;
-#if TARGET_BIG_ENDIAN
- s->regs[GT_PCI1_CMD] = 0x00000000;
-#else
- s->regs[GT_PCI1_CMD] = 0x00010001;
-#endif
+ s->regs[GT_PCI1_CMD] = cpu_little_endian ? R_GT_PCI1_CMD_ByteSwap_MASK : 0;
s->regs[GT_PCI1_TOR] = 0x0000070f;
s->regs[GT_PCI1_BS_SCS10] = 0x00fff000;
s->regs[GT_PCI1_BS_SCS32] = 0x00fff000;
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 4/7] hw/mips/gt64xxx_pci: Add a 'cpu-little-endian' qdev property
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2022-12-20 11:34 ` [PATCH v2 3/7] hw/mips/gt64xxx_pci: Manage endian bits with the RegisterFields API Philippe Mathieu-Daudé
@ 2022-12-20 11:34 ` Philippe Mathieu-Daudé
2022-12-21 0:56 ` Richard Henderson
2022-12-20 11:34 ` [PATCH v2 5/7] hw/mips/malta: Explicit GT64120 endianness upon device creation Philippe Mathieu-Daudé
` (3 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:34 UTC (permalink / raw)
To: qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé, Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
This device does not have to be TARGET-dependent.
Add a 'cpu_big_endian' property which sets the byte-swapping
options if required.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20221209151533.69516-5-philmd@linaro.org>
---
hw/mips/gt64xxx_pci.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index f6fa309ef7..4cafc76a23 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -26,6 +26,7 @@
#include "qapi/error.h"
#include "qemu/units.h"
#include "qemu/log.h"
+#include "hw/qdev-properties.h"
#include "hw/registerfields.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_host.h"
@@ -256,6 +257,9 @@ struct GT64120State {
PCI_MAPPING_ENTRY(ISD);
MemoryRegion pci0_mem;
AddressSpace pci0_mem_as;
+
+ /* properties */
+ bool cpu_little_endian;
};
/* Adjust range to avoid touching space which isn't mappable via PCI */
@@ -998,16 +1002,11 @@ static const MemoryRegionOps isd_mem_ops = {
static void gt64120_reset(DeviceState *dev)
{
GT64120State *s = GT64120_PCI_HOST_BRIDGE(dev);
-#if TARGET_BIG_ENDIAN
- bool cpu_little_endian = false;
-#else
- bool cpu_little_endian = true;
-#endif
/* FIXME: Malta specific hw assumptions ahead */
/* CPU Configuration */
- s->regs[GT_CPU] = cpu_little_endian ? R_GT_CPU_Endianness_MASK : 0;
+ s->regs[GT_CPU] = s->cpu_little_endian ? R_GT_CPU_Endianness_MASK : 0;
s->regs[GT_MULTI] = 0x00000003;
/* CPU Address decode */
@@ -1114,7 +1113,7 @@ static void gt64120_reset(DeviceState *dev)
s->regs[GT_TC_CONTROL] = 0x00000000;
/* PCI Internal */
- s->regs[GT_PCI0_CMD] = cpu_little_endian ? R_GT_PCI0_CMD_ByteSwap_MASK : 0;
+ s->regs[GT_PCI0_CMD] = s->cpu_little_endian ? R_GT_PCI0_CMD_ByteSwap_MASK : 0;
s->regs[GT_PCI0_TOR] = 0x0000070f;
s->regs[GT_PCI0_BS_SCS10] = 0x00fff000;
s->regs[GT_PCI0_BS_SCS32] = 0x00fff000;
@@ -1131,7 +1130,7 @@ static void gt64120_reset(DeviceState *dev)
s->regs[GT_PCI0_SSCS10_BAR] = 0x00000000;
s->regs[GT_PCI0_SSCS32_BAR] = 0x01000000;
s->regs[GT_PCI0_SCS3BT_BAR] = 0x1f000000;
- s->regs[GT_PCI1_CMD] = cpu_little_endian ? R_GT_PCI1_CMD_ByteSwap_MASK : 0;
+ s->regs[GT_PCI1_CMD] = s->cpu_little_endian ? R_GT_PCI1_CMD_ByteSwap_MASK : 0;
s->regs[GT_PCI1_TOR] = 0x0000070f;
s->regs[GT_PCI1_BS_SCS10] = 0x00fff000;
s->regs[GT_PCI1_BS_SCS32] = 0x00fff000;
@@ -1224,11 +1223,18 @@ static const TypeInfo gt64120_pci_info = {
},
};
+static Property gt64120_properties[] = {
+ DEFINE_PROP_BOOL("cpu-little-endian", GT64120State,
+ cpu_little_endian, !TARGET_BIG_ENDIAN),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void gt64120_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
+ device_class_set_props(dc, gt64120_properties);
dc->realize = gt64120_realize;
dc->reset = gt64120_reset;
dc->vmsd = &vmstate_gt64120;
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/7] hw/mips/gt64xxx_pci: Add a 'cpu-little-endian' qdev property
2022-12-20 11:34 ` [PATCH v2 4/7] hw/mips/gt64xxx_pci: Add a 'cpu-little-endian' qdev property Philippe Mathieu-Daudé
@ 2022-12-21 0:56 ` Richard Henderson
0 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2022-12-21 0:56 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé
On 12/20/22 03:34, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé<f4bug@amsat.org>
>
> This device does not have to be TARGET-dependent.
> Add a 'cpu_big_endian' property which sets the byte-swapping
> options if required.
>
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> Message-Id:<20221209151533.69516-5-philmd@linaro.org>
> ---
> hw/mips/gt64xxx_pci.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 5/7] hw/mips/malta: Explicit GT64120 endianness upon device creation
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2022-12-20 11:34 ` [PATCH v2 4/7] hw/mips/gt64xxx_pci: Add a 'cpu-little-endian' qdev property Philippe Mathieu-Daudé
@ 2022-12-20 11:34 ` Philippe Mathieu-Daudé
2022-12-20 11:34 ` [PATCH v2 6/7] hw/mips/meson: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:34 UTC (permalink / raw)
To: qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé, Richard Henderson
Propagate the controller endianess from the machine, setting
the "cpu-little-endian" property.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221209151533.69516-6-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/mips/malta.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index ba92022f87..1f4e0c7acc 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -1390,7 +1390,9 @@ void mips_malta_init(MachineState *machine)
stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420);
/* Northbridge */
- dev = sysbus_create_simple("gt64120", -1, NULL);
+ dev = qdev_new("gt64120");
+ qdev_prop_set_bit(dev, "cpu-little-endian", !be);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci"));
/* Southbridge */
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 6/7] hw/mips/meson: Make gt64xxx_pci.c endian-agnostic
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2022-12-20 11:34 ` [PATCH v2 5/7] hw/mips/malta: Explicit GT64120 endianness upon device creation Philippe Mathieu-Daudé
@ 2022-12-20 11:34 ` Philippe Mathieu-Daudé
2022-12-20 11:34 ` [PATCH v2 7/7] hw/mips/gt64xxx_pci: Move it to hw/pci-host/ Philippe Mathieu-Daudé
2022-12-21 7:06 ` [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:34 UTC (permalink / raw)
To: qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé, Philippe Mathieu-Daudé,
Richard Henderson
From: Philippe Mathieu-Daudé <philmd@redhat.com>
The single machine using this device explicitly sets its
endianness. We don't need to set a default. This allow us
to remove the target specificity from the build system.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20221209151533.69516-7-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/mips/gt64xxx_pci.c | 2 +-
hw/mips/meson.build | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 4cafc76a23..bd0e23d2d8 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -1225,7 +1225,7 @@ static const TypeInfo gt64120_pci_info = {
static Property gt64120_properties[] = {
DEFINE_PROP_BOOL("cpu-little-endian", GT64120State,
- cpu_little_endian, !TARGET_BIG_ENDIAN),
+ cpu_little_endian, false),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/mips/meson.build b/hw/mips/meson.build
index 6ccd385df0..152103f15f 100644
--- a/hw/mips/meson.build
+++ b/hw/mips/meson.build
@@ -3,7 +3,7 @@ mips_ss.add(files('bootloader.c', 'mips_int.c'))
mips_ss.add(when: 'CONFIG_FW_CFG_MIPS', if_true: files('fw_cfg.c'))
mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c', 'loongson3_virt.c'))
mips_ss.add(when: 'CONFIG_MALTA', if_true: files('malta.c'))
-mips_ss.add(when: 'CONFIG_GT64120', if_true: files('gt64xxx_pci.c'))
+softmmu_ss.add(when: 'CONFIG_GT64120', if_true: files('gt64xxx_pci.c'))
mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))
if 'CONFIG_TCG' in config_all
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 7/7] hw/mips/gt64xxx_pci: Move it to hw/pci-host/
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2022-12-20 11:34 ` [PATCH v2 6/7] hw/mips/meson: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
@ 2022-12-20 11:34 ` Philippe Mathieu-Daudé
2022-12-21 7:06 ` [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:34 UTC (permalink / raw)
To: qemu-devel
Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno,
Philippe Mathieu-Daudé, Philippe Mathieu-Daudé,
Richard Henderson
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
The GT-64120 is a north-bridge, and it is not MIPS specific.
Move it with the other north-bridge devices.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20221209151533.69516-8-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
MAINTAINERS | 2 +-
hw/mips/Kconfig | 6 ------
hw/mips/meson.build | 1 -
hw/mips/trace-events | 6 ------
hw/pci-host/Kconfig | 6 ++++++
hw/{mips/gt64xxx_pci.c => pci-host/gt64120.c} | 0
hw/pci-host/meson.build | 1 +
hw/pci-host/trace-events | 7 +++++++
meson.build | 1 -
9 files changed, 15 insertions(+), 15 deletions(-)
delete mode 100644 hw/mips/trace-events
rename hw/{mips/gt64xxx_pci.c => pci-host/gt64120.c} (100%)
diff --git a/MAINTAINERS b/MAINTAINERS
index 716d5a24ad..8c32d82b47 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1240,7 +1240,7 @@ S: Odd Fixes
F: hw/isa/piix4.c
F: hw/acpi/piix4.c
F: hw/mips/malta.c
-F: hw/mips/gt64xxx_pci.c
+F: hw/pci-host/gt64120.c
F: include/hw/southbridge/piix.h
F: tests/avocado/linux_ssh_mips_malta.py
F: tests/avocado/machine_mips_malta.py
diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
index 8f7bce38fb..7a55143f8a 100644
--- a/hw/mips/Kconfig
+++ b/hw/mips/Kconfig
@@ -60,9 +60,3 @@ config MIPS_BOSTON
config FW_CFG_MIPS
bool
-
-config GT64120
- bool
- select PCI
- select EMPTY_SLOT
- select I8259
diff --git a/hw/mips/meson.build b/hw/mips/meson.build
index 152103f15f..900613fc08 100644
--- a/hw/mips/meson.build
+++ b/hw/mips/meson.build
@@ -3,7 +3,6 @@ mips_ss.add(files('bootloader.c', 'mips_int.c'))
mips_ss.add(when: 'CONFIG_FW_CFG_MIPS', if_true: files('fw_cfg.c'))
mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c', 'loongson3_virt.c'))
mips_ss.add(when: 'CONFIG_MALTA', if_true: files('malta.c'))
-softmmu_ss.add(when: 'CONFIG_GT64120', if_true: files('gt64xxx_pci.c'))
mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))
if 'CONFIG_TCG' in config_all
diff --git a/hw/mips/trace-events b/hw/mips/trace-events
deleted file mode 100644
index 13ee731a48..0000000000
--- a/hw/mips/trace-events
+++ /dev/null
@@ -1,6 +0,0 @@
-# gt64xxx_pci.c
-gt64120_read(uint64_t addr, uint64_t value) "gt64120 read 0x%03"PRIx64" value:0x%08" PRIx64
-gt64120_write(uint64_t addr, uint64_t value) "gt64120 write 0x%03"PRIx64" value:0x%08" PRIx64
-gt64120_read_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 read %s size:%u value:0x%08" PRIx64
-gt64120_write_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 write %s size:%u value:0x%08" PRIx64
-gt64120_isd_remap(uint64_t from_length, uint64_t from_addr, uint64_t to_length, uint64_t to_addr) "ISD: 0x%08" PRIx64 "@0x%08" PRIx64 " -> 0x%08" PRIx64 "@0x%08" PRIx64
diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
index 38fd2ee8f3..a07070eddf 100644
--- a/hw/pci-host/Kconfig
+++ b/hw/pci-host/Kconfig
@@ -81,3 +81,9 @@ config MV64361
config DINO
bool
select PCI
+
+config GT64120
+ bool
+ select PCI
+ select EMPTY_SLOT
+ select I8259
diff --git a/hw/mips/gt64xxx_pci.c b/hw/pci-host/gt64120.c
similarity index 100%
rename from hw/mips/gt64xxx_pci.c
rename to hw/pci-host/gt64120.c
diff --git a/hw/pci-host/meson.build b/hw/pci-host/meson.build
index e832babc9d..9a813d552e 100644
--- a/hw/pci-host/meson.build
+++ b/hw/pci-host/meson.build
@@ -1,6 +1,7 @@
pci_ss = ss.source_set()
pci_ss.add(when: 'CONFIG_PAM', if_true: files('pam.c'))
pci_ss.add(when: 'CONFIG_PCI_BONITO', if_true: files('bonito.c'))
+pci_ss.add(when: 'CONFIG_GT64120', if_true: files('gt64120.c'))
pci_ss.add(when: 'CONFIG_PCI_EXPRESS_DESIGNWARE', if_true: files('designware.c'))
pci_ss.add(when: 'CONFIG_PCI_EXPRESS_GENERIC_BRIDGE', if_true: files('gpex.c'))
pci_ss.add(when: ['CONFIG_PCI_EXPRESS_GENERIC_BRIDGE', 'CONFIG_ACPI'], if_true: files('gpex-acpi.c'))
diff --git a/hw/pci-host/trace-events b/hw/pci-host/trace-events
index 437e66ff50..9d216bb89f 100644
--- a/hw/pci-host/trace-events
+++ b/hw/pci-host/trace-events
@@ -6,6 +6,13 @@ bonito_spciconf_small_access(uint64_t addr, unsigned size) "PCI config address i
# grackle.c
grackle_set_irq(int irq_num, int level) "set_irq num %d level %d"
+# gt64120.c
+gt64120_read(uint64_t addr, uint64_t value) "gt64120 read 0x%03"PRIx64" value:0x%08" PRIx64
+gt64120_write(uint64_t addr, uint64_t value) "gt64120 write 0x%03"PRIx64" value:0x%08" PRIx64
+gt64120_read_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 read %s size:%u value:0x%08" PRIx64
+gt64120_write_intreg(const char *regname, unsigned size, uint64_t value) "gt64120 write %s size:%u value:0x%08" PRIx64
+gt64120_isd_remap(uint64_t from_length, uint64_t from_addr, uint64_t to_length, uint64_t to_addr) "ISD: 0x%08" PRIx64 "@0x%08" PRIx64 " -> 0x%08" PRIx64 "@0x%08" PRIx64
+
# mv64361.c
mv64361_region_map(const char *name, uint64_t poffs, uint64_t size, uint64_t moffs) "Mapping %s 0x%"PRIx64"+0x%"PRIx64" @ 0x%"PRIx64
mv64361_region_enable(const char *op, int num) "Should %s region %d"
diff --git a/meson.build b/meson.build
index 5c6b5a1c75..bd5774f32f 100644
--- a/meson.build
+++ b/meson.build
@@ -2944,7 +2944,6 @@ if have_system
'hw/intc',
'hw/isa',
'hw/mem',
- 'hw/mips',
'hw/misc',
'hw/misc/macio',
'hw/net',
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic
2022-12-20 11:34 [PATCH v2 0/7] hw/mips: Make gt64xxx_pci.c endian-agnostic Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2022-12-20 11:34 ` [PATCH v2 7/7] hw/mips/gt64xxx_pci: Move it to hw/pci-host/ Philippe Mathieu-Daudé
@ 2022-12-21 7:06 ` Philippe Mathieu-Daudé
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-21 7:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Jiaxun Yang, Thomas Huth, Aurelien Jarno
On 20/12/22 12:34, Philippe Mathieu-Daudé wrote:
> hw/mips/Kconfig: Introduce CONFIG_GT64120 to select gt64xxx_pci.c
> hw/mips/gt64xxx_pci: Let the GT64120 manage the lower 512MiB hole
> hw/mips/gt64xxx_pci: Manage endian bits with the RegisterFields API
> hw/mips/gt64xxx_pci: Add a 'cpu-little-endian' qdev property
> hw/mips/malta: Explicit GT64120 endianness upon device creation
> hw/mips/meson: Make gt64xxx_pci.c endian-agnostic
> hw/mips/gt64xxx_pci: Move it to hw/pci-host/
Series queued to mips-next.
^ permalink raw reply [flat|nested] 11+ messages in thread