Skip to content

Commit fb6c451

Browse files
committed
Merge branch 'pci/enumeration'
- Use pci_find_vsec_capability() instead of open-coding it (Andy Shevchenko) - Convert pci_dev_present() stub from macro to static inline to avoid 'unused variable' errors (Hans de Goede) - Convert sysfs slot attributes from default_attrs to default_groups (Greg Kroah-Hartman) - Use DWORD accesses for LTR, L1 SS to avoid BayHub OZ711LV2 erratum (Rajat Jain) - Remove unnecessary initialization of static variables (Longji Guo) * pci/enumeration: x86/PCI: Remove initialization of static variables to false PCI: Use DWORD accesses for LTR, L1 SS to avoid erratum PCI/sysfs: Use default_groups in kobj_type for slot attrs PCI: Convert pci_dev_present() stub to static inline PCI: Use pci_find_vsec_capability() when looking for TBT devices
2 parents 7498e41 + 346865f commit fb6c451

6 files changed

Lines changed: 21 additions & 24 deletions

File tree

arch/x86/pci/acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct pci_root_info {
2020
};
2121

2222
static bool pci_use_crs = true;
23-
static bool pci_ignore_seg = false;
23+
static bool pci_ignore_seg;
2424

2525
static int __init set_use_crs(const struct dmi_system_id *id)
2626
{

drivers/pci/pci.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ static void pci_save_ltr_state(struct pci_dev *dev)
15561556
{
15571557
int ltr;
15581558
struct pci_cap_saved_state *save_state;
1559-
u16 *cap;
1559+
u32 *cap;
15601560

15611561
if (!pci_is_pcie(dev))
15621562
return;
@@ -1571,25 +1571,25 @@ static void pci_save_ltr_state(struct pci_dev *dev)
15711571
return;
15721572
}
15731573

1574-
cap = (u16 *)&save_state->cap.data[0];
1575-
pci_read_config_word(dev, ltr + PCI_LTR_MAX_SNOOP_LAT, cap++);
1576-
pci_read_config_word(dev, ltr + PCI_LTR_MAX_NOSNOOP_LAT, cap++);
1574+
/* Some broken devices only support dword access to LTR */
1575+
cap = &save_state->cap.data[0];
1576+
pci_read_config_dword(dev, ltr + PCI_LTR_MAX_SNOOP_LAT, cap);
15771577
}
15781578

15791579
static void pci_restore_ltr_state(struct pci_dev *dev)
15801580
{
15811581
struct pci_cap_saved_state *save_state;
15821582
int ltr;
1583-
u16 *cap;
1583+
u32 *cap;
15841584

15851585
save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_LTR);
15861586
ltr = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_LTR);
15871587
if (!save_state || !ltr)
15881588
return;
15891589

1590-
cap = (u16 *)&save_state->cap.data[0];
1591-
pci_write_config_word(dev, ltr + PCI_LTR_MAX_SNOOP_LAT, *cap++);
1592-
pci_write_config_word(dev, ltr + PCI_LTR_MAX_NOSNOOP_LAT, *cap++);
1590+
/* Some broken devices only support dword access to LTR */
1591+
cap = &save_state->cap.data[0];
1592+
pci_write_config_dword(dev, ltr + PCI_LTR_MAX_SNOOP_LAT, *cap);
15931593
}
15941594

15951595
/**

drivers/pci/pcie/aspm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link,
503503
encode_l12_threshold(l1_2_threshold, &scale, &value);
504504
ctl1 |= t_common_mode << 8 | scale << 29 | value << 16;
505505

506+
/* Some broken devices only support dword access to L1 SS */
506507
pci_read_config_dword(parent, parent->l1ss + PCI_L1SS_CTL1, &pctl1);
507508
pci_read_config_dword(parent, parent->l1ss + PCI_L1SS_CTL2, &pctl2);
508509
pci_read_config_dword(child, child->l1ss + PCI_L1SS_CTL1, &cctl1);

drivers/pci/probe.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,20 +1579,12 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
15791579

15801580
static void set_pcie_thunderbolt(struct pci_dev *dev)
15811581
{
1582-
int vsec = 0;
1583-
u32 header;
1582+
u16 vsec;
15841583

1585-
while ((vsec = pci_find_next_ext_capability(dev, vsec,
1586-
PCI_EXT_CAP_ID_VNDR))) {
1587-
pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER, &header);
1588-
1589-
/* Is the device part of a Thunderbolt controller? */
1590-
if (dev->vendor == PCI_VENDOR_ID_INTEL &&
1591-
PCI_VNDR_HEADER_ID(header) == PCI_VSEC_ID_INTEL_TBT) {
1592-
dev->is_thunderbolt = 1;
1593-
return;
1594-
}
1595-
}
1584+
/* Is the device part of a Thunderbolt controller? */
1585+
vsec = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, PCI_VSEC_ID_INTEL_TBT);
1586+
if (vsec)
1587+
dev->is_thunderbolt = 1;
15961588
}
15971589

15981590
static void set_pcie_untrusted(struct pci_dev *dev)

drivers/pci/slot.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ static struct attribute *pci_slot_default_attrs[] = {
9696
&pci_slot_attr_cur_speed.attr,
9797
NULL,
9898
};
99+
ATTRIBUTE_GROUPS(pci_slot_default);
99100

100101
static struct kobj_type pci_slot_ktype = {
101102
.sysfs_ops = &pci_slot_sysfs_ops,
102103
.release = &pci_slot_release,
103-
.default_attrs = pci_slot_default_attrs,
104+
.default_groups = pci_slot_default_groups,
104105
};
105106

106107
static char *make_slot_name(const char *name)

include/linux/pci.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,10 @@ static inline struct pci_dev *pci_get_class(unsigned int class,
17751775
struct pci_dev *from)
17761776
{ return NULL; }
17771777

1778-
#define pci_dev_present(ids) (0)
1778+
1779+
static inline int pci_dev_present(const struct pci_device_id *ids)
1780+
{ return 0; }
1781+
17791782
#define no_pci_devices() (1)
17801783
#define pci_dev_put(dev) do { } while (0)
17811784

0 commit comments

Comments
 (0)