Message ID | 1484898113-24939-3-git-send-email-xyjxie@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Hi Yongji, [auto build test WARNING on pci/next] [also build test WARNING on v4.10-rc4 next-20170120] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Yongji-Xie/PCI-Ignore-requested-alignment-for-IOV-BARs/20170121-031322 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: i386-defconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): In file included from drivers/ata/ata_piix.c:88:0: drivers/ata/ata_piix.c: In function 'piix_init_sidpr': >> include/linux/pci.h:1648:44: warning: comparison between 'enum <anonymous>' and 'enum <anonymous>' [-Wenum-compare] #define pci_resource_end(dev, bar) (((bar) > PCI_ROM_RESOURCE) ? \ ^ >> include/linux/pci.h:1655:4: note: in expansion of macro 'pci_resource_end' pci_resource_end((dev), (bar)) == \ ^~~~~~~~~~~~~~~~ >> drivers/ata/ata_piix.c:1471:6: note: in expansion of macro 'pci_resource_len' pci_resource_len(pdev, PIIX_SIDPR_BAR) != PIIX_SIDPR_LEN) ^~~~~~~~~~~~~~~~ >> include/linux/pci.h:1648:44: warning: comparison between 'enum <anonymous>' and 'enum <anonymous>' [-Wenum-compare] #define pci_resource_end(dev, bar) (((bar) > PCI_ROM_RESOURCE) ? \ ^ include/linux/pci.h:1658:4: note: in expansion of macro 'pci_resource_end' (pci_resource_end((dev), (bar)) - \ ^~~~~~~~~~~~~~~~ >> drivers/ata/ata_piix.c:1471:6: note: in expansion of macro 'pci_resource_len' pci_resource_len(pdev, PIIX_SIDPR_BAR) != PIIX_SIDPR_LEN) ^~~~~~~~~~~~~~~~ vim +1648 include/linux/pci.h 1642 #define pci_root_bus_fwnode(bus) NULL 1643 #endif 1644 1645 /* these helpers provide future and backwards compatibility 1646 * for accessing popular PCI BAR info */ 1647 #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) > 1648 #define pci_resource_end(dev, bar) (((bar) > PCI_ROM_RESOURCE) ? \ 1649 (dev)->resource[(bar)].end : \ 1650 ((dev)->resource[(bar)].end - \ 1651 (dev)->res_addsize[(bar)])) 1652 #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) 1653 #define pci_resource_len(dev,bar) \ 1654 ((pci_resource_start((dev), (bar)) == 0 && \ > 1655 pci_resource_end((dev), (bar)) == \ 1656 pci_resource_start((dev), (bar))) ? 0 : \ 1657 \ 1658 (pci_resource_end((dev), (bar)) - \ --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Yongji, [auto build test WARNING on pci/next] [also build test WARNING on v4.10-rc4 next-20170120] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Yongji-Xie/PCI-Ignore-requested-alignment-for-IOV-BARs/20170121-031322 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: x86_64-kexec (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from drivers/ata/sata_sis.c:35:0: drivers/ata/sata_sis.c: In function 'sis_init_one': include/linux/pci.h:1648:44: warning: comparison between 'enum <anonymous>' and 'enum <anonymous>' [-Wenum-compare] #define pci_resource_end(dev, bar) (((bar) > PCI_ROM_RESOURCE) ? \ ^ include/linux/pci.h:1655:4: note: in expansion of macro 'pci_resource_end' pci_resource_end((dev), (bar)) == \ ^~~~~~~~~~~~~~~~ >> drivers/ata/sata_sis.c:223:8: note: in expansion of macro 'pci_resource_len' (pci_resource_len(pdev, SIS_SCR_PCI_BAR) < 128))) { ^~~~~~~~~~~~~~~~ include/linux/pci.h:1648:44: warning: comparison between 'enum <anonymous>' and 'enum <anonymous>' [-Wenum-compare] #define pci_resource_end(dev, bar) (((bar) > PCI_ROM_RESOURCE) ? \ ^ include/linux/pci.h:1658:4: note: in expansion of macro 'pci_resource_end' (pci_resource_end((dev), (bar)) - \ ^~~~~~~~~~~~~~~~ >> drivers/ata/sata_sis.c:223:8: note: in expansion of macro 'pci_resource_len' (pci_resource_len(pdev, SIS_SCR_PCI_BAR) < 128))) { ^~~~~~~~~~~~~~~~ vim +/pci_resource_len +223 drivers/ata/sata_sis.c af36d7f0 drivers/scsi/sata_sis.c Jeff Garzik 2005-08-28 29 * Hardware documentation available under NDA. ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 30 * ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 31 */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 32 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 33 #include <linux/kernel.h> ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 34 #include <linux/module.h> ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 @35 #include <linux/pci.h> ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 36 #include <linux/blkdev.h> ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 37 #include <linux/delay.h> ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 38 #include <linux/interrupt.h> a9524a76 drivers/scsi/sata_sis.c Jeff Garzik 2005-10-30 39 #include <linux/device.h> ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 40 #include <scsi/scsi_host.h> ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 41 #include <linux/libata.h> 4bb64fb9 drivers/ata/sata_sis.c Alan Cox 2007-02-16 42 #include "sis.h" ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 43 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 44 #define DRV_NAME "sata_sis" 2a3103ce drivers/ata/sata_sis.c Jeff Garzik 2007-08-31 45 #define DRV_VERSION "1.0" ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 46 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 47 enum { ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 48 sis_180 = 0, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 49 SIS_SCR_PCI_BAR = 5, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 50 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 51 /* PCI configuration registers */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 52 SIS_GENCTL = 0x54, /* IDE General Control register */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 53 SIS_SCR_BASE = 0xc0, /* sata0 phy SCR registers */ f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 54 SIS180_SATA1_OFS = 0x10, /* offset from sata0->sata1 phy regs */ f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 55 SIS182_SATA1_OFS = 0x20, /* offset from sata0->sata1 phy regs */ f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 56 SIS_PMR = 0x90, /* port mapping register */ f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 57 SIS_PMR_COMBINED = 0x30, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 58 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 59 /* random bits */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 60 SIS_FLAG_CFGSCR = (1 << 30), /* host flag: SCRs via PCI cfg */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 61 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 62 GENCTL_IOMAPPED_SCR = (1 << 26), /* if set, SCRs are in IO space */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 63 }; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 64 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 65 static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 66 static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 67 static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 68 3b7d697d drivers/scsi/sata_sis.c Jeff Garzik 2005-11-10 69 static const struct pci_device_id sis_pci_tbl[] = { 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 70 { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 71 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 72 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 73 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ a3cabb27 drivers/ata/sata_sis.c Uwe Koziolek 2007-06-14 74 { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */ a3cabb27 drivers/ata/sata_sis.c Uwe Koziolek 2007-06-14 75 { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */ 2d2744fc drivers/ata/sata_sis.c Jeff Garzik 2006-09-28 76 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 77 { } /* terminate list */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 78 }; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 79 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 80 static struct pci_driver sis_pci_driver = { ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 81 .name = DRV_NAME, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 82 .id_table = sis_pci_tbl, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 83 .probe = sis_init_one, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 84 .remove = ata_pci_remove_one, 58eb8cd5 drivers/ata/sata_sis.c Bartlomiej Zolnierkiewicz 2014-05-07 85 #ifdef CONFIG_PM_SLEEP 55c82a6c drivers/ata/sata_sis.c Alan 2014-01-01 86 .suspend = ata_pci_device_suspend, 55c82a6c drivers/ata/sata_sis.c Alan 2014-01-01 87 .resume = ata_pci_device_resume, 55c82a6c drivers/ata/sata_sis.c Alan 2014-01-01 88 #endif ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 89 }; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 90 193515d5 drivers/scsi/sata_sis.c Jeff Garzik 2005-11-07 91 static struct scsi_host_template sis_sht = { 68d1d07b drivers/ata/sata_sis.c Tejun Heo 2008-03-25 92 ATA_BMDMA_SHT(DRV_NAME), ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 93 }; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 94 029cfd6b drivers/ata/sata_sis.c Tejun Heo 2008-03-25 95 static struct ata_port_operations sis_ops = { 029cfd6b drivers/ata/sata_sis.c Tejun Heo 2008-03-25 96 .inherits = &ata_bmdma_port_ops, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 97 .scr_read = sis_scr_read, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 98 .scr_write = sis_scr_write, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 99 }; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 100 1626aeb8 drivers/ata/sata_sis.c Tejun Heo 2007-05-04 101 static const struct ata_port_info sis_port_info = { 9cbe056f drivers/ata/sata_sis.c Sergei Shtylyov 2011-02-04 102 .flags = ATA_FLAG_SATA, 14bdef98 drivers/ata/sata_sis.c Erik Inge Bolsø 2009-03-14 103 .pio_mask = ATA_PIO4, 14bdef98 drivers/ata/sata_sis.c Erik Inge Bolsø 2009-03-14 104 .mwdma_mask = ATA_MWDMA2, bf6263a8 drivers/ata/sata_sis.c Jeff Garzik 2007-07-09 105 .udma_mask = ATA_UDMA6, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 106 .port_ops = &sis_ops, ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 107 }; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 108 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 109 MODULE_AUTHOR("Uwe Koziolek"); 142924cf drivers/ata/sata_sis.c Chris Dunlop 2011-10-24 110 MODULE_DESCRIPTION("low-level driver for Silicon Integrated Systems SATA controller"); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 111 MODULE_LICENSE("GPL"); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 112 MODULE_DEVICE_TABLE(pci, sis_pci_tbl); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 113 MODULE_VERSION(DRV_VERSION); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 114 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 115 static unsigned int get_scr_cfg_addr(struct ata_link *link, unsigned int sc_reg) ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 116 { 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 117 struct ata_port *ap = link->ap; 9b14dec5 drivers/ata/sata_sis.c Alan Cox 2007-01-08 118 struct pci_dev *pdev = to_pci_dev(ap->host->dev); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 119 unsigned int addr = SIS_SCR_BASE + (4 * sc_reg); 9b14dec5 drivers/ata/sata_sis.c Alan Cox 2007-01-08 120 u8 pmr; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 121 9b14dec5 drivers/ata/sata_sis.c Alan Cox 2007-01-08 122 if (ap->port_no) { 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 123 switch (pdev->device) { 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 124 case 0x0180: 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 125 case 0x0181: 9b14dec5 drivers/ata/sata_sis.c Alan Cox 2007-01-08 126 pci_read_config_byte(pdev, SIS_PMR, &pmr); 9b14dec5 drivers/ata/sata_sis.c Alan Cox 2007-01-08 127 if ((pmr & SIS_PMR_COMBINED) == 0) f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 128 addr += SIS180_SATA1_OFS; 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 129 break; 8add7885 drivers/scsi/sata_sis.c Jeff Garzik 2005-09-08 130 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 131 case 0x0182: 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 132 case 0x0183: 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 133 case 0x1182: 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 134 addr += SIS182_SATA1_OFS; 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 135 break; 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 136 } 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 137 } 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 138 if (link->pmp) 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 139 addr += 0x10; 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 140 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 141 return addr; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 142 } ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 143 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 144 static u32 sis_scr_cfg_read(struct ata_link *link, 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 145 unsigned int sc_reg, u32 *val) ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 146 { 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 147 struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 148 unsigned int cfg_addr = get_scr_cfg_addr(link, sc_reg); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 149 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 150 if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */ 8e5443a0 drivers/ata/sata_sis.c Tejun Heo 2008-04-24 151 return -EINVAL; f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 152 aaa092a1 drivers/ata/sata_sis.c Tejun Heo 2007-10-18 153 pci_read_config_dword(pdev, cfg_addr, val); aaa092a1 drivers/ata/sata_sis.c Tejun Heo 2007-10-18 154 return 0; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 155 } ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 156 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 157 static int sis_scr_cfg_write(struct ata_link *link, 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 158 unsigned int sc_reg, u32 val) ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 159 { 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 160 struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 161 unsigned int cfg_addr = get_scr_cfg_addr(link, sc_reg); f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 162 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 163 pci_write_config_dword(pdev, cfg_addr, val); 8e5443a0 drivers/ata/sata_sis.c Tejun Heo 2008-04-24 164 return 0; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 165 } ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 166 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 167 static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 168 { 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 169 struct ata_port *ap = link->ap; 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 170 void __iomem *base = ap->ioaddr.scr_addr + link->pmp * 0x10; f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 171 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 172 if (sc_reg > SCR_CONTROL) da3dbb17 drivers/ata/sata_sis.c Tejun Heo 2007-07-16 173 return -EINVAL; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 174 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 175 if (ap->flags & SIS_FLAG_CFGSCR) 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 176 return sis_scr_cfg_read(link, sc_reg, val); f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 177 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 178 *val = ioread32(base + sc_reg * 4); da3dbb17 drivers/ata/sata_sis.c Tejun Heo 2007-07-16 179 return 0; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 180 } ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 181 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 182 static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 183 { 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 184 struct ata_port *ap = link->ap; 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 185 void __iomem *base = ap->ioaddr.scr_addr + link->pmp * 0x10; f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 186 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 187 if (sc_reg > SCR_CONTROL) da3dbb17 drivers/ata/sata_sis.c Tejun Heo 2007-07-16 188 return -EINVAL; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 189 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 190 if (ap->flags & SIS_FLAG_CFGSCR) 82ef04fb drivers/ata/sata_sis.c Tejun Heo 2008-07-31 191 return sis_scr_cfg_write(link, sc_reg, val); 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 192 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 193 iowrite32(val, base + (sc_reg * 4)); da3dbb17 drivers/ata/sata_sis.c Tejun Heo 2007-07-16 194 return 0; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 195 } ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 196 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 197 static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 198 { 9a829ccf drivers/ata/sata_sis.c Tejun Heo 2007-04-17 199 struct ata_port_info pi = sis_port_info; ddfc87a0 drivers/ata/sata_sis.c Uwe Koziolek 2007-05-25 200 const struct ata_port_info *ppi[] = { &pi, &pi }; 9a829ccf drivers/ata/sata_sis.c Tejun Heo 2007-04-17 201 struct ata_host *host; 4adccf6f drivers/ata/sata_sis.c Uwe Koziolek 2006-11-08 202 u32 genctl, val; f2c853bc drivers/scsi/sata_sis.c Arnaud Patard 2005-09-07 203 u8 pmr; 3f3e7313 drivers/ata/sata_sis.c Uwe Koziolek 2006-12-04 204 u8 port2_start = 0x20; 72fee382 drivers/ata/sata_sis.c Tejun Heo 2009-09-01 205 int i, rc; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 206 06296a1e drivers/ata/sata_sis.c Joe Perches 2011-04-15 207 ata_print_version_once(&pdev->dev, DRV_VERSION); a9524a76 drivers/scsi/sata_sis.c Jeff Garzik 2005-10-30 208 24dc5f33 drivers/ata/sata_sis.c Tejun Heo 2007-01-20 209 rc = pcim_enable_device(pdev); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 210 if (rc) ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 211 return rc; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 212 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 213 /* check and see if the SCRs are in IO space or PCI cfg space */ ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 214 pci_read_config_dword(pdev, SIS_GENCTL, &genctl); ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 215 if ((genctl & GENCTL_IOMAPPED_SCR) == 0) cf0e812f drivers/ata/sata_sis.c Tejun Heo 2006-10-27 216 pi.flags |= SIS_FLAG_CFGSCR; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 217 ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 218 /* if hardware thinks SCRs are in IO space, but there are ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 219 * no IO resources assigned, change to PCI cfg space. ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 220 */ cf0e812f drivers/ata/sata_sis.c Tejun Heo 2006-10-27 221 if ((!(pi.flags & SIS_FLAG_CFGSCR)) && ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 222 ((pci_resource_start(pdev, SIS_SCR_PCI_BAR) == 0) || ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 @223 (pci_resource_len(pdev, SIS_SCR_PCI_BAR) < 128))) { ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 224 genctl &= ~GENCTL_IOMAPPED_SCR; ^1da177e drivers/scsi/sata_sis.c Linus Torvalds 2005-04-16 225 pci_write_config_dword(pdev, SIS_GENCTL, genctl); cf0e812f drivers/ata/sata_sis.c Tejun Heo 2006-10-27 226 pi.flags |= SIS_FLAG_CFGSCR; :::::: The code at line 223 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 :::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org> :::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 220c31e..04f2100 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5096,6 +5096,7 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) size = resource_size(r); if (size < align) { + dev->res_addsize[i] = align - size; size = align; dev_info(&dev->dev, "Rounding up size of resource #%d to %#llx.\n", diff --git a/include/linux/pci.h b/include/linux/pci.h index e2d1a12..e4099fb 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -334,6 +334,7 @@ struct pci_dev { */ unsigned int irq; struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ + resource_size_t res_addsize[PCI_ROM_RESOURCE + 1]; bool match_driver; /* Skip attaching driver */ /* These fields are used by common fixups */ @@ -1644,7 +1645,10 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, /* these helpers provide future and backwards compatibility * for accessing popular PCI BAR info */ #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) -#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) +#define pci_resource_end(dev, bar) (((bar) > PCI_ROM_RESOURCE) ? \ + (dev)->resource[(bar)].end : \ + ((dev)->resource[(bar)].end - \ + (dev)->res_addsize[(bar)])) #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) #define pci_resource_len(dev,bar) \ ((pci_resource_start((dev), (bar)) == 0 && \
When using resource_alignment kernel parameter, the current implement reassigns the alignment by expanding resources' size. So there exists two kinds of *size* for one PCI BAR. One is the hardware size, the other is the allocated size. Currently pci_resource_len() used by drivers return the allocated size rather than the hardware size. This may potentially break some drivers when they use the size to locate some registers whose length is related to the hardware size. Some examples as below: - misc\Hpilo.c: off = pci_resource_len(pdev, bar) - 0x2000; - net\ethernet\chelsio\cxgb4\cxgb4_uld.h: (pci_resource_len((pdev), 2) - roundup_pow_of_two((vres)->ocq.size)) - infiniband\hw\nes\Nes_hw.c: num_pds = pci_resource_len(nesdev->pcidev, BAR_1) >> PAGE_SHIFT; This modifies pci_resource_len() to be aware of the increased size. So it could return the hardware size instead. And if we need the allocated size, resource_size()(or we can introuce a new helper function) can be used to get it. Signed-off-by: Yongji Xie <xyjxie@linux.vnet.ibm.com> --- drivers/pci/pci.c | 1 + include/linux/pci.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)