diff mbox series

[v3,03/24] arm/vuart: add hwdom prefix to UART emulator

Message ID 20250103-vuart-ns8250-v3-v1-3-c5d36b31d66c@ford.com (mailing list archive)
State New
Headers show
Series x86: introduce NS16550-compatible UART emulator | expand

Commit Message

Denis Mukhin via B4 Relay Jan. 4, 2025, 1:58 a.m. UTC
From: Denis Mukhin <dmukhin@ford.com>

Using "vuart" in UART emulator designed for hardware domain debugging
is confusing in generic Arm code (e.g. vpl011 is also "vuart").
Fix that by adding hwdom prefix to all symbols in arm/vuart.c.

Also, remove domain_has_vuart() from arm/vuart.c since it is not needed.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 xen/arch/arm/domain.c |  4 ++--
 xen/arch/arm/vuart.c  | 35 +++++++++++++++--------------------
 xen/arch/arm/vuart.h  |  8 ++++----
 3 files changed, 21 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 3ba959f866338d2e7f7dc0e301cd79c10fbc4549..7ef1a95c290752d5a0167806e298aacc834ea640 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -775,7 +775,7 @@  int arch_domain_create(struct domain *d,
      * Only use it for the hardware domain because the linux kernel may not
      * support multi-platform.
      */
-    if ( is_hardware_domain(d) && (rc = domain_vuart_init(d)) )
+    if ( is_hardware_domain(d) && (rc = hwdom_vuart_init(d)) )
         goto fail;
 
     if ( (rc = domain_vpci_init(d)) != 0 )
@@ -844,7 +844,7 @@  void arch_domain_destroy(struct domain *d)
     iommu_domain_destroy(d);
     p2m_final_teardown(d);
     domain_vgic_free(d);
-    domain_vuart_free(d);
+    hwdom_vuart_free(d);
     free_xenheap_page(d->shared_info);
 #ifdef CONFIG_ACPI
     free_xenheap_pages(d->arch.efi_acpi_table,
diff --git a/xen/arch/arm/vuart.c b/xen/arch/arm/vuart.c
index 98a65b99385a2a119725bab8634ed7cf9d926d68..23e05dba3a5617863f6c08f085c358f2cf32a292 100644
--- a/xen/arch/arm/vuart.c
+++ b/xen/arch/arm/vuart.c
@@ -31,19 +31,17 @@ 
 
 #include "vuart.h"
 
-#define domain_has_vuart(d) ((d)->arch.vuart.info != NULL)
+static int hwdom_vuart_mmio_read(struct vcpu *v, mmio_info_t *info,
+                                 register_t *r, void *priv);
+static int hwdom_vuart_mmio_write(struct vcpu *v, mmio_info_t *info,
+                                  register_t r, void *priv);
 
-static int vuart_mmio_read(struct vcpu *v, mmio_info_t *info,
-                           register_t *r, void *priv);
-static int vuart_mmio_write(struct vcpu *v, mmio_info_t *info,
-                            register_t r, void *priv);
-
-static const struct mmio_handler_ops vuart_mmio_handler = {
-    .read  = vuart_mmio_read,
-    .write = vuart_mmio_write,
+static const struct mmio_handler_ops hwdom_vuart_mmio_handler = {
+    .read  = hwdom_vuart_mmio_read,
+    .write = hwdom_vuart_mmio_write,
 };
 
-int domain_vuart_init(struct domain *d)
+int hwdom_vuart_init(struct domain *d)
 {
     ASSERT( is_hardware_domain(d) );
 
@@ -58,7 +56,7 @@  int domain_vuart_init(struct domain *d)
     if ( !d->arch.vuart.buf )
         return -ENOMEM;
 
-    register_mmio_handler(d, &vuart_mmio_handler,
+    register_mmio_handler(d, &hwdom_vuart_mmio_handler,
                           d->arch.vuart.info->base_addr,
                           d->arch.vuart.info->size,
                           NULL);
@@ -66,15 +64,12 @@  int domain_vuart_init(struct domain *d)
     return 0;
 }
 
-void domain_vuart_free(struct domain *d)
+void hwdom_vuart_free(struct domain *d)
 {
-    if ( !domain_has_vuart(d) )
-        return;
-
-    xfree(d->arch.vuart.buf);
+    XFREE(d->arch.vuart.buf);
 }
 
-static void vuart_print_char(struct vcpu *v, char c)
+static void hwdom_vuart_print_char(struct vcpu *v, char c)
 {
     struct domain *d = v->domain;
     struct vuart *uart = &d->arch.vuart;
@@ -95,7 +90,7 @@  static void vuart_print_char(struct vcpu *v, char c)
     spin_unlock(&uart->lock);
 }
 
-static int vuart_mmio_read(struct vcpu *v, mmio_info_t *info,
+static int hwdom_vuart_mmio_read(struct vcpu *v, mmio_info_t *info,
                            register_t *r, void *priv)
 {
     struct domain *d = v->domain;
@@ -113,7 +108,7 @@  static int vuart_mmio_read(struct vcpu *v, mmio_info_t *info,
     return 1;
 }
 
-static int vuart_mmio_write(struct vcpu *v, mmio_info_t *info,
+static int hwdom_vuart_mmio_write(struct vcpu *v, mmio_info_t *info,
                             register_t r, void *priv)
 {
     struct domain *d = v->domain;
@@ -123,7 +118,7 @@  static int vuart_mmio_write(struct vcpu *v, mmio_info_t *info,
 
     if ( offset == d->arch.vuart.info->data_off )
         /* ignore any status bits */
-        vuart_print_char(v, r & 0xFF);
+        hwdom_vuart_print_char(v, r & 0xFF);
 
     return 1;
 }
diff --git a/xen/arch/arm/vuart.h b/xen/arch/arm/vuart.h
index e90d84c6eddbb9d9089845c80062940eab997339..e6ca5582726736668765f5928b5c75e821db8aac 100644
--- a/xen/arch/arm/vuart.h
+++ b/xen/arch/arm/vuart.h
@@ -24,12 +24,12 @@  struct domain;
 
 #ifdef CONFIG_HWDOM_VUART
 
-int domain_vuart_init(struct domain *d);
-void domain_vuart_free(struct domain *d);
+int hwdom_vuart_init(struct domain *d);
+void hwdom_vuart_free(struct domain *d);
 
 #else
 
-static inline int domain_vuart_init(struct domain *d)
+static inline int hwdom_vuart_init(struct domain *d)
 {
     /*
      * The vUART is unconditionally inialized for the hw domain. So we
@@ -38,7 +38,7 @@  static inline int domain_vuart_init(struct domain *d)
     return 0;
 }
 
-static inline void domain_vuart_free(struct domain *d) {};
+static inline void hwdom_vuart_free(struct domain *d) {};
 
 #endif /* CONFIG_HWDOM_VUART */