* [PATCH 0/2] OSPI updates @ 2023-12-05 9:52 Sai Pavan Boddu 2023-12-05 9:52 ` [PATCH 1/2] block: m25p80: Add support of mt35xu02gbba Sai Pavan Boddu 2023-12-05 9:52 ` [PATCH 2/2] arm: xlnx-versal-virt: Add machine property ospi-flash Sai Pavan Boddu 0 siblings, 2 replies; 6+ messages in thread From: Sai Pavan Boddu @ 2023-12-05 9:52 UTC (permalink / raw) To: qemu-devel Cc: qemu-arm, qemu-block, Alistair Francis, Edgar E. Iglesias, Peter Maydell, Kevin Wolf, Francisco Iglesias, saipavanboddu Add a new 2Gib octal flash mt35xu02gbba. Add an interface for versal virt board to swap the default flash. Sai Pavan Boddu (2): block: m25p80: Add support of mt35xu02gbba arm: xlnx-versal-virt: Add machine property ospi-flash hw/block/m25p80_sfdp.h | 1 + hw/arm/xlnx-versal-virt.c | 31 ++++++++++++++++++++++++++++++- hw/block/m25p80.c | 3 +++ hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] block: m25p80: Add support of mt35xu02gbba 2023-12-05 9:52 [PATCH 0/2] OSPI updates Sai Pavan Boddu @ 2023-12-05 9:52 ` 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 1 sibling, 1 reply; 6+ messages in thread From: Sai Pavan Boddu @ 2023-12-05 9:52 UTC (permalink / raw) To: qemu-devel Cc: qemu-arm, qemu-block, Alistair Francis, Edgar E. Iglesias, Peter Maydell, Kevin Wolf, Francisco Iglesias, saipavanboddu Add Micro 2Gb OSPI flash part with sfdp data. Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@amd.com> --- hw/block/m25p80_sfdp.h | 1 + hw/block/m25p80.c | 3 +++ hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h index 011a880f66..1733b56950 100644 --- a/hw/block/m25p80_sfdp.h +++ b/hw/block/m25p80_sfdp.h @@ -16,6 +16,7 @@ #define M25P80_SFDP_MAX_SIZE (1 << 24) uint8_t m25p80_sfdp_n25q256a(uint32_t addr); +uint8_t m25p80_sfdp_mt35xu02g(uint32_t addr); uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr); uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr); diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index afc3fdf4d6..c8c7f6c1c3 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -267,6 +267,9 @@ static const FlashPartInfo known_devices[] = { { INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO_STACKED("mt35xu01g", 0x2c5b1b, 0x104100, 128 << 10, 1024, ER_4K | ER_32K, 2) }, + { INFO_STACKED("mt35xu02gbba", 0x2c5b1c, 0x104100, 128 << 10, 2048, + ER_4K | ER_32K, 4), + .sfdp_read = m25p80_sfdp_mt35xu02g }, { INFO_STACKED("n25q00", 0x20ba21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, { INFO_STACKED("n25q00a", 0x20bb21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, { INFO_STACKED("mt25ql01g", 0x20ba21, 0x1040, 64 << 10, 2048, ER_4K, 2) }, diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c index b33811a4f5..6ee2cfaf11 100644 --- a/hw/block/m25p80_sfdp.c +++ b/hw/block/m25p80_sfdp.c @@ -57,6 +57,42 @@ static const uint8_t sfdp_n25q256a[] = { }; define_sfdp_read(n25q256a); +static const uint8_t sfdp_mt35xu02g[] = { + 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff, + 0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff, + 0x84, 0x00, 0x01, 0x02, 0x80, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe5, 0x20, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0x0c, 0x20, 0x11, 0xd8, + 0x0f, 0x52, 0x00, 0x00, 0x24, 0x5a, 0x99, 0x00, + 0x8b, 0x8e, 0x03, 0xe1, 0xac, 0x01, 0x27, 0x38, + 0x7a, 0x75, 0x7a, 0x75, 0xfb, 0xbd, 0xd5, 0x5c, + 0x00, 0x00, 0x70, 0xff, 0x81, 0xb0, 0x38, 0x36, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x43, 0x0e, 0xff, 0xff, 0x21, 0xdc, 0x5c, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +}; + +define_sfdp_read(mt35xu02g); /* * Matronix -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] block: m25p80: Add support of mt35xu02gbba 2023-12-05 9:52 ` [PATCH 1/2] block: m25p80: Add support of mt35xu02gbba Sai Pavan Boddu @ 2023-12-05 21:13 ` Francisco Iglesias 0 siblings, 0 replies; 6+ messages in thread From: Francisco Iglesias @ 2023-12-05 21:13 UTC (permalink / raw) To: Sai Pavan Boddu Cc: qemu-devel, qemu-arm, qemu-block, Alistair Francis, Edgar E. Iglesias, Peter Maydell, Kevin Wolf, saipavanboddu On [2023 Dec 05] Tue 15:22:25, Sai Pavan Boddu wrote: > Add Micro 2Gb OSPI flash part with sfdp data. > > Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@amd.com> Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> > --- > hw/block/m25p80_sfdp.h | 1 + > hw/block/m25p80.c | 3 +++ > hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 40 insertions(+) > > diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h > index 011a880f66..1733b56950 100644 > --- a/hw/block/m25p80_sfdp.h > +++ b/hw/block/m25p80_sfdp.h > @@ -16,6 +16,7 @@ > #define M25P80_SFDP_MAX_SIZE (1 << 24) > > uint8_t m25p80_sfdp_n25q256a(uint32_t addr); > +uint8_t m25p80_sfdp_mt35xu02g(uint32_t addr); > > uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr); > uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr); > diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c > index afc3fdf4d6..c8c7f6c1c3 100644 > --- a/hw/block/m25p80.c > +++ b/hw/block/m25p80.c > @@ -267,6 +267,9 @@ static const FlashPartInfo known_devices[] = { > { INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K) }, > { INFO_STACKED("mt35xu01g", 0x2c5b1b, 0x104100, 128 << 10, 1024, > ER_4K | ER_32K, 2) }, > + { INFO_STACKED("mt35xu02gbba", 0x2c5b1c, 0x104100, 128 << 10, 2048, > + ER_4K | ER_32K, 4), > + .sfdp_read = m25p80_sfdp_mt35xu02g }, > { INFO_STACKED("n25q00", 0x20ba21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, > { INFO_STACKED("n25q00a", 0x20bb21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, > { INFO_STACKED("mt25ql01g", 0x20ba21, 0x1040, 64 << 10, 2048, ER_4K, 2) }, > diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c > index b33811a4f5..6ee2cfaf11 100644 > --- a/hw/block/m25p80_sfdp.c > +++ b/hw/block/m25p80_sfdp.c > @@ -57,6 +57,42 @@ static const uint8_t sfdp_n25q256a[] = { > }; > define_sfdp_read(n25q256a); > > +static const uint8_t sfdp_mt35xu02g[] = { > + 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff, > + 0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff, > + 0x84, 0x00, 0x01, 0x02, 0x80, 0x00, 0x00, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xe5, 0x20, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x7f, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, > + 0xff, 0xff, 0x00, 0x00, 0x0c, 0x20, 0x11, 0xd8, > + 0x0f, 0x52, 0x00, 0x00, 0x24, 0x5a, 0x99, 0x00, > + 0x8b, 0x8e, 0x03, 0xe1, 0xac, 0x01, 0x27, 0x38, > + 0x7a, 0x75, 0x7a, 0x75, 0xfb, 0xbd, 0xd5, 0x5c, > + 0x00, 0x00, 0x70, 0xff, 0x81, 0xb0, 0x38, 0x36, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0x43, 0x0e, 0xff, 0xff, 0x21, 0xdc, 0x5c, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, > +}; > + > +define_sfdp_read(mt35xu02g); > > /* > * Matronix > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] arm: xlnx-versal-virt: Add machine property ospi-flash 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 9:52 ` Sai Pavan Boddu 2023-12-05 21:13 ` Francisco Iglesias 2023-12-12 17:40 ` Peter Maydell 1 sibling, 2 replies; 6+ messages in thread From: Sai Pavan Boddu @ 2023-12-05 9:52 UTC (permalink / raw) To: qemu-devel Cc: qemu-arm, qemu-block, Alistair Francis, Edgar E. Iglesias, Peter Maydell, Kevin Wolf, Francisco Iglesias, saipavanboddu 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> --- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] arm: xlnx-versal-virt: Add machine property ospi-flash 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 2023-12-12 17:40 ` Peter Maydell 1 sibling, 0 replies; 6+ messages in thread From: Francisco Iglesias @ 2023-12-05 21:13 UTC (permalink / raw) To: Sai Pavan Boddu Cc: qemu-devel, qemu-arm, qemu-block, Alistair Francis, Edgar E. Iglesias, Peter Maydell, Kevin Wolf, saipavanboddu 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 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] arm: xlnx-versal-virt: Add machine property ospi-flash 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 @ 2023-12-12 17:40 ` Peter Maydell 1 sibling, 0 replies; 6+ messages in thread From: Peter Maydell @ 2023-12-12 17:40 UTC (permalink / raw) To: Sai Pavan Boddu Cc: qemu-devel, qemu-arm, qemu-block, Alistair Francis, Edgar E. Iglesias, Kevin Wolf, Francisco Iglesias, saipavanboddu On Tue, 5 Dec 2023 at 09:52, Sai Pavan Boddu <sai.pavan.boddu@amd.com> 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> > --- > 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); This doesn't do any checking of the string the user passes, which means the user can make us hit an abort() with a not terribly helpful error message: $ ./build/arm-clang/qemu-system-aarch64 -M xlnx-versal-virt,ospi-flash=bang qemu-system-aarch64: unknown type 'bang' Aborted (core dumped) or complain about trying to create an abstract type: $ ./build/arm-clang/qemu-system-aarch64 -M xlnx-versal-virt,ospi-flash=m25p80-generic ** ERROR:../../qom/object.c:525:object_initialize_with_type: assertion failed: (type->abstract == false) Bail out! ERROR:../../qom/object.c:525:object_initialize_with_type: assertion failed: (type->abstract == false) Aborted (core dumped) or do some weird stuff if you pass it something that isn't a flash device type name: $ ./build/arm-clang/qemu-system-aarch64 -M xlnx-versal-virt,ospi-flash=e1000 Unexpected error in object_property_find_err() at ../../qom/object.c:1330: qemu-system-aarch64: Property 'e1000.cs' not found Aborted (core dumped) I think you need to check that the string corresponds to a type that actually exists and is a subtype of TYPE_M25P80 and isn't an abstract type. thanks -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-12-12 17:41 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2023-12-12 17:40 ` Peter Maydell
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).