From: Simon Horman Subject: [rfc 2/8] qemu-xen: pass-through: Read the PCI type bit from hardware Date: Wed, 17 Jun 2009 18:07:38 +1000 Message-ID: <20090617080757.819471058@vergenet.net> References: <20090617080736.631945993@vergenet.net> Return-path: Content-Disposition: inline; filename=virtualise-pci-type-register.patch List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ian Jackson , Akio Takebe , Masaki Kanno , Dexuan Cui List-Id: xen-devel@lists.xenproject.org Preparation for multi-fucntion devices in guests. When scanning the PCI bus a guest* will only look for functions 2-7 if the multifunction bit is set. Cc: Dexuan Cui Cc: Masaki Kanno Signed-off-by: Simon Horman Index: ioemu-remote/hw/pass-through.c =================================================================== --- ioemu-remote.orig/hw/pass-through.c 2009-06-09 21:43:27.000000000 +1000 +++ ioemu-remote/hw/pass-through.c 2009-06-09 21:52:13.000000000 +1000 @@ -145,6 +145,8 @@ static uint32_t pt_msgdata_reg_init(stru struct pt_reg_info_tbl *reg, uint32_t real_offset); static uint32_t pt_msixctrl_reg_init(struct pt_dev *ptdev, struct pt_reg_info_tbl *reg, uint32_t real_offset); +static uint32_t pt_header_type_reg_init(struct pt_dev *ptdev, + struct pt_reg_info_tbl *reg, uint32_t real_offset); static uint8_t pt_reg_grp_size_init(struct pt_dev *ptdev, struct pt_reg_grp_info_tbl *grp_reg, uint32_t base_offset); static uint8_t pt_pm_size_init(struct pt_dev *ptdev, @@ -324,7 +326,7 @@ static struct pt_reg_info_tbl pt_emu_reg .init_val = 0x00, .ro_mask = 0x00, .emu_mask = 0xFF, - .init = pt_common_reg_init, + .init = pt_header_type_reg_init, .u.b.read = pt_byte_reg_read, .u.b.write = pt_byte_reg_write, .u.b.restore = pt_byte_reg_restore, @@ -2999,6 +3001,13 @@ static uint8_t pt_pcie_size_init(struct return pcie_size; } +/* read PCI_HEADER_TYPE */ +static uint32_t pt_header_type_reg_init(struct pt_dev *ptdev, + struct pt_reg_info_tbl *reg, uint32_t real_offset) +{ + return reg->init_val | 0x80; +} + /* read byte size emulate register */ static int pt_byte_reg_read(struct pt_dev *ptdev, struct pt_reg_tbl *cfg_entry, --