qemu-patch-raspberry4/hw/ssi
Markus Armbruster 7f16c76e83 ssi: ssi_auto_connect_slaves() never does anything, drop
ssi_auto_connect_slaves(parent, cs_line, bus) iterates over @parent's
QOM children @dev of type TYPE_SSI_SLAVE.  It puts these on @bus, and
sets cs_line[] to qdev_get_gpio_in_named(dev, SSI_GPIO_CS, 0).

Suspicious: there is no protection against overrunning cs_line[].

Turns out it's safe because ssi_auto_connect_slaves() never finds any
such children.  Its called by realize methods of some (but not all)
devices providing an SSI bus, and gets passed the device.

SSI slave devices are always created with ssi_create_slave_no_init(),
optionally via ssi_create_slave().  This adds them to their SSI bus.
It doesn't set their QOM parent.

ssi_create_slave_no_init() is always immediately followed by
qdev_init_nofail(), with no QOM parent assigned, so
device_set_realized() puts the device into the /machine/unattached/
orphanage.  None become QOM children of a device providing an SSI bus.

ssi_auto_connect_slaves() was added in commit b4ae3cfa57 "ssi: Add
slave autoconnect helper".  I can't see which slaves it was supposed
to connect back then.

Cc: Alistair Francis <alistair@alistair23.me>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-23-armbru@redhat.com>
2020-06-15 22:05:28 +02:00
..
aspeed_smc.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
imx_spi.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
Kconfig ssi: express dependencies with kconfig 2019-03-07 21:45:53 +01:00
Makefile.objs hw/*/Makefile.objs: Move many .o files to common-objs 2020-02-04 09:00:57 +01:00
mss-spi.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
omap_spi.c Include hw/irq.h a lot less 2019-08-16 13:31:52 +02:00
pl022.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
ssi.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
stm32f2xx_spi.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
trace-events aspeed/smc: Fix DMA support for AST2600 2020-03-23 17:22:30 +00:00
xilinx_spi.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
xilinx_spips.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00