qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCHv3 12/14] unicore32-softmmu: Add puv3 dma support


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCHv3 12/14] unicore32-softmmu: Add puv3 dma support
Date: Thu, 21 Jun 2012 17:20:35 +0000

On Wed, Jun 20, 2012 at 2:10 AM, Guan Xuetao <address@hidden> wrote:
> On Mon, 2012-06-18 at 19:59 +0000, Blue Swirl wrote:
> [snip]
>> > +
>> > +#define PUV3_DMA_CH_NR          (6)
>> > +#define PUV3_DMA_CH_MASK        (0xff)
>> > +#define PUV3_DMA_CH(offset)     ((offset) >> 8)
>> > +
>> > +typedef struct {
>> > +    SysBusDevice busdev;
>> > +    MemoryRegion iomem;
>> > +    uint32_t reg_CFG[PUV3_DMA_CH_NR];
>> > +} PUV3DMAState;
>> > +
>> > +static uint64_t puv3_dma_read(void *opaque, target_phys_addr_t offset,
>> > +        unsigned size)
>> > +{
>> > +    PUV3DMAState *s = (PUV3DMAState *) opaque;
>>
>> These casts from void pointer are not needed in C.
> I see. Thanks.
>
>> > +    uint32_t ret;
>> > +
>> > +    assert(PUV3_DMA_CH(offset) < PUV3_DMA_CH_NR);
>> > +
>> > +    switch (offset & PUV3_DMA_CH_MASK) {
>> > +    case 0x10:
>> > +        ret = s->reg_CFG[PUV3_DMA_CH(offset)];
>> > +        break;
>> > +    default:
>> > +        hw_error("%s: Bad offset 0x%x\n", __func__, offset);
>>
>> hw_error() also aborts, it would be nice to avoid that. However, the
>> situation is somewhat different from the instruction case, since only
>> privileged guest code (kernel) can write to hardware. The kernel can
>> also for example power off the machine.
>
> It's the same problem as cpu_abort. Warning information is enough here.
> Is there a global and simple way to do it, g_warning()?

The users will probably not be very interested about any debugging
messages. In cases like this, two common ways are to use trace points
or debugging printf macros.

>
> Guan Xuetao
>



reply via email to

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