@@ -523,6 +523,7 @@ safe."
-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(printk_noprefix)&&kind(function))))"}
-config=MC3A2.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
-doc_end
@@ -89,7 +89,7 @@ static void vpl011_write_data_xen(struct domain *d, uint8_t data)
{
if ( intf->out_prod == 1 )
{
- printk("%c", data);
+ printk_noprefix("%c", data);
intf->out_prod = 0;
}
else
@@ -97,7 +97,7 @@ static void vpl011_write_data_xen(struct domain *d, uint8_t data)
if ( data != '\n' )
intf->out[intf->out_prod++] = '\n';
intf->out[intf->out_prod++] = '\0';
- printk("%s", intf->out);
+ printk_noprefix("%s", intf->out);
intf->out_prod = 0;
}
}
@@ -109,7 +109,7 @@ static void vpl011_write_data_xen(struct domain *d, uint8_t data)
if ( data != '\n' )
intf->out[intf->out_prod++] = '\n';
intf->out[intf->out_prod++] = '\0';
- printk("DOM%u: %s", d->domain_id, intf->out);
+ guest_printk(d, "%s", intf->out);
intf->out_prod = 0;
}
}
@@ -31,6 +31,7 @@
#include <xen/serial.h>
#include <asm/mmio.h>
#include <xen/perfc.h>
+#include <xen/console.h>
#include "vuart.h"
@@ -87,7 +88,12 @@ static void hwdom_vuart_print_char(struct vcpu *v, char c)
if ( c != '\n' )
uart->buf[uart->idx++] = '\n';
uart->buf[uart->idx] = '\0';
- printk(XENLOG_G_DEBUG "DOM%u: %s", d->domain_id, uart->buf);
+
+ if ( d->domain_id == console_get_owner() )
+ printk_noprefix("%s", uart->buf);
+ else
+ guest_printk(d, "%s", uart->buf);
+
uart->idx = 0;
}
spin_unlock(&uart->lock);
@@ -35,6 +35,7 @@
#include <asm/setup.h> /* max_init_domid */
#include <public/io/console.h>
#include <xen/8250-uart.h>
+#include <xen/console.h>
#include <xen/ctype.h>
#include <xen/ioreq.h>
#include <xen/resource.h>
@@ -899,10 +900,12 @@ static int cf_check ns16550_putchar(struct domain *d, char ch)
regs[UART_LSR] |= UART_LSR_DR | val;
/*
- * Echo the user input on Xen console.
+ * Echo the user input on Xen console iff Xen console input is owned
+ * by NS16550 domain.
* NB: use 'console_timestamps=none' to disable Xen timestamps.
*/
- printk("%c", ch);
+ if ( d->domain_id == console_get_owner() )
+ printk_noprefix("%c", ch);
/* FIXME: check FCR when to fire an interrupt */
ns16550_irq_check(vdev);
@@ -1026,6 +1026,14 @@ void printk(const char *fmt, ...)
va_end(args);
}
+void printk_noprefix(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vprintk_common("", fmt, args);
+ va_end(args);
+}
+
void guest_printk(const struct domain *d, const char *fmt, ...)
{
va_list args;
@@ -61,6 +61,9 @@ debugtrace_printk(const char *fmt, ...) {}
extern void printk(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2), cold));
+extern void printk_noprefix(const char *fmt, ...)
+ __attribute__ ((format (printf, 1, 2), cold));
+
#define printk_once(fmt, args...) \
({ \
static bool __read_mostly once_; \