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

Re: [Xen-devel] [PATCH 18/38] arm: implement vpl011 (UART) emulator.



> +int domain_uart0_init(struct domain *d)
> +{
> +    int rc;
> +    if ( d->domain_id == 0 )
> +        return 0;

Why?  There's no equivalent gate on the MMIO handlers.

> +    spin_lock_init(&d->arch.uart0.lock);
> +    d->arch.uart0.idx = 0;
> +
> +    rc = -ENOMEM;
> +    d->arch.uart0.buf = xzalloc_array(char, VPL011_BUF_SIZE);
> +    if ( !d->arch.uart0.buf )
> +        goto out;

Just return ENOMEM here - the 'rc=foo; goto out' is overkill.

> +
> +    rc = 0;
> +out:
> +    return rc;
> +}

> +static int uart0_mmio_check(struct vcpu *v, paddr_t addr)
> +{
> +    return v->domain->domain_id && addr >= UART0_BASE_ADDRESS && addr < 
> (UART0_BASE_ADDRESS+65536);
> +}

linewrap?

> +
> +static int uart0_mmio_read(struct vcpu *v, mmio_info_t *info)
> +{
> +    struct hsr_dabt dabt = info->dabt;
> +    struct cpu_user_regs *regs = guest_cpu_user_regs();
> +    uint32_t *r = &regs->r0 + dabt.reg;
> +    int offset = (int)(info->gpa - UART0_BASE_ADDRESS);
> +

Need to check dabt.size != 0 here too?

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.