Re: [PATCH] pcie: Ensure hotplug ports have a minimum number of resources.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric W. Biederman wrote:
In general a BIOS may goof or we may hotplug in a hotplug controller.
In either case the kernel needs to reserve resources for plugging
in more devices in the future instead of creating a minimal resource
assignment.


I think we would need the same mechanism also for PCI bus number
assignment so that we can hot-plug devices containing bridges on
the leaf hot-plug slots.

(snip.)

 /**
  * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children
  * @bus: pointer to PCI bus structure to search
@@ -2672,6 +2678,10 @@ static int __init pci_setup(char *str)
 							strlen(str + 19));
 			} else if (!strncmp(str, "ecrc=", 5)) {
 				pcie_ecrc_get_policy(str + 5);
+			} else if (!strncmp(str, "hpiosize=", 9)) {
+				pci_hotplug_io_size = memparse(str + 9, &str);
+			} else if (!strncmp(str, "hpmemsize=", 10)) {
+				pci_hotplug_mem_size = memparse(str + 10, &str);
 			} else {
 				printk(KERN_ERR "PCI: Unknown option `%s'\n",
 						str);

I think it would be better if we can specify the size per hotplug
controller driver or per slot or etc.

(snip.)

+static int is_pci_hotplug_bridge(struct pci_bus *bus)
+{
+	struct pci_dev *bridge = bus->self;
+	int pos;
+
+	/* Test for a generic pci hotplug bridge */
+	pos = pci_find_capability(bridge, PCI_CAP_ID_EXP);
+	if (pos) {
+		u32 reg32;
+		u16 reg16;
+		pci_read_config_word(bridge, pos + PCI_EXP_FLAGS, &reg16);
+		if (reg16 & PCI_EXP_FLAGS_SLOT) {
+			pci_read_config_dword(bridge,
+				pos + PCI_EXP_SLTCAP, &reg32);
+			if (reg32 & PCI_EXP_SLTCAP_HPC)
+				return 1;
+		}
+	}
+	return 0;
+}
+

I think it would be better if we can move this kind of hot-plug
controller specific code into each hotplug driver code.

Thanks,
Kenji Kaneshige



--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux