From: Damien Hedde <damien.hedde@greensocs.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Daniel P. Berrange" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
qemu-s390x <qemu-s390x@nongnu.org>,
"Cornelia Huck" <cohuck@redhat.com>,
"Mark Burton" <mark.burton@greensocs.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
"Edgar Iglesias" <edgari@xilinx.com>,
qemu-arm <qemu-arm@nongnu.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v5 12/13] hw/gpio/bcm2835_gpio: Isolate sdbus reparenting
Date: Mon, 2 Dec 2019 13:27:47 +0100 [thread overview]
Message-ID: <1ae3a4d3-26e6-fe6d-87a3-d5dcce1fd64c@greensocs.com> (raw)
In-Reply-To: <CAFEAcA-YiD6B1wMTrOvj5=QbYY3uuqdbJbSP57zg3S86nU=k-Q@mail.gmail.com>
On 11/29/19 8:05 PM, Peter Maydell wrote:
> On Fri, 18 Oct 2019 at 16:07, Damien Hedde <damien.hedde@greensocs.com> wrote:
>>
>> Split gpfsel_set() in 2 so that the sdbus reparenting is done
>> in a dedicated function.
>>
>> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
>> ---
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Andrew Baumann <Andrew.Baumann@microsoft.com>
>> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Cc: qemu-arm@nongnu.org
>> ---
>> hw/gpio/bcm2835_gpio.c | 16 ++++++++++++----
>> 1 file changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/gpio/bcm2835_gpio.c b/hw/gpio/bcm2835_gpio.c
>> index 91ce3d10cc..81fe07132f 100644
>> --- a/hw/gpio/bcm2835_gpio.c
>> +++ b/hw/gpio/bcm2835_gpio.c
>> @@ -75,7 +75,10 @@ static void gpfsel_set(BCM2835GpioState *s, uint8_t reg, uint32_t value)
>> s->fsel[index] = fsel;
>> }
>> }
>> +}
>>
>> +static void gpfsel_update_sdbus(BCM2835GpioState *s)
>> +{
>> /* SD controller selection (48-53) */
>> if (s->sd_fsel != 0
>> && (s->fsel[48] == 0) /* SD_CLK_R */
>> @@ -86,6 +89,7 @@ static void gpfsel_set(BCM2835GpioState *s, uint8_t reg, uint32_t value)
>> && (s->fsel[53] == 0) /* SD_DATA3_R */
>> ) {
>> /* SDHCI controller selected */
>> + sdbus_reparent_card(&s->sdbus, s->sdbus_sdhci);
>> sdbus_reparent_card(s->sdbus_sdhost, s->sdbus_sdhci);
>> s->sd_fsel = 0;> } else if (s->sd_fsel != 4
>> @@ -97,6 +101,7 @@ static void gpfsel_set(BCM2835GpioState *s, uint8_t reg, uint32_t value)
>> && (s->fsel[53] == 4) /* SD_DATA3_R */
>> ) {
>> /* SDHost controller selected */
>> + sdbus_reparent_card(&s->sdbus, s->sdbus_sdhost);
>> sdbus_reparent_card(s->sdbus_sdhci, s->sdbus_sdhost);
>
> The commit message says it's just splitting the function in two,
> but these two hunks are adding extra calls to sdbus_reparent_card().
> Why do we need to call it twice ?
You're right. I forgot to update the commit message. The patch also
refactor a little the reset procedure and move the call to
sdbus_reparent_card(&s->sdbus, s->sdbus_sdhci)
which was in there to this part of the code.
raspi machines create the sd in &s->sdbus. So there is need for a first
reparenting from this bus.
With this addition "gpfsel_update_sdbus" always do the expected effect
of putting the sd card onto the right bus.
sdbus_reparent_card(src,dst) only do something if the _src_ bus has a
card. So only one of the 2 sdbus_reparent_card will have an effect. If
the card is already onto the _dst_, both calls will be nop-op.
What about rewording the commit message like this ?
| hw/gpio/bcm2835_gpio: Refactor sdbus reparenting
|
| Split gpfsel_set() in 2 so that the sdbus reparenting is done in a
| dedicated function gpfsel_update_sdbus() and update call sites.
| Also make gpfsel_update_sdbus() handle the case where the sdcard is in
| BCM2835GpioState.sdbus (initial sd card holding bus at machine
| creation).
| Refactor the reset procedure in consequence.
|
| This patch is a preparation step for the migration to multi-phases
| reset which will be done in a following commit
Thanks,
--
Damien
next prev parent reply other threads:[~2019-12-02 12:31 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 15:06 [PATCH v5 00/13] Multi-phase reset mechanism Damien Hedde
2019-10-18 15:06 ` [PATCH v5 01/13] add device_legacy_reset function to prepare for reset api change Damien Hedde
2019-10-19 17:35 ` Richard Henderson
2019-12-03 10:55 ` Cornelia Huck
2019-10-18 15:06 ` [PATCH v5 02/13] hw/core/qdev: add trace events to help with resettable transition Damien Hedde
2019-10-19 17:44 ` Richard Henderson
2019-10-31 23:23 ` Philippe Mathieu-Daudé
2019-11-04 12:16 ` Damien Hedde
2019-11-04 14:33 ` Philippe Mathieu-Daudé
2019-12-03 10:57 ` Cornelia Huck
2019-10-18 15:06 ` [PATCH v5 03/13] hw/core: create Resettable QOM interface Damien Hedde
2019-11-29 18:32 ` Peter Maydell
2019-12-02 11:07 ` Damien Hedde
2019-12-02 11:14 ` Peter Maydell
2019-12-03 11:16 ` Cornelia Huck
2019-10-18 15:06 ` [PATCH v5 04/13] hw/core: add Resettable support to BusClass and DeviceClass Damien Hedde
2019-10-19 18:49 ` Richard Henderson
2019-11-29 18:36 ` Peter Maydell
2019-12-02 11:38 ` Damien Hedde
2019-10-18 15:06 ` [PATCH v5 05/13] hw/core/resettable: add support for changing parent Damien Hedde
2019-11-29 18:38 ` Peter Maydell
2019-12-02 11:43 ` Damien Hedde
2019-10-18 15:06 ` [PATCH v5 06/13] hw/core/qdev: handle parent bus change regarding resettable Damien Hedde
2019-11-29 18:41 ` Peter Maydell
2019-12-03 11:37 ` Cornelia Huck
2019-10-18 15:06 ` [PATCH v5 07/13] hw/core/qdev: update hotplug reset " Damien Hedde
2019-11-08 15:14 ` Damien Hedde
2019-10-18 15:06 ` [PATCH v5 08/13] hw/core: deprecate old reset functions and introduce new ones Damien Hedde
2019-10-31 23:35 ` Philippe Mathieu-Daudé
2019-11-04 12:01 ` Damien Hedde
2019-11-04 15:42 ` Philippe Mathieu-Daudé
2019-11-29 18:42 ` Peter Maydell
2019-10-18 15:06 ` [PATCH v5 09/13] docs/devel/reset.txt: add doc about Resettable interface Damien Hedde
2019-11-29 19:00 ` Peter Maydell
2019-12-06 15:40 ` Damien Hedde
2019-12-06 16:21 ` Damien Hedde
2019-10-18 15:06 ` [PATCH v5 10/13] vl: replace deprecated qbus_reset_all registration Damien Hedde
2019-11-29 19:01 ` Peter Maydell
2019-10-18 15:06 ` [PATCH v5 11/13] hw/s390x/ipl: replace deprecated qdev_reset_all registration Damien Hedde
2019-10-31 23:38 ` Philippe Mathieu-Daudé
2019-11-29 19:02 ` Peter Maydell
2019-12-03 11:41 ` Cornelia Huck
2019-10-18 15:06 ` [PATCH v5 12/13] hw/gpio/bcm2835_gpio: Isolate sdbus reparenting Damien Hedde
2019-11-29 19:05 ` Peter Maydell
2019-12-02 12:27 ` Damien Hedde [this message]
2019-12-02 12:33 ` Peter Maydell
2019-12-02 13:05 ` Damien Hedde
2019-12-02 13:10 ` Peter Maydell
2019-10-18 15:06 ` [PATCH v5 13/13] hw/gpio/bcm2835_gpio: Update to resettable Damien Hedde
2019-11-29 19:02 ` Peter Maydell
2019-10-19 9:01 ` [PATCH v5 00/13] Multi-phase reset mechanism no-reply
2019-10-29 15:53 ` Damien Hedde
2019-11-08 15:26 ` Damien Hedde
2019-11-08 15:28 ` Peter Maydell
2019-11-08 15:58 ` Damien Hedde
2019-11-29 19:07 ` Peter Maydell
2019-12-03 11:44 ` Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ae3a4d3-26e6-fe6d-87a3-d5dcce1fd64c@greensocs.com \
--to=damien.hedde@greensocs.com \
--cc=Andrew.Baumann@microsoft.com \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=edgari@xilinx.com \
--cc=ehabkost@redhat.com \
--cc=mark.burton@greensocs.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).