From: Francisco Iglesias <frasse.iglesias@gmail.com>
To: Sai Pavan Boddu <sai.pavan.boddu@amd.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
qemu-block@nongnu.org, Alistair Francis <alistair@alistair23.me>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
Kevin Wolf <kwolf@redhat.com>,
saipavanboddu@gmail.com
Subject: Re: [PATCH 2/2] arm: xlnx-versal-virt: Add machine property ospi-flash
Date: Tue, 5 Dec 2023 22:13:27 +0100 [thread overview]
Message-ID: <20231205211327.GC9927@fralle-msi> (raw)
In-Reply-To: <20231205095226.2688032-3-sai.pavan.boddu@amd.com>
On [2023 Dec 05] Tue 15:22:26, Sai Pavan Boddu wrote:
> This property allows users to change flash model on command line as
> below.
>
> ex: "-M xlnx-versal-virt,ospi-flash=mt35xu02gbba"
>
> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@amd.com>
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
> ---
> hw/arm/xlnx-versal-virt.c | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 537118224f..c57cff74d8 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -49,6 +49,7 @@ struct VersalVirt {
> struct {
> bool secure;
> } cfg;
> + char *ospi_model;
> };
>
> static void fdt_create(VersalVirt *s)
> @@ -637,6 +638,22 @@ static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
> &error_fatal);
> }
>
> +static char *versal_get_ospi_model(Object *obj, Error **errp)
> +{
> + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj);
> +
> + return g_strdup(s->ospi_model);
> +}
> +
> +static void versal_set_ospi_model(Object *obj, const char *value, Error **errp)
> +{
> + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj);
> +
> + g_free(s->ospi_model);
> + s->ospi_model = g_strdup(value);
> +}
> +
> +
> static void versal_virt_init(MachineState *machine)
> {
> VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine);
> @@ -736,7 +753,7 @@ static void versal_virt_init(MachineState *machine)
>
> spi_bus = qdev_get_child_bus(DEVICE(&s->soc.pmc.iou.ospi), "spi0");
>
> - flash_dev = qdev_new("mt35xu01g");
> + flash_dev = qdev_new(s->ospi_model ? s->ospi_model : "mt35xu01g");
> if (dinfo) {
> qdev_prop_set_drive_err(flash_dev, "drive",
> blk_by_legacy_dinfo(dinfo), &error_fatal);
> @@ -769,6 +786,13 @@ static void versal_virt_machine_instance_init(Object *obj)
> 0);
> }
>
> +static void versal_virt_machine_finalize(Object *obj)
> +{
> + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj);
> +
> + g_free(s->ospi_model);
> +}
> +
> static void versal_virt_machine_class_init(ObjectClass *oc, void *data)
> {
> MachineClass *mc = MACHINE_CLASS(oc);
> @@ -780,6 +804,10 @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data)
> mc->default_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS;
> mc->no_cdrom = true;
> mc->default_ram_id = "ddr";
> + object_class_property_add_str(oc, "ospi-flash", versal_get_ospi_model,
> + versal_set_ospi_model);
> + object_class_property_set_description(oc, "ospi-flash",
> + "Change the OSPI Flash model");
> }
>
> static const TypeInfo versal_virt_machine_init_typeinfo = {
> @@ -788,6 +816,7 @@ static const TypeInfo versal_virt_machine_init_typeinfo = {
> .class_init = versal_virt_machine_class_init,
> .instance_init = versal_virt_machine_instance_init,
> .instance_size = sizeof(VersalVirt),
> + .instance_finalize = versal_virt_machine_finalize,
> };
>
> static void versal_virt_machine_init_register_types(void)
> --
> 2.25.1
>
next prev parent reply other threads:[~2023-12-05 21:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 9:52 [PATCH 0/2] OSPI updates Sai Pavan Boddu
2023-12-05 9:52 ` [PATCH 1/2] block: m25p80: Add support of mt35xu02gbba Sai Pavan Boddu
2023-12-05 21:13 ` Francisco Iglesias
2023-12-05 9:52 ` [PATCH 2/2] arm: xlnx-versal-virt: Add machine property ospi-flash Sai Pavan Boddu
2023-12-05 21:13 ` Francisco Iglesias [this message]
2023-12-12 17:40 ` Peter Maydell
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=20231205211327.GC9927@fralle-msi \
--to=frasse.iglesias@gmail.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sai.pavan.boddu@amd.com \
--cc=saipavanboddu@gmail.com \
/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.