Re: pci_bus_for_each_resource, transparent bridges and rsrc_nonstatic.c

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

 



> I'm concerned that this changes a resource that PCMCIA doesn't own,
> i.e., this struct resource actually lives in the pci_dev of an upstream
> bridge or in the host bridge data.

Oh yes, you're right -- my patch was badly broken. Brown paper-bag style.

> > +
> >  			if (res == &ioport_resource)
> >  				continue;
> 
> If you make PCMCIA smart enough to avoid these low ports, do we still
> need these &ioport_resource and &iomem_resource checks?  Having two
> mechanisms will lead to more complicated behavior and more special
> cases.

Well, it aren't only the low ports (<0x100) I'm concerned about, it's also
(and especially on pre-2008 systems) ports in higher areas
(0x100 < x < 0xffff). If we don't use _CRS, we need to be more careful to
avoid accidentally hitting wrong I/O-ports.

> > -			dev_printk(KERN_INFO, &s->cb_dev->dev,
> > -				   "pcmcia: parent PCI bridge I/O "
> > -				   "window: 0x%llx - 0x%llx\n",
> > -				   (unsigned long long)res->start,
> > -				   (unsigned long long)res->end);
> > +			dev_info(&s->cb_dev->dev, "pcmcia: parent PCI bridge "
> > +				"window: %pR\n", res);
> 
> Jesse applied a patch from me to make this %pR change just a few days ago.

Okay, I'll leave that alone then.

Thanks,
	Dominik

From: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Mar 2010 16:05:00 +0100
Subject: [PATCH] pcmcia: do not use ioports < 0x100 on x86

On x86 systems using ACPI _CRS information -- now the default for
post-2008 systems -- the PCI root bus no longer pretends to be
offering the root ioport_resource. To avoid accidentally hitting
some platform / system device, use only I/O ports >= 0x100 for
PCMCIA devices on x86.

Reported-by: Komuro <komurojun-mbn@xxxxxxxxx>
CC: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>

diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 4663b3f..dcc6021 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -810,6 +810,13 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
 	unsigned long size = end - start + 1;
 	int ret = 0;
 
+#if defined(CONFIG_X86)
+	/* on x86, avoid anything < 0x100 for it is often used for
+	 * legacy platform devices */
+	if (start < 0x100)
+		start = 0x100;
+#endif
+
 	if (end < start)
 		return -EINVAL;
 
--
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