ia64/linux-2.6.18-xen.hg

view drivers/pci/iomulti.h @ 882:8dec4aa9b8b9

PCI pass through: PCIe IO space multiplexing

This is required for more than 16 HVM domain to boot from
PCIe pass through device.

Linux as dom0 exclusively assigns IO space to downstream PCI bridges
and the assignment unit of PCI bridge IO space is 4K. So the only up
to 16 PCIe device can be accessed via IO space within 64K IO ports.
PCI expansion ROM BIOS often uses IO port access to boot from the
device, so on virtualized environment, it means only up to 16 guest
domain can boot from pass-through device.

This patch allows PCIe IO space sharing of pass-through device.
- reassign IO space of PCIe devices specified by
"guestiomuldev=[<segment>:]<bus>:<dev>[,[<segment:><bus>:dev]][,...]"
to be shared.
This is implemented as Linux PCI quirk fixup.

The sharing unit is PCIe switch. Ie IO space of the end point
devices under the same switch will be shared. If there are more than
one switches, two areas of IO space will be used.

- And the driver which arbitrates the accesses to the multiplexed PCIe
IO space. Later qemu-dm will use this.

Limitation:
IO port of IO shared devices can't be accessed from dom0 Linux device
driver. But this wouldn't be a big issue because PCIe specification
discourages the use of IO space and recommends that IO space should be
used only for bootable device with ROM code. OS device driver should
work without IO space access.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 28 09:57:49 2009 +0100 (2009-05-28)
parents
children
line source
1 #ifndef PCI_IOMULTI_H
2 #define PCI_IOMULTI_H
3 /*
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 * Copyright (c) 2009 Isaku Yamahata
19 * VA Linux Systems Japan K.K.
20 *
21 */
23 struct pci_iomul_setup {
24 uint16_t segment;
25 uint8_t bus;
26 uint8_t dev;
27 uint8_t func;
28 };
30 struct pci_iomul_in {
31 uint8_t bar;
32 uint64_t offset;
34 uint8_t size;
35 uint32_t value;
36 };
38 struct pci_iomul_out {
39 uint8_t bar;
40 uint64_t offset;
42 uint8_t size;
43 uint32_t value;
44 };
46 #define PCI_IOMUL_SETUP _IOW ('P', 0, struct pci_iomul_setup)
47 #define PCI_IOMUL_DISABLE_IO _IO ('P', 1)
48 #define PCI_IOMUL_IN _IOWR('P', 2, struct pci_iomul_in)
49 #define PCI_IOMUL_OUT _IOW ('P', 3, struct pci_iomul_out)
51 #endif /* PCI_IOMULTI_H */