Misc HW & UI patches for 2024-08-06
[PULL 01/28] hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
We'll have to add LoongsonIPIClass in few commits, so rename LoongsonIPI as LoongsonIPIState for clarity.
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi.h | 6 +++--- hw/intc/loongson_ipi.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)
include/hw/intc/loongson_ipi.h +3 -3
@@ -31,10 +31,10 @@#define IPI_MBX_NUM 4#define TYPE_LOONGSON_IPI "loongson_ipi" -OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPI, LOONGSON_IPI) +OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPIState, LOONGSON_IPI) typedef struct IPICore { - LoongsonIPI *ipi; + LoongsonIPIState *ipi; MemoryRegion *ipi_mmio_mem; uint32_t status; uint32_t en;
@@ -45,7 +45,7 @@ typedef struct IPICore {qemu_irq irq; } IPICore; -struct LoongsonIPI { +struct LoongsonIPIState {SysBusDevice parent_obj;MemoryRegion ipi_iocsr_mem;MemoryRegion ipi64_iocsr_mem;
hw/intc/loongson_ipi.c +8 -8
@@ -64,7 +64,7 @@ static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr,uint64_t *data, unsigned size, MemTxAttrs attrs) { - LoongsonIPI *ipi = opaque; + LoongsonIPIState *ipi = opaque;IPICore *s;if (attrs.requester_id >= ipi->num_cpu) {
@@ -160,7 +160,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, MemTxAttrs attrs) {IPICore *s = opaque; -LoongsonIPI *ipi = s->ipi; +LoongsonIPIState *ipi = s->ipi;int index =0 ;uint32_t cpuid;uint8_t vector;
@@ -214,7 +214,7 @@ static MemTxResult loongson_ipi_iocsr_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size, MemTxAttrs attrs) { - LoongsonIPI *ipi = opaque; + LoongsonIPIState *ipi = opaque;IPICore *s;if (attrs.requester_id >= ipi->num_cpu) {
@@ -277,7 +277,7 @@ static const MemoryRegionOps loongson_ipi64_ops = {static void loongson_ipi_realize (DeviceState *dev,Error **errp) { -LoongsonIPI *s =LOONGSON_IPI (dev); +LoongsonIPIState *s =LOONGSON_IPI (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);int i;
@@ -320,7 +320,7 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp)static void loongson_ipi_unrealize (DeviceState *dev) { -LoongsonIPI *s =LOONGSON_IPI (dev); +LoongsonIPIState *s =LOONGSON_IPI (dev);g_free (s->cpu); }
@@ -344,14 +344,14 @@ static const VMStateDescription vmstate_loongson_ipi = { .version_id = 2, .minimum_version_id = 2, .fields = (const VMStateField []) { -VMSTATE_STRUCT_VARRAY_POINTER_UINT32 (cpu, LoongsonIPI, num_cpu, +VMSTATE_STRUCT_VARRAY_POINTER_UINT32 (cpu, LoongsonIPIState, num_cpu, vmstate_ipi_core, IPICore),VMSTATE_END_OF_LIST () } };static Property ipi_properties[] = { -DEFINE_PROP_UINT32 ("num-cpu" , LoongsonIPI, num_cpu,1 ), +DEFINE_PROP_UINT32 ("num-cpu" , LoongsonIPIState, num_cpu,1 ),DEFINE_PROP_END_OF_LIST (), };
@@ -369,7 +369,7 @@ static const TypeInfo loongson_ipi_types[] = { { .name = TYPE_LOONGSON_IPI, .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(LoongsonIPI), + .instance_size = sizeof(LoongsonIPIState), .class_init = loongson_ipi_class_init, } };
Signature · 1 line
2.45.2
[PULL 02/28] hw/intc/loongson_ipi: Extract loongson_ipi_common_realize()
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
In preparation to extract common IPI code in few commits, extract loongson_ipi_common_realize().
Message-Id: <[email protected]>
--- hw/intc/loongson_ipi.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-)
hw/intc/loongson_ipi.c +28 -12
@@ -275,7 +275,7 @@ static const MemoryRegionOps loongson_ipi64_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static void loongson_ipi_realize (DeviceState *dev,Error **errp) +static void loongson_ipi_common_realize (DeviceState *dev,Error **errp) {LoongsonIPIState *s =LOONGSON_IPI (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);
@@ -301,30 +301,46 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp)sysbus_init_mmio (sbd, &s->ipi64_iocsr_mem); s->cpu =g_new0 (IPICore, s->num_cpu); -if (s->cpu ==NULL ) { -error_setg (errp,"Memory allocation for IPICore faile" ); -return ; - } -for (i =0 ; i < s->num_cpu; i++) { s->cpu[i].ipi = s; - s->cpu[i].ipi_mmio_mem =g_new0 (MemoryRegion,1 ); - g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); -memory_region_init_io (s->cpu[i].ipi_mmio_mem,OBJECT (dev), - &loongson_ipi_core_ops, &s->cpu[i], name,0x48 ); -sysbus_init_mmio (sbd, s->cpu[i].ipi_mmio_mem);qdev_init_gpio_out (dev, &s->cpu[i].irq,1 ); } } -static void loongson_ipi_unrealize (DeviceState *dev) +static void loongson_ipi_realize (DeviceState *dev,Error **errp) +{ +LoongsonIPIState *s =LOONGSON_IPI (dev); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev); +Error *local_err =NULL ; + +loongson_ipi_common_realize (dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + +for (unsigned i =0 ; i < s->num_cpu; i++) { + s->cpu[i].ipi_mmio_mem =g_new0 (MemoryRegion,1 ); + g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); +memory_region_init_io (s->cpu[i].ipi_mmio_mem,OBJECT (dev), + &loongson_ipi_core_ops, &s->cpu[i], name,0x48 ); +sysbus_init_mmio (sbd, s->cpu[i].ipi_mmio_mem); + } +} + +static void loongson_ipi_common_unrealize (DeviceState *dev) {LoongsonIPIState *s =LOONGSON_IPI (dev);g_free (s->cpu); } +static void loongson_ipi_unrealize (DeviceState *dev) +{ +loongson_ipi_common_unrealize (dev); +} +static const VMStateDescription vmstate_ipi_core = { .name ="ipi-single" , .version_id =2 ,
Signature · 1 line
2.45.2
[PULL 07/28] hw/intc/loongson_ipi: Pass LoongsonIPICommonState to send_ipi_data()
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
In order to get LoongsonIPICommonClass in send_ipi_data() in the next commit, propagate LoongsonIPICommonState.
Message-Id: <[email protected]>
--- hw/intc/loongson_ipi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
hw/intc/loongson_ipi.c +11 -8
@@ -88,8 +88,8 @@ static AddressSpace *get_cpu_iocsr_as(CPUState *cpu)return NULL ; } -static MemTxResult send_ipi_data (CPUState *cpu,uint64_t val,hwaddr addr, -MemTxAttrs attrs) +static MemTxResult send_ipi_data (LoongsonIPICommonState *ipi,CPUState *cpu, +uint64_t val,hwaddr addr,MemTxAttrs attrs) {int i, mask =0 , data =0 ;AddressSpace *iocsr_as =get_cpu_iocsr_as (cpu);
@@ -119,7 +119,8 @@ static MemTxResult send_ipi_data(CPUState *cpu, uint64_t val, hwaddr addr,return MEMTX_OK ; } -static MemTxResult mail_send (uint64_t val,MemTxAttrs attrs) +static MemTxResult mail_send (LoongsonIPICommonState *ipi, +uint64_t val,MemTxAttrs attrs) {uint32_t cpuid;hwaddr addr;
@@ -134,10 +135,11 @@ static MemTxResult mail_send(uint64_t val, MemTxAttrs attrs)/* override requester_id */ addr =SMP_IPI_MAILBOX +CORE_BUF_20 + (val &0x1c ); attrs.requester_id = cs->cpu_index; -return send_ipi_data (cs, val, addr, attrs); +return send_ipi_data (ipi, cs, val, addr, attrs); } -static MemTxResult any_send (uint64_t val,MemTxAttrs attrs) +static MemTxResult any_send (LoongsonIPICommonState *ipi, +uint64_t val,MemTxAttrs attrs) {uint32_t cpuid;hwaddr addr;
@@ -152,7 +154,7 @@ static MemTxResult any_send(uint64_t val, MemTxAttrs attrs)/* override requester_id */ addr = val &0xffff ; attrs.requester_id = cs->cpu_index; -return send_ipi_data (cs, val, addr, attrs); +return send_ipi_data (ipi, cs, val, addr, attrs); } static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr,
@@ -249,15 +251,16 @@ static const MemoryRegionOps loongson_ipi_iocsr_ops = {static MemTxResult loongson_ipi_writeq (void *opaque,hwaddr addr,uint64_t val,unsigned size,MemTxAttrs attrs) { +LoongsonIPICommonState *ipi = opaque;MemTxResult ret =MEMTX_OK ; addr &=0xfff ;switch (addr) {case MAIL_SEND_OFFSET : - ret =mail_send (val, attrs); + ret =mail_send (ipi, val, attrs);break ;case ANY_SEND_OFFSET : - ret =any_send (val, attrs); + ret =any_send (ipi, val, attrs);break ;default :break ;
Signature · 1 line
2.45.2
[PULL 03/28] hw/intc/loongson_ipi: Add TYPE_LOONGSON_IPI_COMMON stub
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Introduce LOONGSON_IPI_COMMON stubs, QDev parent of LOONGSON_IPI.
Message-Id: <[email protected]>
--- MAINTAINERS | 4 ++++ include/hw/intc/loongson_ipi.h | 14 ++++++++++++-- include/hw/intc/loongson_ipi_common.h | 26 ++++++++++++++++++++++++++ hw/intc/loongson_ipi.c | 10 +++++++--- hw/intc/loongson_ipi_common.c | 22 ++++++++++++++++++++++ hw/intc/Kconfig | 4 ++++ hw/intc/meson.build | 1 + 7 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 include/hw/intc/loongson_ipi_common.h create mode 100644 hw/intc/loongson_ipi_common.c
MAINTAINERS +4 -0
@@ -1250,8 +1250,10 @@ F: configs/devices/loongarch64-softmmu/default.mak F: hw/loongarch/ F: include/hw/loongarch/virt.h F: include/hw/intc/loongarch_*.h +F: include/hw/intc/loongson_ipi_common.h F: include/hw/intc/loongson_ipi.h F: hw/intc/loongarch_*.c +F: hw/intc/loongson_ipi_common.c F: hw/intc/loongson_ipi.c F: include/hw/pci-host/ls7a.h F: hw/rtc/ls7a_rtc.c
@@ -1386,11 +1388,13 @@ Loongson-3 virtual platforms M: Huacai Chen <[email protected]> R: Jiaxun Yang <[email protected]> S: Maintained +F: hw/intc/loongson_ipi_common.c F: hw/intc/loongson_ipi.c F: hw/intc/loongson_liointc.c F: hw/mips/loongson3_bootp.c F: hw/mips/loongson3_bootp.h F: hw/mips/loongson3_virt.c +F: include/hw/intc/loongson_ipi_common.h F: include/hw/intc/loongson_ipi.h F: include/hw/intc/loongson_liointc.h F: tests/avocado/machine_mips_loongson3v.py
include/hw/intc/loongson_ipi.h +12 -2
@@ -8,6 +8,8 @@#ifndef HW_LOONGSON_IPI_H #define HW_LOONGSON_IPI_H +#include "qom/object.h" +#include "hw/intc/loongson_ipi_common.h" #include "hw/sysbus.h" /* Mainy used by iocsr read and write */
@@ -31,7 +33,7 @@#define IPI_MBX_NUM 4#define TYPE_LOONGSON_IPI "loongson_ipi" -OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPIState, LOONGSON_IPI) +OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI) typedef struct IPICore { LoongsonIPIState *ipi;
@@ -45,8 +47,16 @@ typedef struct IPICore {qemu_irq irq; } IPICore; +struct LoongsonIPIClass { +LoongsonIPICommonClass parent_class; + +DeviceRealize parent_realize; +DeviceUnrealize parent_unrealize; +}; +struct LoongsonIPIState { -SysBusDevice parent_obj; +LoongsonIPICommonState parent_obj; +MemoryRegion ipi_iocsr_mem;MemoryRegion ipi64_iocsr_mem;uint32_t num_cpu;
include/hw/intc/loongson_ipi_common.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Loongson ipi interrupt header files +* +* Copyright (C) 2021 Loongson Technology Corporation Limited +*/ + +#ifndef HW_LOONGSON_IPI_COMMON_H +#define HW_LOONGSON_IPI_COMMON_H + +#include "qom/object.h" +#include "hw/sysbus.h" + +#define TYPE_LOONGSON_IPI_COMMON "loongson_ipi_common" +OBJECT_DECLARE_TYPE (LoongsonIPICommonState, + LoongsonIPICommonClass, LOONGSON_IPI_COMMON) + +struct LoongsonIPICommonState { +SysBusDevice parent_obj; +}; + +struct LoongsonIPICommonClass { +SysBusDeviceClass parent_class; +}; + +#endif
hw/intc/loongson_ipi.c +7 -3
@@ -374,9 +374,12 @@ static Property ipi_properties[] = {static void loongson_ipi_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +LoongsonIPIClass *lic =LOONGSON_IPI_CLASS (klass); - dc->realize = loongson_ipi_realize; - dc->unrealize = loongson_ipi_unrealize; +device_class_set_parent_realize (dc, loongson_ipi_realize, + &lic->parent_realize); +device_class_set_parent_unrealize (dc, loongson_ipi_unrealize, + &lic->parent_unrealize);device_class_set_props (dc, ipi_properties); dc->vmsd = &vmstate_loongson_ipi; }
@@ -384,8 +387,9 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data)static const TypeInfo loongson_ipi_types[] = { { .name =TYPE_LOONGSON_IPI , - .parent =TYPE_SYS_BUS_DEVICE , + .parent =TYPE_LOONGSON_IPI_COMMON , .instance_size =sizeof (LoongsonIPIState), + .class_size =sizeof (LoongsonIPIClass), .class_init = loongson_ipi_class_init, } };
hw/intc/loongson_ipi_common.c new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Loongson IPI interrupt common support +* +* Copyright (C) 2021 Loongson Technology Corporation Limited +*/ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "hw/intc/loongson_ipi_common.h" + +static const TypeInfo loongarch_ipi_common_types[] = { + { + .name =TYPE_LOONGSON_IPI_COMMON , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (LoongsonIPICommonState), + .class_size =sizeof (LoongsonIPICommonClass), + .abstract = true, + } +}; + +DEFINE_TYPES (loongarch_ipi_common_types)
hw/intc/Kconfig +4 -0
@@ -87,8 +87,12 @@ config GOLDFISH_PIC config M68K_IRQC bool +config LOONGSON_IPI_COMMON + bool + config LOONGSON_IPI bool + select LOONGSON_IPI_COMMON config LOONGARCH_PCH_PIC bool
hw/intc/meson.build +1 -0
@@ -69,6 +69,7 @@ specific_ss.add(when: 'CONFIG_XIVE', if_true: files('xive.c')) specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'], if_true: files('spapr_xive_kvm.c')) specific_ss.add(when: 'CONFIG_M68K_IRQC', if_true: files('m68k_irqc.c')) +specific_ss.add(when: 'CONFIG_LOONGSON_IPI_COMMON', if_true: files('loongson_ipi_common.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI', if_true: files('loongson_ipi.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_PIC', if_true: files('loongarch_pch_pic.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_MSI', if_true: files('loongarch_pch_msi.c'))
Signature · 1 line
2.45.2
[PULL 06/28] hw/intc/loongson_ipi: Move IPICore structure to loongson_ipi_common.h
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Move the IPICore structure and corresponding common fields of LoongsonIPICommonState to "hw/intc/loongson_ipi_common.h".
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi.h | 17 --------- include/hw/intc/loongson_ipi_common.h | 18 ++++++++++ hw/intc/loongson_ipi.c | 50 ++++++--------------------- hw/intc/loongson_ipi_common.c | 42 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 57 deletions(-)
include/hw/intc/loongson_ipi.h +0 -17
@@ -12,22 +12,9 @@#include "hw/intc/loongson_ipi_common.h" #include "hw/sysbus.h" -#define IPI_MBX_NUM 4 -#define TYPE_LOONGSON_IPI "loongson_ipi" OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI) -typedef struct IPICore { -LoongsonIPIState *ipi; -uint32_t status; -uint32_t en; -uint32_t set; -uint32_t clear; -/* 64bit buf divide into 2 32bit buf */ -uint32_t buf[IPI_MBX_NUM *2 ]; -qemu_irq irq; -}IPICore ; -struct LoongsonIPIClass {LoongsonIPICommonClass parent_class;
@@ -39,10 +26,6 @@ struct LoongsonIPIState {LoongsonIPICommonState parent_obj; MemoryRegion *ipi_mmio_mem; -MemoryRegion ipi_iocsr_mem; -MemoryRegion ipi64_iocsr_mem; -uint32_t num_cpu; - IPICore *cpu; };#endif
include/hw/intc/loongson_ipi_common.h +18 -0
@@ -11,12 +11,30 @@#include "qom/object.h" #include "hw/sysbus.h" +#define IPI_MBX_NUM 4 +#define TYPE_LOONGSON_IPI_COMMON "loongson_ipi_common"OBJECT_DECLARE_TYPE (LoongsonIPICommonState, LoongsonIPICommonClass, LOONGSON_IPI_COMMON) +typedef struct IPICore { +LoongsonIPICommonState *ipi; +uint32_t status; +uint32_t en; +uint32_t set; +uint32_t clear; +/* 64bit buf divide into 2 32-bit buf */ +uint32_t buf[IPI_MBX_NUM *2 ]; +qemu_irq irq; +}IPICore ; +struct LoongsonIPICommonState {SysBusDevice parent_obj; + +MemoryRegion ipi_iocsr_mem; +MemoryRegion ipi64_iocsr_mem; +uint32_t num_cpu; +IPICore *cpu; };struct LoongsonIPICommonClass {
hw/intc/loongson_ipi.c +10 -40
106 lines not on this page · raw message
hw/intc/loongson_ipi_common.c +42 -0
54 lines not on this page · raw message
Signature · 1 line
2.45.2
[PULL 08/28] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Allow Loongson IPI implementations to have their own get_iocsr_as() handler.
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi_common.h | 2 ++ hw/intc/loongson_ipi.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-)
include/hw/intc/loongson_ipi_common.h +2 -0
@@ -39,6 +39,8 @@ struct LoongsonIPICommonState {struct LoongsonIPICommonClass {SysBusDeviceClass parent_class; + +AddressSpace *(*get_iocsr_as)(CPUState *cpu); };/* Mainy used by iocsr read and write */
hw/intc/loongson_ipi.c +12 -4
@@ -75,24 +75,30 @@ static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr,return loongson_ipi_core_readl (s, addr, data, size, attrs); } -static AddressSpace *get_cpu_iocsr_as (CPUState *cpu) -{#ifdef TARGET_LOONGARCH64 +static AddressSpace *get_iocsr_as (CPUState *cpu) +{return LOONGARCH_CPU (cpu)->env.address_space_iocsr; +}#endif +#ifdef TARGET_MIPS +static AddressSpace *get_iocsr_as (CPUState *cpu) +{if (ase_lcsr_available (&MIPS_CPU (cpu)->env)) {return &MIPS_CPU (cpu)->env.iocsr.as; } -#endif +return NULL ; } +#endif static MemTxResult send_ipi_data (LoongsonIPICommonState *ipi,CPUState *cpu,uint64_t val,hwaddr addr,MemTxAttrs attrs) { +LoongsonIPICommonClass *licc =LOONGSON_IPI_COMMON_GET_CLASS (ipi);int i, mask =0 , data =0 ; -AddressSpace *iocsr_as =get_cpu_iocsr_as (cpu); +AddressSpace *iocsr_as = licc->get_iocsr_as (cpu);if (!iocsr_as) {return MEMTX_DECODE_ERROR ;
@@ -354,11 +360,13 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data) {DeviceClass *dc =DEVICE_CLASS (klass);LoongsonIPIClass *lic =LOONGSON_IPI_CLASS (klass); +LoongsonIPICommonClass *licc =LOONGSON_IPI_COMMON_CLASS (klass);device_class_set_parent_realize (dc, loongson_ipi_realize, &lic->parent_realize);device_class_set_parent_unrealize (dc, loongson_ipi_unrealize, &lic->parent_unrealize); + licc->get_iocsr_as = get_iocsr_as; }static const TypeInfo loongson_ipi_types[] = {
Signature · 1 line
2.45.2
[PULL 10/28] hw/intc/loongson_ipi: Expose loongson_ipi_core_read/write helpers
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
In order to access loongson_ipi_core_read/write helpers from loongson_ipi_common.c in the next commit, make their prototype declaration public.
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi_common.h | 6 ++++++ hw/intc/loongson_ipi.c | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-)
include/hw/intc/loongson_ipi_common.h +6 -0
@@ -10,6 +10,7 @@#include "qom/object.h" #include "hw/sysbus.h" +#include "exec/memattrs.h" #define IPI_MBX_NUM 4
@@ -44,6 +45,11 @@ struct LoongsonIPICommonClass {CPUState *(*cpu_by_arch_id)(int64_t id); }; +MemTxResult loongson_ipi_core_readl (void *opaque,hwaddr addr,uint64_t *data, +unsigned size,MemTxAttrs attrs); +MemTxResult loongson_ipi_core_writel (void *opaque,hwaddr addr,uint64_t val, +unsigned size,MemTxAttrs attrs); +/* Mainy used by iocsr read and write */ #define SMP_IPI_MAILBOX 0x1000ULL
hw/intc/loongson_ipi.c +4 -6
@@ -24,9 +24,8 @@#endif #include "trace.h" -static MemTxResult loongson_ipi_core_readl (void *opaque,hwaddr addr, -uint64_t *data, -unsigned size,MemTxAttrs attrs) +MemTxResult loongson_ipi_core_readl (void *opaque,hwaddr addr,uint64_t *data, +unsigned size,MemTxAttrs attrs) {IPICore *s = opaque;uint64_t ret =0 ;
@@ -165,9 +164,8 @@ static MemTxResult any_send(LoongsonIPICommonState *ipi,return send_ipi_data (ipi, cs, val, addr, attrs); } -static MemTxResult loongson_ipi_core_writel (void *opaque,hwaddr addr, -uint64_t val,unsigned size, -MemTxAttrs attrs) +MemTxResult loongson_ipi_core_writel (void *opaque,hwaddr addr,uint64_t val, +unsigned size,MemTxAttrs attrs) {IPICore *s = opaque;LoongsonIPICommonState *ipi = s->ipi;
Signature · 1 line
2.45.2
[PULL 12/28] hw/intc/loongarch_ipi: Add loongarch IPI support
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Loongarch IPI is added here, it inherits from class TYPE_LOONGSON_IPI_COMMON, and two interfaces get_iocsr_as() and cpu_by_arch_id() are added for Loongarch 3A5000 machine. It can be used when ipi is emulated in userspace with KVM mode.
Message-Id: <[email protected]>
--- include/hw/intc/loongarch_ipi.h | 25 ++++++++++++ hw/intc/loongarch_ipi.c | 68 +++++++++++++++++++++++++++++++++ hw/intc/Kconfig | 4 ++ hw/intc/meson.build | 1 + 4 files changed, 98 insertions(+) create mode 100644 include/hw/intc/loongarch_ipi.h create mode 100644 hw/intc/loongarch_ipi.c
include/hw/intc/loongarch_ipi.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* LoongArch IPI interrupt header files +* +* Copyright (C) 2024 Loongson Technology Corporation Limited +*/ + +#ifndef HW_LOONGARCH_IPI_H +#define HW_LOONGARCH_IPI_H + +#include "qom/object.h" +#include "hw/intc/loongson_ipi_common.h" + +#define TYPE_LOONGARCH_IPI "loongarch_ipi" +OBJECT_DECLARE_TYPE(LoongarchIPIState, LoongarchIPIClass, LOONGARCH_IPI) + +struct LoongarchIPIState { +LoongsonIPICommonState parent_obj; +}; + +struct LoongarchIPIClass { +LoongsonIPICommonClass parent_class; +}; + +#endif
hw/intc/loongarch_ipi.c new file +68 -0
68 lines not on this page · raw message
hw/intc/Kconfig +4 -0
@@ -94,6 +94,10 @@ config LOONGSON_IPI bool select LOONGSON_IPI_COMMON +config LOONGARCH_IPI + bool + select LOONGSON_IPI_COMMON + config LOONGARCH_PCH_PIC bool select UNIMP
hw/intc/meson.build +1 -0
@@ -71,6 +71,7 @@ specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'], specific_ss.add(when: 'CONFIG_M68K_IRQC', if_true: files('m68k_irqc.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI_COMMON', if_true: files('loongson_ipi_common.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI', if_true: files('loongson_ipi.c')) +specific_ss.add(when: 'CONFIG_LOONGARCH_IPI', if_true: files('loongarch_ipi.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_PIC', if_true: files('loongarch_pch_pic.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_MSI', if_true: files('loongarch_pch_msi.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_EXTIOI', if_true: files('loongarch_extioi.c'))
Signature · 1 line
2.45.2
[PULL 09/28] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::cpu_by_arch_id handler
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Allow Loongson IPI implementations to have their own cpu_by_arch_id() handler.
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi_common.h | 1 + hw/intc/loongson_ipi.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
include/hw/intc/loongson_ipi_common.h +1 -0
@@ -41,6 +41,7 @@ struct LoongsonIPICommonClass {SysBusDeviceClass parent_class; AddressSpace *(*get_iocsr_as)(CPUState *cpu); +CPUState *(*cpu_by_arch_id)(int64_t id); };/* Mainy used by iocsr read and write */
hw/intc/loongson_ipi.c +7 -3
@@ -128,12 +128,13 @@ static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu,static MemTxResult mail_send (LoongsonIPICommonState *ipi,uint64_t val,MemTxAttrs attrs) { +LoongsonIPICommonClass *licc =LOONGSON_IPI_COMMON_GET_CLASS (ipi);uint32_t cpuid;hwaddr addr;CPUState *cs; cpuid =extract32 (val,16 ,10 ); - cs =cpu_by_arch_id (cpuid); + cs = licc->cpu_by_arch_id (cpuid);if (cs ==NULL ) {return MEMTX_DECODE_ERROR ; }
@@ -147,12 +148,13 @@ static MemTxResult mail_send(LoongsonIPICommonState *ipi,static MemTxResult any_send (LoongsonIPICommonState *ipi,uint64_t val,MemTxAttrs attrs) { +LoongsonIPICommonClass *licc =LOONGSON_IPI_COMMON_GET_CLASS (ipi);uint32_t cpuid;hwaddr addr;CPUState *cs; cpuid =extract32 (val,16 ,10 ); - cs =cpu_by_arch_id (cpuid); + cs = licc->cpu_by_arch_id (cpuid);if (cs ==NULL ) {return MEMTX_DECODE_ERROR ; }
@@ -169,6 +171,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, {IPICore *s = opaque;LoongsonIPICommonState *ipi = s->ipi; +LoongsonIPICommonClass *licc =LOONGSON_IPI_COMMON_GET_CLASS (ipi);int index =0 ;uint32_t cpuid;uint8_t vector;
@@ -203,7 +206,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, cpuid =extract32 (val,16 ,10 );/* IPI status vector */ vector =extract8 (val,0 ,5 ); - cs =cpu_by_arch_id (cpuid); + cs = licc->cpu_by_arch_id (cpuid);if (cs ==NULL || cs->cpu_index >= ipi->num_cpu) {return MEMTX_DECODE_ERROR ; }
@@ -367,6 +370,7 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data)device_class_set_parent_unrealize (dc, loongson_ipi_unrealize, &lic->parent_unrealize); licc->get_iocsr_as = get_iocsr_as; + licc->cpu_by_arch_id = cpu_by_arch_id; }static const TypeInfo loongson_ipi_types[] = {
Signature · 1 line
2.45.2
[PULL 05/28] hw/intc/loongson_ipi: Move IPICore::mmio_mem to LoongsonIPIState
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
It is easier to manage one array of MMIO MR rather than one per vCPU.
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi.h | 2 +- hw/intc/loongson_ipi.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
include/hw/intc/loongson_ipi.h +1 -1
@@ -19,7 +19,6 @@ OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI) typedef struct IPICore { LoongsonIPIState *ipi; - MemoryRegion *ipi_mmio_mem; uint32_t status; uint32_t en; uint32_t set;
@@ -39,6 +38,7 @@ struct LoongsonIPIClass {struct LoongsonIPIState {LoongsonIPICommonState parent_obj; +MemoryRegion *ipi_mmio_mem;MemoryRegion ipi_iocsr_mem;MemoryRegion ipi64_iocsr_mem;uint32_t num_cpu;
hw/intc/loongson_ipi.c +7 -3
@@ -320,12 +320,12 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp)return ; } + s->ipi_mmio_mem =g_new0 (MemoryRegion, s->num_cpu);for (unsigned i =0 ; i < s->num_cpu; i++) { - s->cpu[i].ipi_mmio_mem =g_new0 (MemoryRegion,1 ); g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); -memory_region_init_io (s->cpu[i].ipi_mmio_mem,OBJECT (dev), +memory_region_init_io (&s->ipi_mmio_mem[i],OBJECT (dev), &loongson_ipi_core_ops, &s->cpu[i], name,0x48 ); -sysbus_init_mmio (sbd, s->cpu[i].ipi_mmio_mem); +sysbus_init_mmio (sbd, &s->ipi_mmio_mem[i]); } }
@@ -338,6 +338,10 @@ static void loongson_ipi_common_unrealize(DeviceState *dev)static void loongson_ipi_unrealize (DeviceState *dev) { +LoongsonIPIState *s =LOONGSON_IPI (dev); + +g_free (s->ipi_mmio_mem); +loongson_ipi_common_unrealize (dev); }
Signature · 1 line
2.45.2
[PULL 11/28] hw/intc/loongson_ipi: Move common code to loongson_ipi_common.c
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Move the common code from loongson_ipi.c to loongson_ipi_common.c, call parent_realize() instead of loongson_ipi_common_realize() in loongson_ipi_realize().
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi_common.h | 2 + hw/intc/loongson_ipi.c | 279 +------------------------ hw/intc/loongson_ipi_common.c | 283 ++++++++++++++++++++++++++ 3 files changed, 289 insertions(+), 275 deletions(-)
include/hw/intc/loongson_ipi_common.h +2 -0
@@ -41,6 +41,8 @@ struct LoongsonIPICommonState {struct LoongsonIPICommonClass {SysBusDeviceClass parent_class; +DeviceRealize parent_realize; +DeviceUnrealize parent_unrealize;AddressSpace *(*get_iocsr_as)(CPUState *cpu);CPUState *(*cpu_by_arch_id)(int64_t id); };
hw/intc/loongson_ipi.c +4 -275
316 lines not on this page · raw message
hw/intc/loongson_ipi_common.c +283 -0
298 lines not on this page · raw message
Signature · 1 line
2.45.2
[PULL 15/28] hw/sd/sdcard: Explicit dummy byte value
In reply to Philippe Mathieu-DaudéOn error the DAT lines are left unmodified to their previous states. QEMU returns 0x00 for convenience.
Message-Id: <[email protected]>
--- hw/sd/sd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
hw/sd/sd.c +7 -5
@@ -2478,20 +2478,22 @@ void sd_write_byte(SDState *sd, uint8_t value)uint8_t sd_read_byte (SDState *sd) {/* TODO: Append CRCs */ +const uint8_t dummy_byte =0x00 ;uint8_t ret;uint32_t io_len;if (!sd->blk || !blk_is_inserted (sd->blk) || !sd->enable) -return 0x00 ; +return dummy_byte;if (sd->state != sd_sendingdata_state) {qemu_log_mask (LOG_GUEST_ERROR ,"%s: not in Sending-Data state\n" , __func__); -return 0x00 ; +return dummy_byte; } -if (sd->card_status & (ADDRESS_ERROR |WP_VIOLATION )) -return 0x00 ; +if (sd->card_status & (ADDRESS_ERROR |WP_VIOLATION )) { +return dummy_byte; + } io_len =sd_blk_len (sd);
@@ -2517,7 +2519,7 @@ uint8_t sd_read_byte(SDState *sd)if (sd->data_offset ==0 ) {if (!address_in_range (sd,"READ_MULTIPLE_BLOCK" , sd->data_start, io_len)) { -return 0x00 ; +return dummy_byte; }sd_blk_read (sd, sd->data_start, io_len); }
Signature · 1 line
2.45.2
[PULL 24/28] ui/console: Note in '-display help' that some backends support suboptions
In reply to Philippe Mathieu-DaudéFrom: Peter Maydell <[email protected]>
Currently '-display help' only prints the available backends. Some of those backends support suboptions (e.g. '-display gtk,gl=on'). Mention that in the help output, and point the user to where they might be able to find more information about the suboptions. The new output looks like this:
$ qemu-system-aarch64 -display help Available display backend types: none gtk sdl egl-headless curses spice-app dbus
Some display backends support suboptions, which can be set with
-display backend,option=value,option=value...
For a short list of the suboptions for each display, see the top-level -help output; more detail is in the documentation.
Message-ID: <[email protected]>
--- ui/console.c | 5 +++++ 1 file changed, 5 insertions(+)
ui/console.c +5 -0
@@ -1632,4 +1632,9 @@ void qemu_display_help(void)printf ("%s\n" ,DisplayType_str (dpys[idx]->type)); } } +printf ("\n" +"Some display backends support suboptions, which can be set with\n" +" -display backend,option=value,option=value...\n" +"For a short list of the suboptions for each display, see the " +"top-level -help output; more detail is in the documentation.\n" ); }
Signature · 1 line
2.45.2
[PULL 17/28] hw/sd/sdhci: Reset @data_count index on invalid ADMA transfers
In reply to Philippe Mathieu-DaudéWe neglected to clear the @data_count index on ADMA error, allowing to trigger assertion in sdhci_read_dataport() or sdhci_write_dataport().
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2455
Message-Id: <[email protected]>
--- hw/sd/sdhci.c | 1 + 1 file changed, 1 insertion(+)
hw/sd/sdhci.c +1 -0
@@ -846,6 +846,7 @@ static void sdhci_do_adma(SDHCIState *s) } }if (res !=MEMTX_OK ) { + s->data_count =0 ;if (s->errintstsen &SDHC_EISEN_ADMAERR ) {trace_sdhci_error ("Set ADMA error flag" ); s->errintsts |=SDHC_EIS_ADMAERR ;
Signature · 1 line
2.45.2
[PULL 16/28] hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state
In reply to Philippe Mathieu-DaudéGuest should not try to read the DAT lines from invalid command state. If it still insists to do so, return a dummy value.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2454
Message-Id: <[email protected]>
--- hw/sd/sd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/sd/sd.c +3 -1
@@ -2540,7 +2540,9 @@ uint8_t sd_read_byte(SDState *sd)break ;default : -g_assert_not_reached (); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: DAT read illegal for command %s\n" , + __func__, sd->last_cmd_name); +return dummy_byte; }return ret;
Signature · 1 line
2.45.2
[PULL 25/28] hw/pci-host/gt64120: Set PCI base address register write mask
In reply to Philippe Mathieu-DaudéWhen booting Linux we see:
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff] pci_bus 0000:00: root bus resource [io 0x1000-0x1fffff] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff] pci 0000:00:00.0: [11ab:4620] type 00 class 0x060000
pci 0000:00:00.0: [Firmware Bug]: reg 0x14: invalid BAR (can't size) pci 0000:00:00.0: [Firmware Bug]: reg 0x18: invalid BAR (can't size) pci 0000:00:00.0: [Firmware Bug]: reg 0x1c: invalid BAR (can't size) pci 0000:00:00.0: [Firmware Bug]: reg 0x20: invalid BAR (can't size) pci 0000:00:00.0: [Firmware Bug]: reg 0x24: invalid BAR (can't size)
This is due to missing base address register write mask. Add it to get:
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff] pci_bus 0000:00: root bus resource [io 0x1000-0x1fffff] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff] pci 0000:00:00.0: [11ab:4620] type 00 class 0x060000
pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x00000fff pref] pci 0000:00:00.0: reg 0x14: [mem 0x01000000-0x01000fff pref] pci 0000:00:00.0: reg 0x18: [mem 0x1c000000-0x1c000fff]
pci 0000:00:00.0: reg 0x1c: [mem 0x1f000000-0x1f000fff]
pci 0000:00:00.0: reg 0x20: [mem 0x1be00000-0x1be00fff]
pci 0000:00:00.0: reg 0x24: [io 0x14000000-0x14000fff]
Since this device is only used by MIPS machines which aren't versioned, we don't need to update migration compat machinery.
Mention the datasheet referenced. Remove the "Malta assumptions ahead" comment since the reset values from the datasheet are used.
Message-Id: <[email protected]>
--- hw/pci-host/gt64120.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
hw/pci-host/gt64120.c +13 -1
@@ -1,6 +1,8 @@/* * QEMU GT64120 PCI host * +* (Datasheet GT-64120 Rev 1.4 from Sep 14, 1999) +* * Copyright (c) 2006,2007 Aurelien Jarno * * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1213,17 +1215,27 @@ static void gt64120_realize(DeviceState *dev, Error **errp)static void gt64120_pci_realize (PCIDevice *d,Error **errp) { -/* FIXME: Malta specific hw assumptions ahead */ +/* Values from chapter 17.16 "PCI Configuration" */ +pci_set_word (d->config +PCI_COMMAND ,0 );pci_set_word (d->config +PCI_STATUS ,PCI_STATUS_FAST_BACK |PCI_STATUS_DEVSEL_MEDIUM );pci_config_set_prog_interface (d->config,0 ); + +pci_set_long (d->wmask +PCI_BASE_ADDRESS_0 ,0xfffff008 );/* SCS[1:0] */ +pci_set_long (d->wmask +PCI_BASE_ADDRESS_1 ,0xfffff008 );/* SCS[3:2] */ +pci_set_long (d->wmask +PCI_BASE_ADDRESS_2 ,0xfffff008 );/* CS[2:0] */ +pci_set_long (d->wmask +PCI_BASE_ADDRESS_3 ,0xfffff008 );/* CS[3], BootCS */ +pci_set_long (d->wmask +PCI_BASE_ADDRESS_4 ,0xfffff000 );/* ISD MMIO */ +pci_set_long (d->wmask +PCI_BASE_ADDRESS_5 ,0xfffff001 );/* ISD I/O */ +pci_set_long (d->config +PCI_BASE_ADDRESS_0 ,0x00000008 );pci_set_long (d->config +PCI_BASE_ADDRESS_1 ,0x01000008 );pci_set_long (d->config +PCI_BASE_ADDRESS_2 ,0x1c000000 );pci_set_long (d->config +PCI_BASE_ADDRESS_3 ,0x1f000000 );pci_set_long (d->config +PCI_BASE_ADDRESS_4 ,0x14000000 );pci_set_long (d->config +PCI_BASE_ADDRESS_5 ,0x14000001 ); +pci_set_byte (d->config +0x3d ,0x01 ); }
Signature · 1 line
2.45.2
[PULL 18/28] hw/block/pflash_cfi01: Don't decrement pfl->counter below 0
In reply to Philippe Mathieu-DaudéFrom: Peter Maydell <[email protected]>
In pflash_write() Coverity points out that we can decrement the unsigned pfl->counter below zero, which makes it wrap around. In fact this is harmless, because if pfl->counter is 0 at this point we also increment pfl->wcycle to 3, and the wcycle == 3 handling doesn't look at counter; the only way back into code which looks at the counter value is via wcycle == 1, which will reinitialize the counter. But it's arguably a little clearer to break early in the "counter == 0" if(), to avoid the decrement-below-zero.
Resolves: Coverity CID 1547611
Message-ID: <[email protected]>
--- hw/block/pflash_cfi01.c | 1 + 1 file changed, 1 insertion(+)
hw/block/pflash_cfi01.c +1 -0
@@ -614,6 +614,7 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,if (!pfl->counter) {trace_pflash_write (pfl->name,"block write finished" ); pfl->wcycle++; +break ; } pfl->counter--;
Signature · 1 line
2.45.2
[PULL 27/28] docs/specs/pci-ids: Add missing devices
In reply to Philippe Mathieu-DaudéFrom: George Matsumura <[email protected]>
Add the missing devices 1b36:000c (PCIe root port) and 1b36:000e (PCIe-to-PCI bridge).
Message-ID: <[email protected]>
--- docs/specs/pci-ids.rst | 4 ++++ 1 file changed, 4 insertions(+)
docs/specs/pci-ids.rst +4 -0
@@ -82,8 +82,12 @@ PCI devices (other than virtio): PCI-PCI bridge (multiseat) 1b36:000b PCIe Expander Bridge (-device pxb-pcie) +1b36:000c + PCIe Root Port (``-device pcie-root-port``) 1b36:000d PCI xhci usb host adapter +1b36:000e + PCIe-to-PCI bridge (``-device pcie-pci-bridge``) 1b36:000f mdpy (mdev sample device), ``linux/samples/vfio-mdev/mdpy.c`` 1b36:0010
Signature · 1 line
2.45.2
[PULL 22/28] hw/display/virtio-gpu: Improve "opengl is not available" error message
In reply to Philippe Mathieu-DaudéFrom: Peter Maydell <[email protected]>
If the user tries to use the virtio-gpu-gl device but the display backend doesn't have OpenGL support enabled, we currently print a rather uninformative error message:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl qemu-system-aarch64: -device virtio-gpu-gl: opengl is not available
Since OpenGL is not enabled on display frontends by default, users are quite likely to run into this. Improve the error message to be more specific and to suggest to the user a path forward.
Note that the case of "user tried to enable OpenGL but the display backend doesn't handle it" is caught elsewhere first, so we can assume that isn't the problem:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by the display
(Use of error_append_hint() requires us to add an ERRP_GUARD() to the function, as noted in include/qapi/error.h.)
With this commit we now produce the hopefully more helpful error:
$ ./build/x86/qemu-system-aarch64 -M virt -device virtio-gpu-gl qemu-system-aarch64: -device virtio-gpu-gl: The display backend does not have OpenGL support enabled It can be enabled with '-display BACKEND,gl=on' where BACKEND is the name of the display backend to use.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2443
Message-ID: <[email protected]>
--- hw/display/virtio-gpu-gl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
hw/display/virtio-gpu-gl.c +7 -1
@@ -106,6 +106,7 @@ static void virtio_gpu_gl_reset(VirtIODevice *vdev)static void virtio_gpu_gl_device_realize (DeviceState *qdev,Error **errp) { +ERRP_GUARD ();VirtIOGPU *g =VIRTIO_GPU (qdev);#if HOST_BIG_ENDIAN
@@ -119,7 +120,12 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp) }if (!display_opengl) { -error_setg (errp,"opengl is not available" ); +error_setg (errp, +"The display backend does not have OpenGL support enabled" ); +error_append_hint (errp, +"It can be enabled with '-display BACKEND,gl=on' " +"where BACKEND is the name of the display backend " +"to use.\n" );return ; }
Signature · 1 line
2.45.2
[PULL 23/28] system/vl.c: Expand OpenGL related errors
In reply to Philippe Mathieu-DaudéFrom: Peter Maydell <[email protected]>
Expand the OpenGL related error messages we produce for various "OpenGL not present/not supported" cases, to hopefully guide the user towards how to fix things.
Now if the user tries to enable GL on a backend that doesn't support it the error message is a bit more precise:
$ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by display backend 'curses'
Message-ID: <[email protected]>
--- system/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
system/vl.c +3 -2
@@ -1973,9 +1973,10 @@ static void qemu_create_early_backends(void)if (dpy.has_gl && dpy.gl !=DISPLAYGL_MODE_OFF && display_opengl ==0 ) {#if defined(CONFIG_OPENGL ) -error_report ("OpenGL is not supported by the display" ); +error_report ("OpenGL is not supported by display backend '%s'" , +DisplayType_str (dpy.type));#else -error_report ("OpenGL support is disabled" ); +error_report ("OpenGL support was disabled when QEMU was compiled" );#endif exit (1 ); }
Signature · 1 line
2.45.2
Hi,
Bigger PR than I expected for RC2, but unfortunately the LoongArch Virt is broken so requires these patches (it took me long to figure all the issues with them).
The following changes since commit e7207a9971dd41618b407030902b0b2256deb664:
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2024-08-06 08:02:34 +1000)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20240806
for you to fetch changes up to e006f0186bff4c66d3dd7a34e08fdae81d606480:
docs/specs/pci-ids: Fix markup (2024-08-06 10:22:52 +0200)
----------------------------------------------------------------
Misc HW & UI patches
- Replace Loongson IPI with LoongArch IPI on LoongArch Virt machine (Bibo)
- SD card: Do not abort when reading DAT lines on invalid cmd state (Phil)
- SDHCI: Reset @data_count index on invalid ADMA transfers (Phil)
- Don't decrement PFlash counter below 0 (Peter)
- Explicit a 8bit truncate on IDE ATAPI (Peter)
- Silent Coverity warning in ISA FDC (Peter)
- Remove dead code in PCI IDE bmdma_prepare_buf (Peter)
- Improve OpenGL and related display error messages (Peter)
- Set PCI base address register write mask on GC64120 host bridge (Phil)
- List PCIe Root Port and PCIe-to-PCI bridge in QEMU PCI IDs list (George)
----------------------------------------------------------------
Bibo Mao (14):
hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState hw/intc/loongson_ipi: Extract loongson_ipi_common_realize() hw/intc/loongson_ipi: Add TYPE_LOONGSON_IPI_COMMON stub hw/intc/loongson_ipi: Move common definitions to loongson_ipi_common.h hw/intc/loongson_ipi: Move IPICore::mmio_mem to LoongsonIPIState hw/intc/loongson_ipi: Move IPICore structure to loongson_ipi_common.h hw/intc/loongson_ipi: Pass LoongsonIPICommonState to send_ipi_data() hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler hw/intc/loongson_ipi: Add LoongsonIPICommonClass::cpu_by_arch_id
handler
hw/intc/loongson_ipi: Expose loongson_ipi_core_read/write helpers hw/intc/loongson_ipi: Move common code to loongson_ipi_common.c hw/intc/loongarch_ipi: Add loongarch IPI support hw/loongarch/virt: Replace Loongson IPI with LoongArch IPI hw/intc/loongson_ipi: Restrict to MIPS
George Matsumura (2):
docs/specs/pci-ids: Add missing devices
docs/specs/pci-ids: Fix markup
Peter Maydell (7):
hw/block/pflash_cfi01: Don't decrement pfl->counter below 0 hw/ide/atapi: Be explicit that assigning to s->lcyl truncates hw/block/fdc-isa: Assert that isa_fdc_get_drive_max_chs() found
something
hw/ide/pci: Remove dead code from bmdma_prepare_buf() hw/display/virtio-gpu: Improve "opengl is not available" error message system/vl.c: Expand OpenGL related errors
ui/console: Note in '-display help' that some backends support
suboptions
Philippe Mathieu-Daudé (5):
hw/sd/sdcard: Explicit dummy byte value
hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state hw/sd/sdhci: Reset @data_count index on invalid ADMA transfers hw/pci-host/gt64120: Set PCI base address register write mask hw/pci-host/gt64120: Reset config registers during RESET phase
MAINTAINERS | 6 +- docs/specs/pci-ids.rst | 8 +- include/hw/intc/loongarch_ipi.h | 25 ++ include/hw/intc/loongson_ipi.h | 51 +--- include/hw/intc/loongson_ipi_common.h | 74 ++++++ include/hw/loongarch/virt.h | 1 - hw/block/fdc-isa.c | 2 + hw/block/pflash_cfi01.c | 1 + hw/display/virtio-gpu-gl.c | 8 +- hw/ide/atapi.c | 2 +- hw/ide/pci.c | 7 +- hw/intc/loongarch_ipi.c | 68 +++++ hw/intc/loongson_ipi.c | 338 +++---------------------- hw/intc/loongson_ipi_common.c | 347 ++++++++++++++++++++++++++ hw/loongarch/virt.c | 4 +- hw/pci-host/gt64120.c | 23 +- hw/sd/sd.c | 16 +- hw/sd/sdhci.c | 1 + system/vl.c | 5 +- ui/console.c | 5 + hw/intc/Kconfig | 8 + hw/intc/meson.build | 2 + hw/loongarch/Kconfig | 2 +- 23 files changed, 634 insertions(+), 370 deletions(-) create mode 100644 include/hw/intc/loongarch_ipi.h create mode 100644 include/hw/intc/loongson_ipi_common.h create mode 100644 hw/intc/loongarch_ipi.c create mode 100644 hw/intc/loongson_ipi_common.c
Signature · 1 line
2.45.2
[PULL 04/28] hw/intc/loongson_ipi: Move common definitions to loongson_ipi_common.h
From: Bibo Mao <[email protected]>
Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi.h | 18 ------------------ include/hw/intc/loongson_ipi_common.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-)
include/hw/intc/loongson_ipi.h +0 -18
@@ -12,24 +12,6 @@#include "hw/intc/loongson_ipi_common.h" #include "hw/sysbus.h" -/* Mainy used by iocsr read and write */ -#define SMP_IPI_MAILBOX 0x1000ULL -#define CORE_STATUS_OFF 0x0 -#define CORE_EN_OFF 0x4 -#define CORE_SET_OFF 0x8 -#define CORE_CLEAR_OFF 0xc -#define CORE_BUF_20 0x20 -#define CORE_BUF_28 0x28 -#define CORE_BUF_30 0x30 -#define CORE_BUF_38 0x38 -#define IOCSR_IPI_SEND 0x40 -#define IOCSR_MAIL_SEND 0x48 -#define IOCSR_ANY_SEND 0x158 - -#define MAIL_SEND_ADDR (SMP_IPI_MAILBOX + IOCSR_MAIL_SEND) -#define MAIL_SEND_OFFSET 0 -#define ANY_SEND_OFFSET (IOCSR_ANY_SEND - IOCSR_MAIL_SEND) -#define IPI_MBX_NUM 4#define TYPE_LOONGSON_IPI "loongson_ipi"
include/hw/intc/loongson_ipi_common.h +19 -0
@@ -23,4 +23,23 @@ struct LoongsonIPICommonClass { SysBusDeviceClass parent_class; }; +/* Mainy used by iocsr read and write */ +#define SMP_IPI_MAILBOX 0x1000ULL + +#define CORE_STATUS_OFF 0x0 +#define CORE_EN_OFF 0x4 +#define CORE_SET_OFF 0x8 +#define CORE_CLEAR_OFF 0xc +#define CORE_BUF_20 0x20 +#define CORE_BUF_28 0x28 +#define CORE_BUF_30 0x30 +#define CORE_BUF_38 0x38 +#define IOCSR_IPI_SEND 0x40 +#define IOCSR_MAIL_SEND 0x48 +#define IOCSR_ANY_SEND 0x158 + +#define MAIL_SEND_ADDR (SMP_IPI_MAILBOX + IOCSR_MAIL_SEND) +#define MAIL_SEND_OFFSET 0 +#define ANY_SEND_OFFSET (IOCSR_ANY_SEND - IOCSR_MAIL_SEND) +#endif
Signature · 1 line
2.45.2
[PULL 28/28] docs/specs/pci-ids: Fix markup
In reply to Philippe Mathieu-DaudéFrom: George Matsumura <[email protected]>
This fixes the markup of the PCI and PCIe Expander Bridge entries to be consistent with the rest of the file.
Message-ID: <[email protected]>
--- docs/specs/pci-ids.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
docs/specs/pci-ids.rst +2 -2
@@ -77,11 +77,11 @@ PCI devices (other than virtio): 1b36:0008 PCIe host bridge 1b36:0009 - PCI Expander Bridge (-device pxb) + PCI Expander Bridge (``-device pxb``) 1b36:000a PCI-PCI bridge (multiseat) 1b36:000b - PCIe Expander Bridge (-device pxb-pcie) + PCIe Expander Bridge (``-device pxb-pcie``) 1b36:000c PCIe Root Port (``-device pcie-root-port``) 1b36:000d
Signature · 1 line
2.45.2
[PULL 19/28] hw/ide/atapi: Be explicit that assigning to s->lcyl truncates
In reply to Philippe Mathieu-DaudéFrom: Peter Maydell <[email protected]>
In ide_atapi_cmd_reply_end() we calculate a 16-bit size, and then assign its two halves to s->lcyl and s->hcyl like this:
s->lcyl = size;
s->hcyl = size >> 8;Coverity warns that the first line here can overflow the 8-bit s->lcyl variable. This is true, and in this case we're deliberately only after the low 8 bits of the value. The code is clearer to both humans and Coverity if we're explicit that we only wanted the low 8 bits, though.
Resolves: Coverity CID 1547621
Message-ID: <[email protected]>
--- hw/ide/atapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ide/atapi.c +1 -1
@@ -265,7 +265,7 @@ void ide_atapi_cmd_reply_end(IDEState *s) byte_count_limit--; size = byte_count_limit; } - s->lcyl = size; + s->lcyl = size &0xff ; s->hcyl = size >>8 ; s->elementary_transfer_size = size;/* we cannot transmit more than one sector at a time */
Signature · 1 line
2.45.2
[PULL 13/28] hw/loongarch/virt: Replace Loongson IPI with LoongArch IPI
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Loongarch IPI inherits from class LoongsonIPICommonClass, and it only contains Loongarch 3A5000 virt machine specific interfaces, rather than mix different machine implementations together.
Message-Id: <[email protected]>
--- include/hw/loongarch/virt.h | 1 - hw/loongarch/virt.c | 4 ++-- hw/loongarch/Kconfig | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-)
include/hw/loongarch/virt.h +0 -1
@@ -11,7 +11,6 @@#include "target/loongarch/cpu.h" #include "hw/boards.h" #include "qemu/queue.h" -#include "hw/intc/loongson_ipi.h" #include "hw/block/flash.h" #include "hw/loongarch/boot.h"
hw/loongarch/virt.c +2 -2
@@ -23,7 +23,7 @@#include "net/net.h" #include "hw/loader.h" #include "elf.h" -#include "hw/intc/loongson_ipi.h" +#include "hw/intc/loongarch_ipi.h" #include "hw/intc/loongarch_extioi.h" #include "hw/intc/loongarch_pch_pic.h" #include "hw/intc/loongarch_pch_msi.h"
@@ -788,7 +788,7 @@ static void virt_irq_init(LoongArchVirtMachineState *lvms)*/ /* Create IPI device */ - ipi =qdev_new (TYPE_LOONGSON_IPI ); + ipi =qdev_new (TYPE_LOONGARCH_IPI );qdev_prop_set_uint32 (ipi,"num-cpu" , ms->smp.cpus);sysbus_realize_and_unref (SYS_BUS_DEVICE (ipi), &error_fatal);
hw/loongarch/Kconfig +1 -1
@@ -12,7 +12,7 @@ config LOONGARCH_VIRT select SERIAL select VIRTIO_PCI select PLATFORM_BUS - select LOONGSON_IPI + select LOONGARCH_IPI select LOONGARCH_PCH_PIC select LOONGARCH_PCH_MSI select LOONGARCH_EXTIOI
Signature · 1 line
2.45.2
[PULL 20/28] hw/block/fdc-isa: Assert that isa_fdc_get_drive_max_chs() found something
In reply to Philippe Mathieu-DaudéFrom: Peter Maydell <[email protected]>
Coverity complains about an overflow in isa_fdc_get_drive_max_chs() that can happen if the loop over fd_formats never finds a match, because we initialize *maxc to 0 and then at the end of the function decrement it.
This can't ever actually happen because fd_formats has at least one entry for each FloppyDriveType, so we must at least once find a match and update *maxc, *maxh and *maxs. Assert that we did find a match, which should keep Coverity happy and will also detect possible bugs in the data in fd_formats.
Resolves: Coverity CID 1547663
Message-ID: <[email protected]>
--- hw/block/fdc-isa.c | 2 ++ 1 file changed, 2 insertions(+)
hw/block/fdc-isa.c +2 -0
@@ -147,6 +147,8 @@ static void isa_fdc_get_drive_max_chs(FloppyDriveType type, uint8_t *maxc, *maxs = fdf->last_sect; } } +/* fd_formats must contain at least one entry per FloppyDriveType */ +assert (*maxc); (*maxc)--; }
Signature · 1 line
2.45.2
[PULL 14/28] hw/intc/loongson_ipi: Restrict to MIPS
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Now than LoongArch target can use the TYPE_LOONGARCH_IPI model, restrict TYPE_LOONGSON_IPI to MIPS.
Message-Id: <[email protected]>
--- MAINTAINERS | 2 -- hw/intc/loongson_ipi.c | 14 -------------- 2 files changed, 16 deletions(-)
MAINTAINERS +0 -2
@@ -1251,10 +1251,8 @@ F: hw/loongarch/ F: include/hw/loongarch/virt.h F: include/hw/intc/loongarch_*.h F: include/hw/intc/loongson_ipi_common.h -F: include/hw/intc/loongson_ipi.h F: hw/intc/loongarch_*.c F: hw/intc/loongson_ipi_common.c -F: hw/intc/loongson_ipi.c F: include/hw/pci-host/ls7a.h F: hw/rtc/ls7a_rtc.c F: gdb-xml/loongarch*.xml
hw/intc/loongson_ipi.c +0 -14
@@ -16,22 +16,9 @@#include "exec/address-spaces.h" #include "exec/memory.h" #include "migration/vmstate.h" -#ifdef TARGET_LOONGARCH64 -#include "target/loongarch/cpu.h" -#endif -#ifdef TARGET_MIPS #include "target/mips/cpu.h" -#endif #include "trace.h" -#ifdef TARGET_LOONGARCH64 -static AddressSpace *get_iocsr_as (CPUState *cpu) -{ -return LOONGARCH_CPU (cpu)->env.address_space_iocsr; -} -#endif - -#ifdef TARGET_MIPS static AddressSpace *get_iocsr_as (CPUState *cpu) {if (ase_lcsr_available (&MIPS_CPU (cpu)->env)) {
@@ -40,7 +27,6 @@ static AddressSpace *get_iocsr_as(CPUState *cpu)return NULL ; } -#endif static const MemoryRegionOps loongson_ipi_core_ops = { .read_with_attrs = loongson_ipi_core_readl,
Signature · 1 line
2.45.2
[PULL 26/28] hw/pci-host/gt64120: Reset config registers during RESET phase
In reply to Philippe Mathieu-DaudéReset config values in the device RESET phase, not only once when the device is realized, because otherwise the device can use unknown values at reset.
Since we are adding a new reset method, use the preferred Resettable API (for a simple leaf device reset, a DeviceClass::reset method and a ResettableClass::reset_hold method are essentially identical).
Message-Id: <[email protected]>
--- hw/pci-host/gt64120.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
hw/pci-host/gt64120.c +14 -5
@@ -1217,17 +1217,24 @@ static void gt64120_pci_realize(PCIDevice *d, Error **errp) {/* Values from chapter 17.16 "PCI Configuration" */ -pci_set_word (d->config +PCI_COMMAND ,0 ); -pci_set_word (d->config +PCI_STATUS , -PCI_STATUS_FAST_BACK |PCI_STATUS_DEVSEL_MEDIUM ); -pci_config_set_prog_interface (d->config,0 ); -pci_set_long (d->wmask +PCI_BASE_ADDRESS_0 ,0xfffff008 );/* SCS[1:0] */ pci_set_long (d->wmask +PCI_BASE_ADDRESS_1 ,0xfffff008 );/* SCS[3:2] */ pci_set_long (d->wmask +PCI_BASE_ADDRESS_2 ,0xfffff008 );/* CS[2:0] */ pci_set_long (d->wmask +PCI_BASE_ADDRESS_3 ,0xfffff008 );/* CS[3], BootCS */ pci_set_long (d->wmask +PCI_BASE_ADDRESS_4 ,0xfffff000 );/* ISD MMIO */ pci_set_long (d->wmask +PCI_BASE_ADDRESS_5 ,0xfffff001 );/* ISD I/O */ +} + +static void gt64120_pci_reset_hold (Object *obj,ResetType type) +{ +PCIDevice *d =PCI_DEVICE (obj); + +/* Values from chapter 17.16 "PCI Configuration" */ + +pci_set_word (d->config +PCI_COMMAND ,0 ); +pci_set_word (d->config +PCI_STATUS , +PCI_STATUS_FAST_BACK |PCI_STATUS_DEVSEL_MEDIUM ); +pci_config_set_prog_interface (d->config,0 );pci_set_long (d->config +PCI_BASE_ADDRESS_0 ,0x00000008 );pci_set_long (d->config +PCI_BASE_ADDRESS_1 ,0x01000008 );
@@ -1243,7 +1250,9 @@ static void gt64120_pci_class_init(ObjectClass *klass, void *data) {PCIDeviceClass *k =PCI_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); + rc->phases.hold = gt64120_pci_reset_hold; k->realize = gt64120_pci_realize; k->vendor_id =PCI_VENDOR_ID_MARVELL ; k->device_id =PCI_DEVICE_ID_MARVELL_GT6412X ;
Signature · 1 line
2.45.2
[PULL 21/28] hw/ide/pci: Remove dead code from bmdma_prepare_buf()
In reply to Philippe Mathieu-DaudéFrom: Peter Maydell <[email protected]>
Coverity notes that the code at the end of the loop in bmdma_prepare_buf() is unreachable. This is because in commit 9fbf0fa81fca8f527 ("ide: remove hardcoded 2GiB transactional limit") we removed the only codepath in the loop which could "break" out of it, but didn't notice that this meant we should also remove the code at the end of the loop.
Remove the dead code.
Resolves: Coverity CID 1547772
Message-Id: <[email protected]>
--- hw/ide/pci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/ide/pci.c +2 -5
@@ -237,7 +237,7 @@ static int32_t bmdma_prepare_buf(const IDEDMA *dma, int32_t limit)/* end of table (with a fail safe of one page) */ if (bm->cur_prd_last || (bm->cur_addr - bm->addr) >=BMDMA_PAGE_SIZE ) { -return s->sg.size; +break ; }pci_dma_read (pci_dev, bm->cur_addr, &prd,8 ); bm->cur_addr +=8 ;
@@ -266,10 +266,7 @@ static int32_t bmdma_prepare_buf(const IDEDMA *dma, int32_t limit) s->io_buffer_size += l; } } - -qemu_sglist_destroy (&s->sg); - s->io_buffer_size =0 ; -return -1 ; +return s->sg.size; }/* return 0 if buffer completed */
Signature · 1 line
2.45.2
Richard Henderson
AppliedQuoted 21 lines · Philippe Mathieu-Daudé
Hi,
Bigger PR than I expected for RC2, but unfortunately the LoongArch Virt is broken so requires these patches (it took me long to figure all the issues with them).
The following changes since commit
e7207a9971dd41618b407030902b0b2256deb664:Merge tag 'for-upstream' ofhttps://gitlab.com/bonzini/qemu into staging (2024-08-06 08:02:34 +1000)are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20240806for you to fetch changes up to
e006f0186bff4c66d3dd7a34e08fdae81d606480:docs/specs/pci-ids: Fix markup (2024-08-06 10:22:52 +0200)----------------------------------------------------------------
Misc HW & UI patches
Quoted 10 lines
- Replace Loongson IPI with LoongArch IPI on LoongArch Virt machine (Bibo)
- SD card: Do not abort when reading DAT lines on invalid cmd state (Phil)
- SDHCI: Reset @data_count index on invalid ADMA transfers (Phil)
- Don't decrement PFlash counter below 0 (Peter)
- Explicit a 8bit truncate on IDE ATAPI (Peter)
- Silent Coverity warning in ISA FDC (Peter)
- Remove dead code in PCI IDEbmdma_prepare_buf(Peter)
- Improve OpenGL and related display error messages (Peter)
- Set PCI base address register write mask on GC64120 host bridge (Phil)
- List PCIe Root Port and PCIe-to-PCI bridge in QEMU PCI IDs list (George)
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/9.1 as appropriate.
r~
Re: [PULL 01/28] hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState
In reply to Philippe Mathieu-DaudéPhilippe,
I checkout the latest code, it works well.
Thanks for your efforts.
Regards
Bibo Mao
Quoted 123 lines · Philippe Mathieu-Daudé
From: Bibo Mao <[email protected]>
We'll have to add LoongsonIPIClass in few commits, so rename LoongsonIPI as LoongsonIPIState for clarity.
Signed-off-by Bibo Mao <[email protected]>[PMD: Extracted from bigger commit, added commit description]Co-Developed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Bibo Mao <[email protected]>Tested-by Bibo Mao <[email protected]>Acked-by Song Gao <[email protected]>Reviewed-by Richard Henderson <[email protected]>Reviewed-by Jiaxun Yang <[email protected]>Tested-by Jiaxun Yang <[email protected]>Message-Id: <[email protected]>
--- include/hw/intc/loongson_ipi.h | 6 +++--- hw/intc/loongson_ipi.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)include/hw/intc/loongson_ipi.h +3
-3@@ -31,10 +31,10 @@#define IPI_MBX_NUM 4#define TYPE_LOONGSON_IPI "loongson_ipi" -OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPI, LOONGSON_IPI) +OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPIState, LOONGSON_IPI) typedef struct IPICore { - LoongsonIPI *ipi; + LoongsonIPIState *ipi; MemoryRegion *ipi_mmio_mem; uint32_t status; uint32_t en;@@ -45,7 +45,7 @@ typedef struct IPICore {qemu_irq irq; } IPICore; -struct LoongsonIPI { +struct LoongsonIPIState {SysBusDevice parent_obj;MemoryRegion ipi_iocsr_mem;MemoryRegion ipi64_iocsr_mem;hw/intc/loongson_ipi.c +8
-8@@ -64,7 +64,7 @@ static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr,uint64_t *data, unsigned size, MemTxAttrs attrs) { - LoongsonIPI *ipi = opaque; + LoongsonIPIState *ipi = opaque;IPICore *s;if (attrs.requester_id >= ipi->num_cpu) {@@ -160,7 +160,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, MemTxAttrs attrs) {IPICore *s = opaque; -LoongsonIPI *ipi = s->ipi; +LoongsonIPIState *ipi = s->ipi;int index =0 ;uint32_t cpuid;uint8_t vector;@@ -214,7 +214,7 @@ static MemTxResult loongson_ipi_iocsr_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size, MemTxAttrs attrs) { - LoongsonIPI *ipi = opaque; + LoongsonIPIState *ipi = opaque;IPICore *s;if (attrs.requester_id >= ipi->num_cpu) {@@ -277,7 +277,7 @@ static const MemoryRegionOps loongson_ipi64_ops = {static void loongson_ipi_realize (DeviceState *dev,Error **errp) { -LoongsonIPI *s =LOONGSON_IPI (dev); +LoongsonIPIState *s =LOONGSON_IPI (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);int i;@@ -320,7 +320,7 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp)static void loongson_ipi_unrealize (DeviceState *dev) { -LoongsonIPI *s =LOONGSON_IPI (dev); +LoongsonIPIState *s =LOONGSON_IPI (dev);g_free (s->cpu); }@@ -344,14 +344,14 @@ static const VMStateDescription vmstate_loongson_ipi = { .version_id = 2, .minimum_version_id = 2, .fields = (const VMStateField []) { -VMSTATE_STRUCT_VARRAY_POINTER_UINT32 (cpu, LoongsonIPI, num_cpu, +VMSTATE_STRUCT_VARRAY_POINTER_UINT32 (cpu, LoongsonIPIState, num_cpu, vmstate_ipi_core, IPICore),VMSTATE_END_OF_LIST () } };static Property ipi_properties[] = { -DEFINE_PROP_UINT32 ("num-cpu" , LoongsonIPI, num_cpu,1 ), +DEFINE_PROP_UINT32 ("num-cpu" , LoongsonIPIState, num_cpu,1 ),DEFINE_PROP_END_OF_LIST (), };@@ -369,7 +369,7 @@ static const TypeInfo loongson_ipi_types[] = { { .name = TYPE_LOONGSON_IPI, .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(LoongsonIPI), + .instance_size = sizeof(LoongsonIPIState), .class_init = loongson_ipi_class_init, } };
Re: [PULL 01/28] hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState
Quoted 4 lines · maobibo
Philippe,
I checkout the latest code, it works well.
Thanks for your efforts.
Thanks! It took quite some time, but in the end I believe the commit will be easier to review / bisect in case of problem.
Quoted 3 lines
Regards
Bibo Mao
Re: [PULL 16/28] hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
Guest should not try to read the DAT lines from invalid command state. If it still insists to do so, return a dummy value.
Fixes e2dec2eab0 ("hw/sd/sdcard: Remove default case in read/write on DAT lines")
This commit isn't in any released version, so the fix for it does not apply, - so I'm not picking this up for stable.
JFYI.
Thanks,
/mjt
Signature · 4 lines
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24. New key: rsa4096/61AD3D98ECDF2C8E 9D8B E14E 3F2A 9DD7 9199 28F1 61AD 3D98 ECDF 2C8E Old key: rsa2048/457CE0A0804465C5 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt