Skip to content

Commit

Permalink
removing #ifndef CONFIG_PARAVIRT code: unikraft#27
Browse files Browse the repository at this point in the history
  • Loading branch information
maruthgoyal committed Dec 11, 2020
1 parent a33a1b8 commit 258b9b8
Show file tree
Hide file tree
Showing 6 changed files with 381 additions and 533 deletions.
27 changes: 9 additions & 18 deletions plat/xen/hv_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
#include <xen/io/console.h>
#include <xen/io/protocols.h>
#include <xen/io/ring.h>
#ifndef CONFIG_PARAVIRT
#include <xen/hvm/params.h>
#endif

static struct xencons_interface *console_ring;
static uint32_t console_evtchn;
Expand All @@ -117,11 +114,6 @@ void hv_console_prepare(void)
console_ring = mfn_to_virt(HYPERVISOR_start_info->console.domU.mfn);
console_evtchn = HYPERVISOR_start_info->console.domU.evtchn;
}
#else
void hv_console_prepare(void)
{
/* NOT IMPLEMENTED YET */
}
#endif

/*
Expand Down Expand Up @@ -160,13 +152,13 @@ int hv_console_output(const char *str, unsigned int len)
if ((prod + 1 - cons) >= sizeof(console_ring->out))
break; /* not enough space for '\r' and '\n'! */

console_ring->out[MASK_XENCONS_IDX(prod++,
console_ring->out)] =
'\r';
console_ring
->out[MASK_XENCONS_IDX(prod++, console_ring->out)] =
'\r';
}

console_ring->out[MASK_XENCONS_IDX(prod++, console_ring->out)] =
str[sent];
str[sent];
sent++;
}
wmb(); /* ensure characters are written before increasing out_prod */
Expand Down Expand Up @@ -213,8 +205,8 @@ int hv_console_input(char *str, unsigned int maxlen)
UK_BUGON((prod - cons) > sizeof(console_ring->in));

while (cons != prod && maxlen > 0) {
*(str + read) = *(console_ring->in+
MASK_XENCONS_IDX(cons, console_ring->in));
*(str + read) = *(console_ring->in
+ MASK_XENCONS_IDX(cons, console_ring->in));
read++;
cons++;
maxlen--;
Expand All @@ -227,8 +219,7 @@ int hv_console_input(char *str, unsigned int maxlen)
}

static void hv_console_event(evtchn_port_t port __unused,
struct __regs *regs __unused,
void *data __unused)
struct __regs *regs __unused, void *data __unused)
{
/* NOT IMPLEMENTED YET */
}
Expand All @@ -239,8 +230,8 @@ void hv_console_init(void)

UK_ASSERT(console_ring != NULL);

uk_pr_debug("hv_console @ %p (evtchn: %"PRIu32")\n",
console_ring, console_evtchn);
uk_pr_debug("hv_console @ %p (evtchn: %" PRIu32 ")\n", console_ring,
console_evtchn);

err = bind_evtchn(console_evtchn, hv_console_event, NULL);
if (err <= 0)
Expand Down
14 changes: 6 additions & 8 deletions plat/xen/include/xen-x86/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
_vcpu->evtchn_upcall_mask = 0; \
barrier(); /* unmask then check (avoid races) */ \
if (unlikely(_vcpu->evtchn_upcall_pending)) \
ukplat_lcpu_irqs_handle_pending(); \
ukplat_lcpu_irqs_handle_pending(); \
} while (0)

#define __save_flags(x) \
Expand Down Expand Up @@ -100,14 +100,12 @@
#define irqs_disabled() \
HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].evtchn_upcall_mask

#define local_irq_save(x) __save_and_cli(x)
#define local_irq_restore(x) __restore_flags(x)
#define local_save_flags(x) __save_flags(x)
#define local_irq_disable() __cli()
#define local_irq_enable() __sti()
#define local_irq_save(x) __save_and_cli(x)
#define local_irq_restore(x) __restore_flags(x)
#define local_save_flags(x) __save_flags(x)
#define local_irq_disable() __cli()
#define local_irq_enable() __sti()

#else
#include <x86/irq.h>
#endif

#endif /* PLAT_XEN_INCLUDE_XEN_X86_IRQ_H_ */
Loading

0 comments on commit 258b9b8

Please sign in to comment.