diff options
author | 2018-03-22 11:24:27 +0000 | |
---|---|---|
committer | 2018-03-22 11:24:27 +0000 | |
commit | a6d5d44b250fb28fcc7de3456280fe508b1dccc8 (patch) | |
tree | 4417fd3b861a46a36c0eea19baafed0357d9e1b2 | |
parent | ssh/xmss: fix build; ok djm@ (diff) | |
download | wireguard-openbsd-a6d5d44b250fb28fcc7de3456280fe508b1dccc8.tar.xz wireguard-openbsd-a6d5d44b250fb28fcc7de3456280fe508b1dccc8.zip |
In vldcp(4), initialize lc_rx_state to a magic value which is not
used by the hypervisor interface. This allows the driver to sync
up with the firmware's Rx channel state (DOWN/UP/RESET) upon the
first interrupt, and repair inconsistent Rx channel head/tail queue
state if necessary.
Unwedges another interrupt storm observed when starting ldomd on my
T5220 after a reboot. In case the firmware's Rx queue head and tail
are initially not equal, the normal interrupt handling path will not
operate as expected due to the interrupt storm, and we never told the
firmware to shut up.
Other cbus(4) drivers might benefit from a similar fix, but we're
too close to release for experiments, so I'm just fixing vldcp(4).
ok kettenis@ deraadt@
-rw-r--r-- | sys/arch/sparc64/dev/vldcp.c | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/include/hypervisor.h | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/sparc64/dev/vldcp.c b/sys/arch/sparc64/dev/vldcp.c index 470d1dcf908..387f4241d80 100644 --- a/sys/arch/sparc64/dev/vldcp.c +++ b/sys/arch/sparc64/dev/vldcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vldcp.c,v 1.16 2018/01/27 13:44:03 stsp Exp $ */ +/* $OpenBSD: vldcp.c,v 1.17 2018/03/22 11:24:27 stsp Exp $ */ /* * Copyright (c) 2009, 2012 Mark Kettenis * @@ -169,6 +169,7 @@ vldcp_attach(struct device *parent, struct device *self, void *aux) printf(", can't allocate rx queue\n"); goto free_txqueue; } + lc->lc_rx_state = LDC_CHANNEL_INIT; for (svc = vldc_svc; svc->vs_name != NULL; svc++) { if (strcmp(ca->ca_name, svc->vs_name) == 0) { diff --git a/sys/arch/sparc64/include/hypervisor.h b/sys/arch/sparc64/include/hypervisor.h index 39fad757502..49c15d3bfae 100644 --- a/sys/arch/sparc64/include/hypervisor.h +++ b/sys/arch/sparc64/include/hypervisor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hypervisor.h,v 1.16 2017/12/06 16:20:53 kettenis Exp $ */ +/* $OpenBSD: hypervisor.h,v 1.17 2018/03/22 11:24:27 stsp Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -268,6 +268,9 @@ int64_t hv_ldc_rx_set_qhead(uint64_t ldc_id, uint64_t head_offset); #define LDC_CHANNEL_UP 1 #define LDC_CHANNEL_RESET 2 +/* Used by drivers only, not part of the hypervisor API. */ +#define LDC_CHANNEL_INIT ((uint64_t)-1) + int64_t hv_ldc_set_map_table(uint64_t ldc_id, paddr_t base_raddr, uint64_t nentries); int64_t hv_ldc_get_map_table(uint64_t ldc_id, paddr_t *base_raddr, |