* [Qemu-devel] [PATCH V2 for-2.10] xlnx-qspi: add a property for mmio-execution
@ 2017-08-11 7:54 KONRAD Frederic
2017-08-11 14:29 ` Edgar E. Iglesias
0 siblings, 1 reply; 3+ messages in thread
From: KONRAD Frederic @ 2017-08-11 7:54 UTC (permalink / raw)
To: peter.maydell
Cc: qemu-devel, edgar.iglesias, alistair.francis, dgilbert, quintela,
frederic.konrad
This adds mmio-exec property to workaround the migration bug.
When enabled the migration is blocked and will return an error.
Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
V1 -> V2:
* changed mmio-exec to x-mmio-exec
---
hw/ssi/xilinx_spips.c | 36 +++++++++++++++++++++++++++++++++---
1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c
index e833028..ef56d35 100644
--- a/hw/ssi/xilinx_spips.c
+++ b/hw/ssi/xilinx_spips.c
@@ -31,6 +31,8 @@
#include "hw/ssi/ssi.h"
#include "qemu/bitops.h"
#include "hw/ssi/xilinx_spips.h"
+#include "qapi/error.h"
+#include "migration/blocker.h"
#ifndef XILINX_SPIPS_ERR_DEBUG
#define XILINX_SPIPS_ERR_DEBUG 0
@@ -139,6 +141,8 @@ typedef struct {
uint8_t lqspi_buf[LQSPI_CACHE_SIZE];
hwaddr lqspi_cached_addr;
+ Error *migration_blocker;
+ bool mmio_execution_enabled;
} XilinxQSPIPS;
typedef struct XilinxSPIPSClass {
@@ -500,12 +504,13 @@ static void xilinx_qspips_invalidate_mmio_ptr(XilinxQSPIPS *q)
{
XilinxSPIPS *s = &q->parent_obj;
- if (q->lqspi_cached_addr != ~0ULL) {
+ if ((q->mmio_execution_enabled) && (q->lqspi_cached_addr != ~0ULL)) {
/* Invalidate the current mapped mmio */
memory_region_invalidate_mmio_ptr(&s->mmlqspi, q->lqspi_cached_addr,
LQSPI_CACHE_SIZE);
- q->lqspi_cached_addr = ~0ULL;
}
+
+ q->lqspi_cached_addr = ~0ULL;
}
static void xilinx_qspips_write(void *opaque, hwaddr addr,
@@ -601,8 +606,13 @@ static void *lqspi_request_mmio_ptr(void *opaque, hwaddr addr, unsigned *size,
unsigned *offset)
{
XilinxQSPIPS *q = opaque;
- hwaddr offset_within_the_region = addr & ~(LQSPI_CACHE_SIZE - 1);
+ hwaddr offset_within_the_region;
+ if (!q->mmio_execution_enabled) {
+ return NULL;
+ }
+
+ offset_within_the_region = addr & ~(LQSPI_CACHE_SIZE - 1);
lqspi_load_cache(opaque, offset_within_the_region);
*size = LQSPI_CACHE_SIZE;
*offset = offset_within_the_region;
@@ -693,6 +703,15 @@ static void xilinx_qspips_realize(DeviceState *dev, Error **errp)
sysbus_init_mmio(sbd, &s->mmlqspi);
q->lqspi_cached_addr = ~0ULL;
+
+ /* mmio_execution breaks migration better aborting than having strange
+ * bugs.
+ */
+ if (q->mmio_execution_enabled) {
+ error_setg(&q->migration_blocker,
+ "enabling mmio_execution breaks migration");
+ migrate_add_blocker(q->migration_blocker, &error_fatal);
+ }
}
static int xilinx_spips_post_load(void *opaque, int version_id)
@@ -716,6 +735,16 @@ static const VMStateDescription vmstate_xilinx_spips = {
}
};
+static Property xilinx_qspips_properties[] = {
+ /* We had to turn this off for 2.10 as it is not compatible with migration.
+ * It can be enabled but will prevent the device to be migrated.
+ * This will go aways when a fix will be released.
+ */
+ DEFINE_PROP_BOOL("x-mmio-exec", XilinxQSPIPS, mmio_execution_enabled,
+ false),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static Property xilinx_spips_properties[] = {
DEFINE_PROP_UINT8("num-busses", XilinxSPIPS, num_busses, 1),
DEFINE_PROP_UINT8("num-ss-bits", XilinxSPIPS, num_cs, 4),
@@ -729,6 +758,7 @@ static void xilinx_qspips_class_init(ObjectClass *klass, void * data)
XilinxSPIPSClass *xsc = XILINX_SPIPS_CLASS(klass);
dc->realize = xilinx_qspips_realize;
+ dc->props = xilinx_qspips_properties;
xsc->reg_ops = &qspips_ops;
xsc->rx_fifo_size = RXFF_A_Q;
xsc->tx_fifo_size = TXFF_A_Q;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH V2 for-2.10] xlnx-qspi: add a property for mmio-execution
2017-08-11 7:54 [Qemu-devel] [PATCH V2 for-2.10] xlnx-qspi: add a property for mmio-execution KONRAD Frederic
@ 2017-08-11 14:29 ` Edgar E. Iglesias
2017-08-14 14:17 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Edgar E. Iglesias @ 2017-08-11 14:29 UTC (permalink / raw)
To: KONRAD Frederic
Cc: peter.maydell, qemu-devel, alistair.francis, dgilbert, quintela
On Fri, Aug 11, 2017 at 09:54:12AM +0200, KONRAD Frederic wrote:
> This adds mmio-exec property to workaround the migration bug.
> When enabled the migration is blocked and will return an error.
>
> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
Thanks Fred!
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>
> V1 -> V2:
> * changed mmio-exec to x-mmio-exec
> ---
> hw/ssi/xilinx_spips.c | 36 +++++++++++++++++++++++++++++++++---
> 1 file changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c
> index e833028..ef56d35 100644
> --- a/hw/ssi/xilinx_spips.c
> +++ b/hw/ssi/xilinx_spips.c
> @@ -31,6 +31,8 @@
> #include "hw/ssi/ssi.h"
> #include "qemu/bitops.h"
> #include "hw/ssi/xilinx_spips.h"
> +#include "qapi/error.h"
> +#include "migration/blocker.h"
>
> #ifndef XILINX_SPIPS_ERR_DEBUG
> #define XILINX_SPIPS_ERR_DEBUG 0
> @@ -139,6 +141,8 @@ typedef struct {
>
> uint8_t lqspi_buf[LQSPI_CACHE_SIZE];
> hwaddr lqspi_cached_addr;
> + Error *migration_blocker;
> + bool mmio_execution_enabled;
> } XilinxQSPIPS;
>
> typedef struct XilinxSPIPSClass {
> @@ -500,12 +504,13 @@ static void xilinx_qspips_invalidate_mmio_ptr(XilinxQSPIPS *q)
> {
> XilinxSPIPS *s = &q->parent_obj;
>
> - if (q->lqspi_cached_addr != ~0ULL) {
> + if ((q->mmio_execution_enabled) && (q->lqspi_cached_addr != ~0ULL)) {
> /* Invalidate the current mapped mmio */
> memory_region_invalidate_mmio_ptr(&s->mmlqspi, q->lqspi_cached_addr,
> LQSPI_CACHE_SIZE);
> - q->lqspi_cached_addr = ~0ULL;
> }
> +
> + q->lqspi_cached_addr = ~0ULL;
> }
>
> static void xilinx_qspips_write(void *opaque, hwaddr addr,
> @@ -601,8 +606,13 @@ static void *lqspi_request_mmio_ptr(void *opaque, hwaddr addr, unsigned *size,
> unsigned *offset)
> {
> XilinxQSPIPS *q = opaque;
> - hwaddr offset_within_the_region = addr & ~(LQSPI_CACHE_SIZE - 1);
> + hwaddr offset_within_the_region;
>
> + if (!q->mmio_execution_enabled) {
> + return NULL;
> + }
> +
> + offset_within_the_region = addr & ~(LQSPI_CACHE_SIZE - 1);
> lqspi_load_cache(opaque, offset_within_the_region);
> *size = LQSPI_CACHE_SIZE;
> *offset = offset_within_the_region;
> @@ -693,6 +703,15 @@ static void xilinx_qspips_realize(DeviceState *dev, Error **errp)
> sysbus_init_mmio(sbd, &s->mmlqspi);
>
> q->lqspi_cached_addr = ~0ULL;
> +
> + /* mmio_execution breaks migration better aborting than having strange
> + * bugs.
> + */
> + if (q->mmio_execution_enabled) {
> + error_setg(&q->migration_blocker,
> + "enabling mmio_execution breaks migration");
> + migrate_add_blocker(q->migration_blocker, &error_fatal);
> + }
> }
>
> static int xilinx_spips_post_load(void *opaque, int version_id)
> @@ -716,6 +735,16 @@ static const VMStateDescription vmstate_xilinx_spips = {
> }
> };
>
> +static Property xilinx_qspips_properties[] = {
> + /* We had to turn this off for 2.10 as it is not compatible with migration.
> + * It can be enabled but will prevent the device to be migrated.
> + * This will go aways when a fix will be released.
> + */
> + DEFINE_PROP_BOOL("x-mmio-exec", XilinxQSPIPS, mmio_execution_enabled,
> + false),
> + DEFINE_PROP_END_OF_LIST(),
> +};
> +
> static Property xilinx_spips_properties[] = {
> DEFINE_PROP_UINT8("num-busses", XilinxSPIPS, num_busses, 1),
> DEFINE_PROP_UINT8("num-ss-bits", XilinxSPIPS, num_cs, 4),
> @@ -729,6 +758,7 @@ static void xilinx_qspips_class_init(ObjectClass *klass, void * data)
> XilinxSPIPSClass *xsc = XILINX_SPIPS_CLASS(klass);
>
> dc->realize = xilinx_qspips_realize;
> + dc->props = xilinx_qspips_properties;
> xsc->reg_ops = &qspips_ops;
> xsc->rx_fifo_size = RXFF_A_Q;
> xsc->tx_fifo_size = TXFF_A_Q;
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH V2 for-2.10] xlnx-qspi: add a property for mmio-execution
2017-08-11 14:29 ` Edgar E. Iglesias
@ 2017-08-14 14:17 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2017-08-14 14:17 UTC (permalink / raw)
To: Edgar E. Iglesias
Cc: KONRAD Frederic, QEMU Developers, Alistair Francis,
Dr. David Alan Gilbert, Juan Quintela
On 11 August 2017 at 15:29, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> On Fri, Aug 11, 2017 at 09:54:12AM +0200, KONRAD Frederic wrote:
>> This adds mmio-exec property to workaround the migration bug.
>> When enabled the migration is blocked and will return an error.
>>
>> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
>
> Thanks Fred!
>
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>
Thanks; v2 applied to master.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-14 14:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-11 7:54 [Qemu-devel] [PATCH V2 for-2.10] xlnx-qspi: add a property for mmio-execution KONRAD Frederic
2017-08-11 14:29 ` Edgar E. Iglesias
2017-08-14 14:17 ` 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).