Skip to content

Commit

Permalink
hw/phb4: Squash the IO bridge window
Browse files Browse the repository at this point in the history
The PCI-PCI bridge spec says that bridges that implement an IO window
should hardcode the IO base and limit registers to zero.
Unfortunately, these registers only define the upper bits of the IO
window and the low bits are assumed to be 0 for the base and 1 for the
limit address. As a result, setting both to zero can be mis-interpreted
as a 4K IO window.

This patch fixes the problem the same way PHB3 does. It sets the IO base
and limit values to 0xf000 and 0x1000 respectively which most software
interprets as a disabled window.

lspci before patch:

0000:00:00.0 PCI bridge: IBM Device 04c1 (prog-if 00 [Normal decode])
	I/O behind bridge: 00000000-00000fff

lspci after patch:

0000:00:00.0 PCI bridge: IBM Device 04c1 (prog-if 00 [Normal decode])
	I/O behind bridge: None

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
oohal authored and stewartsmith committed Apr 17, 2019
1 parent 7f22e25 commit b507209
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hw/phb4.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ static int64_t phb4_rc_read(struct phb4 *p, uint32_t offset, uint8_t sz,
oval = in_le32(p->regs + PHB_RC_CONFIG_BASE + reg);
}
}

/* Apply any post-read fixups */
switch (reg) {
case PCI_CFG_IO_BASE:
oval |= 0x01f1; /* Set IO base < limit to disable the window */
break;
}

switch (sz) {
case 1:
offset &= 3;
Expand Down

0 comments on commit b507209

Please sign in to comment.