[Qemu-devel] [PATCH 0/4] handle reparenting of SD cards for rpi2

Peter Maydell posted 4 patches 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1488293711-14195-1-git-send-email-peter.maydell@linaro.org
Test checkpatch passed
Test docker passed
Test s390x passed
hw/gpio/Makefile.objs                |   1 +
include/hw/arm/bcm2835_peripherals.h |   4 +
include/hw/gpio/bcm2835_gpio.h       |  39 ++++
include/hw/sd/sd.h                   |  11 ++
hw/arm/bcm2835_peripherals.c         |  43 ++++-
hw/core/qdev.c                       |  14 ++
hw/gpio/bcm2835_gpio.c               | 353 +++++++++++++++++++++++++++++++++++
hw/sd/core.c                         |  27 +++
8 files changed, 490 insertions(+), 2 deletions(-)
create mode 100644 include/hw/gpio/bcm2835_gpio.h
create mode 100644 hw/gpio/bcm2835_gpio.c
[Qemu-devel] [PATCH 0/4] handle reparenting of SD cards for rpi2
Posted by Peter Maydell 7 years, 1 month ago
These patches are a respin of Clement's work on the
rpi2 sd controller/gpio. They fix the valgrind issue that
I was seeing because we got reparenting of the card wrong.

This patchset adds a new qdev patch which makes the
qdev_set_parent_bus() function do most of the work of
unplugging and replugging if the device was already on
a bus. In particular it calls bus_remove_child() which does
a lot of things that the previous "just call object_unparent"
attempt didn't do.

Comments on whether this makes sense to people welcome.
I'm still kind of hoping we can squeeze this into 2.9;
comments on whether that would be unwise also welcome.

thanks
-- PMM


Clement Deschamps (3):
  hw/sd: add card-reparenting function
  bcm2835_gpio: add bcm2835 gpio controller
  bcm2835: add sdhost and gpio controllers

Peter Maydell (1):
  qdev: Have qdev_set_parent_bus() handle devices already on a bus

 hw/gpio/Makefile.objs                |   1 +
 include/hw/arm/bcm2835_peripherals.h |   4 +
 include/hw/gpio/bcm2835_gpio.h       |  39 ++++
 include/hw/sd/sd.h                   |  11 ++
 hw/arm/bcm2835_peripherals.c         |  43 ++++-
 hw/core/qdev.c                       |  14 ++
 hw/gpio/bcm2835_gpio.c               | 353 +++++++++++++++++++++++++++++++++++
 hw/sd/core.c                         |  27 +++
 8 files changed, 490 insertions(+), 2 deletions(-)
 create mode 100644 include/hw/gpio/bcm2835_gpio.h
 create mode 100644 hw/gpio/bcm2835_gpio.c

-- 
2.7.4


Re: [Qemu-devel] [PATCH 0/4] handle reparenting of SD cards for rpi2
Posted by Paolo Bonzini 7 years, 1 month ago

On 28/02/2017 15:55, Peter Maydell wrote:
> These patches are a respin of Clement's work on the
> rpi2 sd controller/gpio. They fix the valgrind issue that
> I was seeing because we got reparenting of the card wrong.
> 
> This patchset adds a new qdev patch which makes the
> qdev_set_parent_bus() function do most of the work of
> unplugging and replugging if the device was already on
> a bus. In particular it calls bus_remove_child() which does
> a lot of things that the previous "just call object_unparent"
> attempt didn't do.
> 
> Comments on whether this makes sense to people welcome.
> I'm still kind of hoping we can squeeze this into 2.9;
> comments on whether that would be unwise also welcome.

Looks good.  My first reaction was to add an assertion in
qdev_set_parent_bus, modify it to handle qdev_set_parent_bus(dev, NULL),
and then do a two-step unplug+replug in the raspi device models.

However, who knows what you could unleash when adding that assertion...

Paolo