From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
qemu-riscv@nongnu.org, qemu-block@nongnu.org,
Bin Meng <bin.meng@windriver.com>,
qemu-arm@nongnu.org,
Alistair Francis <Alistair.Francis@wdc.com>,
Palmer Dabbelt <palmer@dabbelt.com>
Subject: Re: [PATCH v2 01/13] hw/sd/ssi-sd: Do not create SD card within controller's realize
Date: Mon, 06 Dec 2021 13:34:54 +0100 [thread overview]
Message-ID: <87tufllxn5.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <575fcf95-f4f0-3d88-ab08-b4d21f2da354@amsat.org> ("Philippe Mathieu-Daudé"'s message of "Wed, 17 Nov 2021 20:45:15 +0100")
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> Hi Markus, Peter,
>
> On 11/17/21 17:33, Markus Armbruster wrote:
>> ssi_sd_realize() creates an "sd-card" device. This is inappropriate,
>> and marked FIXME.
>>
>> Move it to the boards that create these devices. Prior art: commit
>> eb4f566bbb for device "generic-sdhci", and commit 26c607b86b for
>> device "pl181".
>>
>> The device remains not user-creatable, because its users should (and
>> do) wire up its GPIO chip-select line.
>>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Alistair Francis <Alistair.Francis@wdc.com>
>> Cc: Bin Meng <bin.meng@windriver.com>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
>> Cc: qemu-arm@nongnu.org
>> Cc: qemu-riscv@nongnu.org
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
>> ---
>> hw/arm/stellaris.c | 15 ++++++++++++++-
>> hw/riscv/sifive_u.c | 13 ++++++++++++-
>> hw/sd/ssi-sd.c | 29 +----------------------------
>> 3 files changed, 27 insertions(+), 30 deletions(-)
>>
>> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
>> index 78827ace6b..b6c8a5d609 100644
>> --- a/hw/arm/stellaris.c
>> +++ b/hw/arm/stellaris.c
>> @@ -10,6 +10,7 @@
>> #include "qemu/osdep.h"
>> #include "qapi/error.h"
>> #include "hw/sysbus.h"
>> +#include "hw/sd/sd.h"
>> #include "hw/ssi/ssi.h"
>> #include "hw/arm/boot.h"
>> #include "qemu/timer.h"
>> @@ -1157,6 +1158,9 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
>> void *bus;
>> DeviceState *sddev;
>> DeviceState *ssddev;
>> + DriveInfo *dinfo;
>> + DeviceState *carddev;
>> + BlockBackend *blk;
>>
>> /*
>> * Some boards have both an OLED controller and SD card connected to
>> @@ -1221,8 +1225,17 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
>> * - Make the ssd0323 OLED controller chipselect active-low
>> */
>> bus = qdev_get_child_bus(dev, "ssi");
>> -
>> sddev = ssi_create_peripheral(bus, "ssi-sd");
>> +
>> + dinfo = drive_get(IF_SD, 0, 0);
>> + blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
>> + carddev = qdev_new(TYPE_SD_CARD);
>> + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
>
> I guess a already asked this once but don't remember now... What is the
> point of creating a SD card without drive? Is this due to the old design
> issue we hotplug the drive to the SD card and not the SD card on the SD
> bus?
Device model "sd-card" implements BlockdevOps method change_media_cb().
This menas it models a device with a removable medium. No drive behaves
like no medium. I guess it's an SD card reader.
>
>> + qdev_prop_set_bit(carddev, "spi", true);
>> + qdev_realize_and_unref(carddev,
>> + qdev_get_child_bus(sddev, "sd-bus"),
>> + &error_fatal);
>> +
WARNING: multiple messages have this Message-ID (diff)
From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-riscv@nongnu.org, qemu-block@nongnu.org,
Bin Meng <bin.meng@windriver.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Alistair Francis <Alistair.Francis@wdc.com>,
Palmer Dabbelt <palmer@dabbelt.com>
Subject: Re: [PATCH v2 01/13] hw/sd/ssi-sd: Do not create SD card within controller's realize
Date: Mon, 06 Dec 2021 13:34:54 +0100 [thread overview]
Message-ID: <87tufllxn5.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <575fcf95-f4f0-3d88-ab08-b4d21f2da354@amsat.org> ("Philippe Mathieu-Daudé"'s message of "Wed, 17 Nov 2021 20:45:15 +0100")
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> Hi Markus, Peter,
>
> On 11/17/21 17:33, Markus Armbruster wrote:
>> ssi_sd_realize() creates an "sd-card" device. This is inappropriate,
>> and marked FIXME.
>>
>> Move it to the boards that create these devices. Prior art: commit
>> eb4f566bbb for device "generic-sdhci", and commit 26c607b86b for
>> device "pl181".
>>
>> The device remains not user-creatable, because its users should (and
>> do) wire up its GPIO chip-select line.
>>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Alistair Francis <Alistair.Francis@wdc.com>
>> Cc: Bin Meng <bin.meng@windriver.com>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
>> Cc: qemu-arm@nongnu.org
>> Cc: qemu-riscv@nongnu.org
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
>> ---
>> hw/arm/stellaris.c | 15 ++++++++++++++-
>> hw/riscv/sifive_u.c | 13 ++++++++++++-
>> hw/sd/ssi-sd.c | 29 +----------------------------
>> 3 files changed, 27 insertions(+), 30 deletions(-)
>>
>> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
>> index 78827ace6b..b6c8a5d609 100644
>> --- a/hw/arm/stellaris.c
>> +++ b/hw/arm/stellaris.c
>> @@ -10,6 +10,7 @@
>> #include "qemu/osdep.h"
>> #include "qapi/error.h"
>> #include "hw/sysbus.h"
>> +#include "hw/sd/sd.h"
>> #include "hw/ssi/ssi.h"
>> #include "hw/arm/boot.h"
>> #include "qemu/timer.h"
>> @@ -1157,6 +1158,9 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
>> void *bus;
>> DeviceState *sddev;
>> DeviceState *ssddev;
>> + DriveInfo *dinfo;
>> + DeviceState *carddev;
>> + BlockBackend *blk;
>>
>> /*
>> * Some boards have both an OLED controller and SD card connected to
>> @@ -1221,8 +1225,17 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
>> * - Make the ssd0323 OLED controller chipselect active-low
>> */
>> bus = qdev_get_child_bus(dev, "ssi");
>> -
>> sddev = ssi_create_peripheral(bus, "ssi-sd");
>> +
>> + dinfo = drive_get(IF_SD, 0, 0);
>> + blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
>> + carddev = qdev_new(TYPE_SD_CARD);
>> + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
>
> I guess a already asked this once but don't remember now... What is the
> point of creating a SD card without drive? Is this due to the old design
> issue we hotplug the drive to the SD card and not the SD card on the SD
> bus?
Device model "sd-card" implements BlockdevOps method change_media_cb().
This menas it models a device with a removable medium. No drive behaves
like no medium. I guess it's an SD card reader.
>
>> + qdev_prop_set_bit(carddev, "spi", true);
>> + qdev_realize_and_unref(carddev,
>> + qdev_get_child_bus(sddev, "sd-bus"),
>> + &error_fatal);
>> +
next prev parent reply other threads:[~2021-12-06 12:35 UTC|newest]
Thread overview: 42+ 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 16:33 ` Markus Armbruster
2021-11-17 19:45 ` Philippe Mathieu-Daudé
2021-12-06 12:34 ` Markus Armbruster [this message]
2021-12-06 12:34 ` Markus Armbruster
2021-12-06 13:05 ` Peter Maydell
2021-12-06 13:05 ` Peter Maydell
2021-11-19 13:04 ` Alistair Francis
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-17 16:33 ` Markus Armbruster
2021-11-19 13:02 ` Alistair Francis
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
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-17 16:34 ` 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-17 16:34 ` 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-17 16:34 ` 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=87tufllxn5.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=Alistair.Francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=f4bug@amsat.org \
--cc=palmer@dabbelt.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.