diff mbox

[10/11] xen/arm: vpl011: Modify handle_ring_read and buffer_append to read/append vpl011 data

Message ID 1487676368-22356-11-git-send-email-bhupinder.thakur@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Bhupinder Thakur Feb. 21, 2017, 11:26 a.m. UTC
MOdifications in the following functions:

    - handle_ring_read() - to allow reading data from both PV or vpl011 OUT ring buffers
      based on which port received the event
    - buffer_append() - append data received for either PV or vp011 OUT ring buffer

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
---
 tools/console/daemon/io.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Konrad Rzeszutek Wilk March 3, 2017, 9:06 p.m. UTC | #1
On Tue, Feb 21, 2017 at 04:56:07PM +0530, Bhupinder Thakur wrote:
> MOdifications in the following functions:

s/MO/Mo

> 
>     - handle_ring_read() - to allow reading data from both PV or vpl011 OUT ring buffers
>       based on which port received the event
>     - buffer_append() - append data received for either PV or vp011 OUT ring buffer
> 
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
> ---
>  tools/console/daemon/io.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
> index b1aa615..4e531e7 100644
> --- a/tools/console/daemon/io.c
> +++ b/tools/console/daemon/io.c
> @@ -163,12 +163,11 @@ static int write_with_timestamp(int fd, const char *data, size_t sz,
>  	return 0;
>  }
>  
> -static void buffer_append(struct domain *dom)
> +static void buffer_append(struct domain *dom, struct xencons_interface *intf, int port)
>  {
>  	struct buffer *buffer = &dom->buffer;
>  	XENCONS_RING_IDX cons, prod, size;
> -	struct xencons_interface *intf = dom->interface;
> -
> +	

Any reason to add a tab here?
>  	cons = intf->out_cons;
>  	prod = intf->out_prod;
>  	xen_mb();
> @@ -192,7 +191,8 @@ static void buffer_append(struct domain *dom)
>  
>  	xen_mb();
>  	intf->out_cons = cons;
> -	xenevtchn_notify(dom->xce_handle, dom->local_port);
> +
> +	xenevtchn_notify(dom->xce_handle, port);
>  
>  	/* Get the data to the logfile as early as possible because if
>  	 * no one is listening on the console pty then it will fill up
> @@ -961,6 +961,7 @@ static void handle_tty_write(struct domain *dom)
>  static void handle_ring_read(struct domain *dom)
>  {
>  	xenevtchn_port_or_error_t port;
> +	struct xencons_interface *intf;
>  
>  	if (dom->is_dead)
>  		return;
> @@ -970,7 +971,15 @@ static void handle_ring_read(struct domain *dom)
>  
>  	dom->event_count++;
>  
> -	buffer_append(dom);
> +	/*
> +	* select the interface based on the port which the event received
> +	*/

Please remove this comment.

> +	if ( port == dom->vpl011_local_port )
> +		intf = dom->vpl011_interface;
> +	else
> +		intf = dom->interface;
> +
> +	buffer_append(dom, intf, port);
>  
>  	if (dom->event_count < RATE_LIMIT_ALLOWANCE)
>  		(void)xenevtchn_unmask(dom->xce_handle, port);
> @@ -1161,6 +1170,8 @@ void handle_io(void)
>  				d->next_period = now + RATE_LIMIT_PERIOD;
>  				if (d->event_count >= RATE_LIMIT_ALLOWANCE) {
>  					(void)xenevtchn_unmask(d->xce_handle, d->local_port);
> +					if ( d->vpl011_initialized )
> +						(void)xenevtchn_unmask(d->xce_handle, d->vpl011_local_port);
>  				}
>  				d->event_count = 0;
>  			}
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index b1aa615..4e531e7 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -163,12 +163,11 @@  static int write_with_timestamp(int fd, const char *data, size_t sz,
 	return 0;
 }
 
-static void buffer_append(struct domain *dom)
+static void buffer_append(struct domain *dom, struct xencons_interface *intf, int port)
 {
 	struct buffer *buffer = &dom->buffer;
 	XENCONS_RING_IDX cons, prod, size;
-	struct xencons_interface *intf = dom->interface;
-
+	
 	cons = intf->out_cons;
 	prod = intf->out_prod;
 	xen_mb();
@@ -192,7 +191,8 @@  static void buffer_append(struct domain *dom)
 
 	xen_mb();
 	intf->out_cons = cons;
-	xenevtchn_notify(dom->xce_handle, dom->local_port);
+
+	xenevtchn_notify(dom->xce_handle, port);
 
 	/* Get the data to the logfile as early as possible because if
 	 * no one is listening on the console pty then it will fill up
@@ -961,6 +961,7 @@  static void handle_tty_write(struct domain *dom)
 static void handle_ring_read(struct domain *dom)
 {
 	xenevtchn_port_or_error_t port;
+	struct xencons_interface *intf;
 
 	if (dom->is_dead)
 		return;
@@ -970,7 +971,15 @@  static void handle_ring_read(struct domain *dom)
 
 	dom->event_count++;
 
-	buffer_append(dom);
+	/*
+	* select the interface based on the port which the event received
+	*/
+	if ( port == dom->vpl011_local_port )
+		intf = dom->vpl011_interface;
+	else
+		intf = dom->interface;
+
+	buffer_append(dom, intf, port);
 
 	if (dom->event_count < RATE_LIMIT_ALLOWANCE)
 		(void)xenevtchn_unmask(dom->xce_handle, port);
@@ -1161,6 +1170,8 @@  void handle_io(void)
 				d->next_period = now + RATE_LIMIT_PERIOD;
 				if (d->event_count >= RATE_LIMIT_ALLOWANCE) {
 					(void)xenevtchn_unmask(d->xce_handle, d->local_port);
+					if ( d->vpl011_initialized )
+						(void)xenevtchn_unmask(d->xce_handle, d->vpl011_local_port);
 				}
 				d->event_count = 0;
 			}