[Top][All Lists]
[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
>
- Re: [Qemu-devel] [PATCHv3 02/14] unicore32-softmmu: Add coprocessor 0(sysctrl) and 1(ocd) instruction support, (continued)
[Qemu-devel] [PATCHv3 01/14] unicore32-softmmu: Add unicore32-softmmu build support, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 04/14] target-unicore32: Drop UC32_CPUID macros, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 03/14] unicore32-softmmu: Make UniCore32 cpuid & exceptions correct and runable, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 06/14] unicore32-softmmu: Make sure that kernel can access user space, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 12/14] unicore32-softmmu: Add puv3 dma support, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 07/14] unicore32-softmmu: Add puv3 soc/board support, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 10/14] unicore32-softmmu: Add puv3 gpio support, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 08/14] unicore32-softmmu: Add puv3 interrupt support, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 14/14] unicore32-softmmu: Add maintainer information for UniCore32 machine, Guan Xuetao, 2012/06/18
[Qemu-devel] [PATCHv3 09/14] unicore32-softmmu: Add puv3 ostimer support, Guan Xuetao, 2012/06/18