qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/7] arm: Instantiate nRF51 peripherals


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 6/7] arm: Instantiate nRF51 peripherals
Date: Tue, 21 Aug 2018 15:50:01 +0100

On 21 August 2018 at 12:43, Steffen Görtz <address@hidden> wrote:
> Hi Peter,
>>> +
>>> +static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size)
>>> +{
>>> +    qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
>>> +                  __func__, addr, size);
>>> +    return 1;
>>> +}
>>> +
>>> +static void clock_write(void *opaque, hwaddr addr, uint64_t data,
>>> +                        unsigned int size)
>>> +{
>>> +    qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " <- 0x%" PRIx64 " 
>>> [%u]\n",
>>> +                  __func__, addr, data, size);
>>> +}
>>> +
>>> +static const MemoryRegionOps clock_ops = {
>>> +    .read = clock_read,
>>> +    .write = clock_write
>>> +};
>>
>> You don't need to roll your own "do nothing but log" device:
>> you can use the TYPE_UNIMPLEMENTED_DEVICE to do this.
>>
> Until we have a more proper STUB for POWER/CLOCK/MPU peripherals we actually 
> need this,
> because the unimplemented device will return 0 on reads which will cause 
> guest code to stall.

Oh, I see. I hadn't noticed that it was doing read-as-all-ones.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]