Discussion:
[Xen-changelog] [xen staging] xen/arm: introduce a union in vpl011
p***@xen.org
2018-11-14 19:58:18 UTC
Permalink
commit c7d4847a430867102c483b81c5d222a3cded14d8
Author: Stefano Stabellini <***@kernel.org>
AuthorDate: Tue Nov 13 09:49:32 2018 -0800
Commit: Julien Grall <***@arm.com>
CommitDate: Wed Nov 14 19:34:48 2018 +0000

xen/arm: introduce a union in vpl011

Introduce a union in struct vpl011 to contain the console ring members.
A later patch will add another member of the union for the case where
the backend is in Xen.

Signed-off-by: Stefano Stabellini <***@xilinx.com>
Acked-by: Julien Grall <***@arm.com>
---
xen/arch/arm/vpl011.c | 22 ++++++++++++----------
xen/include/asm-arm/vpl011.h | 8 ++++++--
2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 117e41c760..cc9ef20e5e 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -83,7 +83,7 @@ static uint8_t vpl011_read_data(struct domain *d)
unsigned long flags;
uint8_t data = 0;
struct vpl011 *vpl011 = &d->arch.vpl011;
- struct xencons_interface *intf = vpl011->ring_buf;
+ struct xencons_interface *intf = vpl011->backend.dom.ring_buf;
XENCONS_RING_IDX in_cons, in_prod;

VPL011_LOCK(d, flags);
@@ -146,7 +146,7 @@ static uint8_t vpl011_read_data(struct domain *d)
static void vpl011_update_tx_fifo_status(struct vpl011 *vpl011,
unsigned int fifo_level)
{
- struct xencons_interface *intf = vpl011->ring_buf;
+ struct xencons_interface *intf = vpl011->backend.dom.ring_buf;
unsigned int fifo_threshold = sizeof(intf->out) - SBSA_UART_FIFO_LEVEL;

BUILD_BUG_ON(sizeof(intf->out) < SBSA_UART_FIFO_SIZE);
@@ -165,7 +165,7 @@ static void vpl011_write_data(struct domain *d, uint8_t data)
{
unsigned long flags;
struct vpl011 *vpl011 = &d->arch.vpl011;
- struct xencons_interface *intf = vpl011->ring_buf;
+ struct xencons_interface *intf = vpl011->backend.dom.ring_buf;
XENCONS_RING_IDX out_cons, out_prod;

VPL011_LOCK(d, flags);
@@ -383,7 +383,7 @@ static void vpl011_data_avail(struct domain *d)
{
unsigned long flags;
struct vpl011 *vpl011 = &d->arch.vpl011;
- struct xencons_interface *intf = vpl011->ring_buf;
+ 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;

@@ -460,14 +460,14 @@ int domain_vpl011_init(struct domain *d, struct vpl011_init_info *info)
int rc;
struct vpl011 *vpl011 = &d->arch.vpl011;

- if ( vpl011->ring_buf )
+ if ( vpl011->backend.dom.ring_buf )
return -EINVAL;

/* Map the guest PFN to Xen address space. */
rc = prepare_ring_for_helper(d,
gfn_x(info->gfn),
- &vpl011->ring_page,
- &vpl011->ring_buf);
+ &vpl011->backend.dom.ring_page,
+ &vpl011->backend.dom.ring_buf);
if ( rc < 0 )
goto out;

@@ -496,7 +496,8 @@ out2:
vgic_free_virq(d, GUEST_VPL011_SPI);

out1:
- destroy_ring_for_helper(&vpl011->ring_buf, vpl011->ring_page);
+ destroy_ring_for_helper(&vpl011->backend.dom.ring_buf,
+ vpl011->backend.dom.ring_page);

out:
return rc;
@@ -506,11 +507,12 @@ void domain_vpl011_deinit(struct domain *d)
{
struct vpl011 *vpl011 = &d->arch.vpl011;

- if ( !vpl011->ring_buf )
+ if ( !vpl011->backend.dom.ring_buf )
return;

free_xen_event_channel(d, vpl011->evtchn);
- destroy_ring_for_helper(&vpl011->ring_buf, vpl011->ring_page);
+ destroy_ring_for_helper(&vpl011->backend.dom.ring_buf,
+ vpl011->backend.dom.ring_page);
}

/*
diff --git a/xen/include/asm-arm/vpl011.h b/xen/include/asm-arm/vpl011.h
index a82869a53c..a880bcfd99 100644
--- a/xen/include/asm-arm/vpl011.h
+++ b/xen/include/asm-arm/vpl011.h
@@ -30,8 +30,12 @@
#define SBSA_UART_FIFO_SIZE 32

struct vpl011 {
- void *ring_buf;
- struct page_info *ring_page;
+ union {
+ struct {
+ void *ring_buf;
+ struct page_info *ring_page;
+ } dom;
+ } backend;
uint32_t uartfr; /* Flag register */
uint32_t uartcr; /* Control register */
uint32_t uartimsc; /* Interrupt mask register*/
--
generated by git-patchbot for /home/xen/git/xen.git#staging

Loading...