[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] xen/arm: refactor vpl011_data_avail
commit c71e06cc845bf5fd1f0bdf7b4c0c7fe79df3c361 Author: Stefano Stabellini <sstabellini@xxxxxxxxxx> AuthorDate: Tue Nov 13 09:49:32 2018 -0800 Commit: Julien Grall <julien.grall@xxxxxxx> CommitDate: Wed Nov 14 19:34:48 2018 +0000 xen/arm: refactor vpl011_data_avail Move the code to calculate in_fifo_level and out_fifo_level out of vpl011_data_avail, to the caller. This change will make it possible to reuse vpl011_data_avail with different ring structures in a later patch. Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx> Acked-by: Julien Grall <julien.grall@xxxxxxx> --- xen/arch/arm/vpl011.c | 64 +++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index cc9ef20e5e..e29515a3b6 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -379,30 +379,13 @@ static const struct mmio_handler_ops vpl011_mmio_handler = { .write = vpl011_mmio_write, }; -static void vpl011_data_avail(struct domain *d) +static void vpl011_data_avail(struct domain *d, + XENCONS_RING_IDX in_fifo_level, + XENCONS_RING_IDX in_size, + XENCONS_RING_IDX out_fifo_level, + XENCONS_RING_IDX out_size) { - unsigned long flags; struct vpl011 *vpl011 = &d->arch.vpl011; - struct xencons_interface *intf = vpl011->backend.dom.ring_buf; - XENCONS_RING_IDX in_cons, in_prod, out_cons, out_prod; - XENCONS_RING_IDX in_fifo_level, out_fifo_level; - - VPL011_LOCK(d, flags); - - in_cons = intf->in_cons; - in_prod = intf->in_prod; - out_cons = intf->out_cons; - out_prod = intf->out_prod; - - smp_rmb(); - - in_fifo_level = xencons_queued(in_prod, - in_cons, - sizeof(intf->in)); - - out_fifo_level = xencons_queued(out_prod, - out_cons, - sizeof(intf->out)); /**** Update the UART RX state ****/ @@ -411,11 +394,11 @@ static void vpl011_data_avail(struct domain *d) vpl011->uartfr &= ~RXFE; /* Set the FIFO_FULL bit if the Xen buffer is full. */ - if ( in_fifo_level == sizeof(intf->in) ) + if ( in_fifo_level == in_size ) vpl011->uartfr |= RXFF; /* Assert the RX interrupt if the FIFO is more than half way filled. */ - if ( in_fifo_level >= sizeof(intf->in) - SBSA_UART_FIFO_LEVEL ) + if ( in_fifo_level >= in_size - SBSA_UART_FIFO_LEVEL ) vpl011->uartris |= RXI; /* @@ -428,7 +411,7 @@ static void vpl011_data_avail(struct domain *d) /**** Update the UART TX state ****/ - if ( out_fifo_level != sizeof(intf->out) ) + if ( out_fifo_level != out_size ) { vpl011->uartfr &= ~TXFF; @@ -446,13 +429,38 @@ static void vpl011_data_avail(struct domain *d) if ( out_fifo_level == 0 ) vpl011->uartfr |= TXFE; - - VPL011_UNLOCK(d, flags); } static void vpl011_notification(struct vcpu *v, unsigned int port) { - vpl011_data_avail(v->domain); + unsigned long flags; + struct domain *d = v->domain; + struct vpl011 *vpl011 = &d->arch.vpl011; + struct xencons_interface *intf = vpl011->backend.dom.ring_buf; + XENCONS_RING_IDX in_cons, in_prod, out_cons, out_prod; + XENCONS_RING_IDX in_fifo_level, out_fifo_level; + + VPL011_LOCK(d, flags); + + in_cons = intf->in_cons; + in_prod = intf->in_prod; + out_cons = intf->out_cons; + out_prod = intf->out_prod; + + smp_rmb(); + + in_fifo_level = xencons_queued(in_prod, + in_cons, + sizeof(intf->in)); + + out_fifo_level = xencons_queued(out_prod, + out_cons, + sizeof(intf->out)); + + vpl011_data_avail(v->domain, in_fifo_level, sizeof(intf->in), + out_fifo_level, sizeof(intf->out)); + + VPL011_UNLOCK(d, flags); } int domain_vpl011_init(struct domain *d, struct vpl011_init_info *info) -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |