qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hao Wu <wuhaotsh@google.com>
To: Havard Skinnemoen <hskinnemoen@google.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	 Tyrone Ting <KFTING@nuvoton.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org
Subject: Re: [PATCH v2 03/13] hw/arm/npcm7xx_boards: Replace drive_get_next() by drive_get()
Date: Wed, 17 Nov 2021 09:50:13 -0800	[thread overview]
Message-ID: <CAGcCb12zYiTcO5t_6872ueNeoj-ggBwnUPCiR+MDAMOjf_N_Fw@mail.gmail.com> (raw)
In-Reply-To: <CAFQmdRaz9aa22KVHup15oquDrt+HviqqNtGvt9tb21=spTKHog@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2769 bytes --]

Yes, there's SD and MMC buses. It looks like the current code only supports
mmc ("soc->mmc.sdhci") but not the sd ("soc->sd.sdhci").

It's probably good to make the bus number a parameter as well and use them
to distinguish. We might need a separate patch to do that.

On Wed, Nov 17, 2021 at 8:54 AM Havard Skinnemoen <hskinnemoen@google.com>
wrote:

> On Wed, Nov 17, 2021 at 8:34 AM Markus Armbruster <armbru@redhat.com>
> wrote:
> >
> > drive_get_next() is basically a bad idea.  It returns the "next" block
> > backend of a certain interface type.  "Next" means bus=0,unit=N, where
> > subsequent calls count N up from zero, per interface type.
> >
> > This lets you define unit numbers implicitly by execution order.  If the
> > order changes, or new calls appear "in the middle", unit numbers change.
> > ABI break.  Hard to spot in review.
> >
> > Machine "quanta-gbs-bmc" connects just one backend with
> > drive_get_next(), but with a helper function.  Change it to use
> > drive_get() directly.  This makes the unit numbers explicit in the
> > code.
> >
> > Cc: Havard Skinnemoen <hskinnemoen@google.com>
> > Cc: Tyrone Ting <kfting@nuvoton.com>
> > Cc: Peter Maydell <peter.maydell@linaro.org>
> > Cc: qemu-arm@nongnu.org
> > Signed-off-by: Markus Armbruster <armbru@redhat.com>
> > ---
> >  hw/arm/npcm7xx_boards.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
> > index dec7d16ae5..d8a49e4e85 100644
> > --- a/hw/arm/npcm7xx_boards.c
> > +++ b/hw/arm/npcm7xx_boards.c
> > @@ -84,9 +84,9 @@ static void npcm7xx_connect_dram(NPCM7xxState *soc,
> MemoryRegion *dram)
> >                               &error_abort);
> >  }
> >
> > -static void sdhci_attach_drive(SDHCIState *sdhci)
> > +static void sdhci_attach_drive(SDHCIState *sdhci, int unit)
> >  {
> > -        DriveInfo *di = drive_get_next(IF_SD);
> > +        DriveInfo *di = drive_get(IF_SD, 0, unit);
>
> +Hao Wu IIRC the chip has separate SD and eMMC buses. Would it make
> sense to take the bus number as a parameter as well? Is bus 0 the
> right one to use in this case?
>
> The existing code always uses bus 0, so this is an improvement either way.
>
> Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com>
>
> >          BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
> >
> >          BusState *bus = qdev_get_child_bus(DEVICE(sdhci), "sd-bus");
> > @@ -374,7 +374,7 @@ static void quanta_gbs_init(MachineState *machine)
> >                            drive_get(IF_MTD, 0, 0));
> >
> >      quanta_gbs_i2c_init(soc);
> > -    sdhci_attach_drive(&soc->mmc.sdhci);
> > +    sdhci_attach_drive(&soc->mmc.sdhci, 0);
> >      npcm7xx_load_kernel(machine, soc);
> >  }
> >
> > --
> > 2.31.1
> >
>

[-- Attachment #2: Type: text/html, Size: 4021 bytes --]

  reply	other threads:[~2021-11-17 17:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 16:33 [PATCH v2 00/13] Eliminate drive_get_next() Markus Armbruster
2021-11-17 16:33 ` [PATCH v2 01/13] hw/sd/ssi-sd: Do not create SD card within controller's realize Markus Armbruster
2021-11-17 19:45   ` Philippe Mathieu-Daudé
2021-12-06 12:34     ` Markus Armbruster
2021-12-06 13:05       ` Peter Maydell
2021-11-19 13:04   ` Alistair Francis
2021-11-17 16:33 ` [PATCH v2 02/13] hw: Replace trivial drive_get_next() by drive_get() Markus Armbruster
2021-11-19 13:02   ` Alistair Francis
2021-11-17 16:33 ` [PATCH v2 03/13] hw/arm/npcm7xx_boards: Replace " Markus Armbruster
2021-11-17 16:53   ` Havard Skinnemoen
2021-11-17 17:50     ` Hao Wu [this message]
2021-11-18  6:56     ` Markus Armbruster
2021-11-17 16:34 ` [PATCH v2 04/13] hw/arm/versatilepb hw/arm/vexpress: " Markus Armbruster
2021-11-29 13:21   ` Peter Maydell
2021-11-17 16:34 ` [PATCH v2 05/13] hw/arm/imx25_pdk: " Markus Armbruster
2021-11-29 13:22   ` Peter Maydell
2021-11-17 16:34 ` [PATCH v2 06/13] hw/arm/mcimx6ul-evk: " Markus Armbruster
2021-11-29 13:22   ` Peter Maydell
2021-11-17 16:34 ` [PATCH v2 07/13] hw/arm/mcimx7d-sabre: " Markus Armbruster
2021-11-29 13:23   ` Peter Maydell
2021-11-17 16:34 ` [PATCH v2 08/13] hw/arm/xlnx-versal-virt: " Markus Armbruster
2021-11-18 14:47   ` Edgar E. Iglesias
2021-11-17 16:34 ` [PATCH v2 09/13] hw/microblaze: " Markus Armbruster
2021-11-18 14:46   ` Edgar E. Iglesias
2021-11-17 16:34 ` [PATCH v2 10/13] hw/arm/xlnx-zcu102: " Markus Armbruster
2021-11-18 14:46   ` Edgar E. Iglesias
2021-11-17 16:34 ` [PATCH v2 11/13] hw/arm/xilinx_zynq: " Markus Armbruster
2021-11-18 14:46   ` Edgar E. Iglesias
2021-11-17 16:34 ` [PATCH v2 12/13] hw/arm/aspeed: " Markus Armbruster
2021-11-18 14:41   ` Cédric Le Goater
2021-11-17 16:34 ` [PATCH v2 13/13] blockdev: Drop unused drive_get_next() Markus Armbruster
2021-11-18  8:07   ` Hanna Reitz
2021-12-06 15:28 ` [PATCH v2 00/13] Eliminate drive_get_next() Markus Armbruster

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=CAGcCb12zYiTcO5t_6872ueNeoj-ggBwnUPCiR+MDAMOjf_N_Fw@mail.gmail.com \
    --to=wuhaotsh@google.com \
    --cc=KFTING@nuvoton.com \
    --cc=armbru@redhat.com \
    --cc=hskinnemoen@google.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@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).