[PATCH v4 01/14] hw/qdev-properties-system: Include missing 'qapi/qapi-types-common.h'

2025-03-08 Thread Philippe Mathieu-Daudé
DEFINE_PROP_ENDIAN_NODEFAULT() macro uses ENDIAN_MODE_UNSPECIFIED which is defined in "qapi/qapi-types-common.h". Fixes: 4ec96630f93 ("hw/qdev-properties-system: Introduce EndianMode QAPI enum") Signed-off-by: Philippe Mathieu-Daudé --- include/hw/qdev-properties-system.h | 1 + 1 file changed,

[PATCH v4 02/14] hw/sd/sdhci: Remove need for SDHCIState::vendor field

2025-03-08 Thread Philippe Mathieu-Daudé
All instances of TYPE_IMX_USDHC set vendor=SDHCI_VENDOR_IMX. No need to special-case it. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-internal.h | 1 - include/hw/sd/sdhci.h | 4 hw/arm/fsl-imx25.c | 2 -- hw/arm/fsl-imx6.c | 2 -- hw/arm/fsl-imx6ul.c| 2 -- hw/a

[PATCH v4 00/14] hw/sd/sdhci: Set reset value of interrupt registers

2025-03-08 Thread Philippe Mathieu-Daudé
Since v3: - Fix "hw/qdev-properties-system.h" (first patch) - Convert to EndianMode (patch #10) Rainy saturday, time for some hobbyist contributions :) In this series we try to address the issue Zoltan reported and try to fix in [*], but using a more generic approach. The SDHCI code ends up bette

[PATCH v4 13/14] hw/sd/sdhci: Implement Freescale eSDHC as TYPE_FSL_ESDHC

2025-03-08 Thread Philippe Mathieu-Daudé
Per the MPC8569E reference manual, its SDHC I/O range is 4KiB wide, mapped in big endian order, and it only accepts 32-bit aligned access. Set the default register reset values. Reported-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 2 ++ hw/sd/sdhci.c

[PATCH v4 09/14] hw/sd/sdhci: Unify default MemoryRegionOps

2025-03-08 Thread Philippe Mathieu-Daudé
Note, sdhci_mmio_le_ops[] was missing .impl.access_size = 4. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 46 -- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index a2e7162e289..23af3958a1d 1

Re: [PATCH v4 03/14] hw/sd/sdhci: Introduce SDHCIClass stub

2025-03-08 Thread BALATON Zoltan
On Sat, 8 Mar 2025, Philippe Mathieu-Daudé wrote: TYPE_SYSBUS_SDHCI is a bit odd because it uses an union to work with both SysBus / PCI parent. As this is not a normal use, introduce SDHCIClass in its own commit. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 9 + hw/

[PATCH v4 05/14] hw/sd/sdhci: Make I/O region size a class property

2025-03-08 Thread Philippe Mathieu-Daudé
Be ready to have SDHC implementations to cover a wider I/O address range. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 1 + hw/sd/sdhci.c | 10 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h in

[PATCH v4 07/14] hw/sd/sdhci: Allow SDHCI classes to register their own MemoryRegionOps

2025-03-08 Thread Philippe Mathieu-Daudé
Add MemoryRegionOps as a class property. For now it is only used by TYPE_IMX_USDHC. Otherwise the default remains in little endian. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 1 + hw/sd/sdhci.c | 22 -- 2 files changed, 9 insertions(+), 14 dele

[PATCH v4 10/14] hw/sd/sdhci: Convert SDHCIState::endianness to EndianMode

2025-03-08 Thread Philippe Mathieu-Daudé
EndianMode enum is preferred over DEVICE_BIG/LITTLE_ENDIAN values because it is a QAPI type. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-internal.h | 3 ++- include/hw/sd/sdhci.h | 3 ++- hw/ppc/e500.c | 2 +- hw/sd/sdhci-pci.c | 2 +- hw/sd/sdhci.c | 7 ++-

[PATCH v4 04/14] hw/sd/sdhci: Make quirks a class property

2025-03-08 Thread Philippe Mathieu-Daudé
All TYPE_IMX_USDHC instances use the quirk: move it to the class layer. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 3 ++- hw/sd/sdhci.c | 15 +-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhc

[PATCH v4 03/14] hw/sd/sdhci: Introduce SDHCIClass stub

2025-03-08 Thread Philippe Mathieu-Daudé
TYPE_SYSBUS_SDHCI is a bit odd because it uses an union to work with both SysBus / PCI parent. As this is not a normal use, introduce SDHCIClass in its own commit. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 9 + hw/sd/sdhci.c | 1 + 2 files changed, 10 inse

Re: [PATCH v2] hw/sd/sdhci: Set reset value of interrupt registers

2025-03-08 Thread Philippe Mathieu-Daudé
On 6/3/25 19:23, BALATON Zoltan wrote: On Mon, 3 Mar 2025, BALATON Zoltan wrote: On Mon, 3 Mar 2025, Philippe Mathieu-Daudé wrote: Hi Zoltan, On 10/2/25 17:03, BALATON Zoltan wrote: The interrupt enable registers are not reset to 0 on Freescale eSDHC but some bits are enabled on reset. At lea

[PATCH v3 00/12] hw/sd/sdhci: Set reset value of interrupt registers

2025-03-08 Thread Philippe Mathieu-Daudé
Rainy saturday, time for some hobbyist contributions :) In this series we try to address the issue Zoltan reported and try to fix in [*], but using a more generic approach. The SDHCI code ends up better consolidated and ready to scale for more vendor implementations. I expect (with few QOM knowle

[PATCH v3 02/12] hw/sd/sdhci: Introduce SDHCIClass stub

2025-03-08 Thread Philippe Mathieu-Daudé
TYPE_SYSBUS_SDHCI is a bit odd because it uses an union to work with both SysBus / PCI parent. As this is not a normal use, introduce SDHCIClass in its own commit. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 9 + hw/sd/sdhci.c | 1 + 2 files changed, 10 inse

[PATCH v3 01/12] hw/sd/sdhci: Remove need for SDHCIState::vendor field

2025-03-08 Thread Philippe Mathieu-Daudé
All instances of TYPE_IMX_USDHC set vendor=SDHCI_VENDOR_IMX. No need to special-case it. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-internal.h | 1 - include/hw/sd/sdhci.h | 4 hw/arm/fsl-imx25.c | 2 -- hw/arm/fsl-imx6.c | 2 -- hw/arm/fsl-imx6ul.c| 2 -- hw/a

[PATCH v3 03/12] hw/sd/sdhci: Make quirks a class property

2025-03-08 Thread Philippe Mathieu-Daudé
All TYPE_IMX_USDHC instances use the quirk: move it to the class layer. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 3 ++- hw/sd/sdhci.c | 15 +-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhc

[PATCH v3 04/12] hw/sd/sdhci: Make I/O region size a class property

2025-03-08 Thread Philippe Mathieu-Daudé
Be ready to have SDHC implementations to cover a wider I/O address range. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 1 + hw/sd/sdhci.c | 9 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h index

[PATCH v3 08/12] hw/sd/sdhci: Unify default MemoryRegionOps

2025-03-08 Thread Philippe Mathieu-Daudé
Note, sdhci_mmio_le_ops[] was missing .impl.access_size = 4. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 41 - 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index d115e88c4b9..15e6976220f 100644

[PATCH v3 09/12] hw/sd/sdhci: Add SDHCIClass::ro::capareg field

2025-03-08 Thread Philippe Mathieu-Daudé
Capability register is read-only. Since we allow instances to clear/set extra bits, log when read-only bits normally set by hardware are cleared at board level. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 5 + hw/sd/sdhci.c | 6 ++ 2 files changed, 11 inser

[PATCH v3 07/12] hw/sd/sdhci: Simplify MemoryRegionOps endianness check

2025-03-08 Thread Philippe Mathieu-Daudé
While little endianness is the default, ome controllers might be only implemented in big endianness. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index d87a7bb45a4..d1

[PATCH v3 12/12] hw/ppc/e500: Replace generic SDHCI by Freescale eSDHC

2025-03-08 Thread Philippe Mathieu-Daudé
As Zoltan reported, some U-Boot versions seem to expect correctly initialized registers before expecting interrupts. Now than we have a proper Freescale eSDHC implementation, use it. Reported-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/e500.c | 10 +- 1 file cha

[PATCH v4 08/14] hw/sd/sdhci: Simplify MemoryRegionOps endianness check

2025-03-08 Thread Philippe Mathieu-Daudé
While little endianness is the default, ome controllers might be only implemented in big endianness. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index ae485f90dfe..a2

[PATCH v4 06/14] hw/sd/sdhci: Enforce little endianness on PCI devices

2025-03-08 Thread Philippe Mathieu-Daudé
This is the default, but better be safe than sorry. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/sd/sdhci-pci.c b/hw/sd/sdhci-pci.c index 5268c0dee50..5f82178a76f 100644 --- a/hw/sd/sdhci-pci.c +++ b/hw/sd/sdhci-pci.c @@ -32,6

[PATCH v4 14/14] hw/ppc/e500: Replace generic SDHCI by Freescale eSDHC

2025-03-08 Thread Philippe Mathieu-Daudé
As Zoltan reported, some U-Boot versions seem to expect correctly initialized registers before expecting interrupts. Now than we have a proper Freescale eSDHC implementation, use it. Reported-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/e500.c | 10 +- 1 file cha

[PATCH v4 12/14] hw/sd/sdhci: Allow SDHCI classes to have different register reset values

2025-03-08 Thread Philippe Mathieu-Daudé
For the registers which are not zeroed at reset, allow the different implementations to set particular reset values. Remove the misleading values commented in sdhci-internal.h. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-internal.h | 24 include/hw/sd/sdhci.h

[PATCH v4 11/14] hw/sd/sdhci: Add SDHCIClass::ro::capareg field

2025-03-08 Thread Philippe Mathieu-Daudé
Capability register is read-only. Since we allow instances to clear/set extra bits, log when read-only bits normally set by hardware are cleared at board level. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 5 + hw/sd/sdhci.c | 6 ++ 2 files changed, 11 inser

Re: [PATCH v4 03/14] hw/sd/sdhci: Introduce SDHCIClass stub

2025-03-08 Thread BALATON Zoltan
On Sun, 9 Mar 2025, Philippe Mathieu-Daudé wrote: On 8/3/25 23:34, BALATON Zoltan wrote: On Sat, 8 Mar 2025, Philippe Mathieu-Daudé wrote: TYPE_SYSBUS_SDHCI is a bit odd because it uses an union to work with both SysBus / PCI parent. As this is not a normal use, introduce SDHCIClass in its own

Re: [PATCH v4 08/14] hw/sd/sdhci: Simplify MemoryRegionOps endianness check

2025-03-08 Thread BALATON Zoltan
On Sat, 8 Mar 2025, Philippe Mathieu-Daudé wrote: While little endianness is the default, ome controllers Typo, ome -> some. Regards, BALATON Zoltan might be only implemented in big endianness. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 18 -- 1 file changed,

Re: [PATCH v4 03/14] hw/sd/sdhci: Introduce SDHCIClass stub

2025-03-08 Thread Philippe Mathieu-Daudé
On 8/3/25 23:34, BALATON Zoltan wrote: On Sat, 8 Mar 2025, Philippe Mathieu-Daudé wrote: TYPE_SYSBUS_SDHCI is a bit odd because it uses an union to work with both SysBus / PCI parent. As this is not a normal use, introduce SDHCIClass in its own commit. Signed-off-by: Philippe Mathieu-Daudé ---

[PATCH v3 10/12] hw/sd/sdhci: Allow SDHCI classes to have different register reset values

2025-03-08 Thread Philippe Mathieu-Daudé
For the registers which are not zeroed at reset, allow the different implementations to set particular reset values. Remove the misleading values commented in sdhci-internal.h. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-internal.h | 24 include/hw/sd/sdhci.h

[PATCH v3 11/12] hw/sd/sdhci: Implement Freescale eSDHC as TYPE_FSL_ESDHC

2025-03-08 Thread Philippe Mathieu-Daudé
Per the MPC8569E reference manual, its SDHC I/O range is 4KiB wide, mapped in big endian order, and it only accepts 32-bit aligned access. Set the default register reset values. Reported-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 2 ++ hw/sd/sdhci.c

[PATCH v3 05/12] hw/sd/sdhci: Enforce little endianness on PCI devices

2025-03-08 Thread Philippe Mathieu-Daudé
This is the default, but better be safe than sorry. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/sd/sdhci-pci.c b/hw/sd/sdhci-pci.c index 5268c0dee50..5f82178a76f 100644 --- a/hw/sd/sdhci-pci.c +++ b/hw/sd/sdhci-pci.c @@ -32,6

[PATCH v3 06/12] hw/sd/sdhci: Allow SDHCI classes to register their own MemoryRegionOps

2025-03-08 Thread Philippe Mathieu-Daudé
Add MemoryRegionOps as a class property. For now it is only used by TYPE_IMX_USDHC. Otherwise the default remains in little endian. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sdhci.h | 1 + hw/sd/sdhci.c | 22 -- 2 files changed, 9 insertions(+), 14 dele

[PATCH 0/2] qapi: Fix qmp_block_set_io_throttle blocked for too long

2025-03-08 Thread zoudongjie via
From: Zhu Yangyang In the disable branch of qmp_block_set_io_throttle(), we call bdrv_drained_begin(). We know that bdrv_drained_begin() is a blocking interface used to wait for all submitted I/O operations to complete, i.e., to wait until bs->in_flight becomes zero. Theoretically, once we sto

[PATCH 2/2] qapi: Fix qmp_block_set_io_throttle blocked for too long

2025-03-08 Thread zoudongjie via
From: Zhu Yangyang bdrv_drained_begin() is blocked for a long time when network storage is used and the network link has just failed. Therefore, the timeout period is set here. Signed-off-by: Zhu Yangyang --- block/block-backend.c | 14 +- block/qapi-system.c

[PATCH 1/2] io/block: Refactoring the bdrv_drained_begin() function and implement a timeout mechanism.

2025-03-08 Thread zoudongjie via
From: Zhu Yangyang The bdrv_drained_begin() function is a blocking function. In scenarios where network storage is used and network links fail, it may block for a long time. Therefore, we add a timeout parameter to control the duration of the block. Since bdrv_drained_begin() has been widely ad