Skip to content
Permalink
Browse files
Fix variable shadowing that caused us to map the entire range (many
gigabytes) instead of just the amount the caller asked for.  This
resulted in a noticeable delay while attaching devices using multiple
msi-x vectors as we map and unmap the msi-x table for each vector.

ok kettenis@
  • Loading branch information
jmatthew committed Jun 25, 2020
1 parent 8077cb9 commit 57915963662663da67aa51b4f944c93678db74ce
Showing 1 changed file with 5 additions and 5 deletions.
@@ -1,4 +1,4 @@
/* $OpenBSD: vpci.c,v 1.30 2020/06/23 01:21:29 jmatthew Exp $ */
/* $OpenBSD: vpci.c,v 1.31 2020/06/25 21:43:41 jmatthew Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org>
*
@@ -554,15 +554,15 @@ vpci_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t offset,

for (i = 0; i < pbm->vp_nrange; i++) {
bus_addr_t child, paddr;
bus_size_t size;
bus_size_t rsize;

if (((pbm->vp_range[i].cspace >> 24) & 0x03) != ss)
continue;
child = pbm->vp_range[i].child_lo;
child |= ((bus_addr_t)pbm->vp_range[i].child_hi) << 32;
size = pbm->vp_range[i].size_lo;
size |= ((bus_size_t)pbm->vp_range[i].size_hi) << 32;
if (offset < child || offset >= child + size)
rsize = pbm->vp_range[i].size_lo;
rsize |= ((bus_size_t)pbm->vp_range[i].size_hi) << 32;
if (offset < child || offset >= child + rsize)
continue;

paddr = pbm->vp_range[i].phys_lo;

0 comments on commit 5791596

Please sign in to comment.