On Wed, 30 Jan 2019 at 07:21, Stefan Hajnoczi <stefa...@redhat.com> wrote: > +static void flash_write(void *opaque, hwaddr offset, uint64_t value, > + unsigned int size) > +{ > + NRF51NVMState *s = NRF51_NVM(opaque); > + > + if (s->config & NRF51_NVMC_CONFIG_WEN) { > + uint32_t oldval; > + > + assert(offset < s->flash_size);
This would be better as "offset + 4 < s->flash_size", since we're going to be reading 4 bytes, not just 1. (Or "offset + size", though our MemoryRegionOps fields guarantee that size == 4.) > + > + /* NOR Flash only allows bits to be flipped from 1's to 0's on write > */ > + oldval = ldl_le_p(s->storage + offset); > + oldval &= value; > + stl_le_p(s->storage + offset, oldval); > + > + memory_region_flush_rom_device(&s->flash, offset, size); > + } else { > + qemu_log_mask(LOG_GUEST_ERROR, > + "%s: Flash write 0x%" HWADDR_PRIx" while flash not > writable.\n", > + __func__, offset); > + } > +} otherwise Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> thanks -- PMM