Re: [PATCH] PCI: Only enable IO window if supported

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

 



On Thu, May 28, 2015 at 07:41:12AM -0500, Bjorn Helgaas wrote:
> 
> > > I'd like res->flags to reflect the capabilities of the hardware, not
> > > whether the window is currently enabled.
> > > 
> > Flag bits seem to be all taken. Could we use IORESOURCE_DISABLED for that
> > purpose, or could that cause conflicts elsewhere ?
> 
> Yes, I think IORESOURCE_DISABLED would be appropriate for any I/O windows
> below a host bridge that doesn't support I/O space.
> 
I integrated Lorenzo's patch and tried to get this working.

Problem is that the use of a resource is widely checked with "!res->flags"
throughout the code. That would have to be changed to something like
"(!res->flags || (res->flags & IORESOURCE_DISABLED))" whereever it is used.

I tried going with "!res->flags" instead, but have not been able to get it
to work realiably; it is just very difficult to distinguish if "!res->flags"
means that the resource has not yet been assigned or if it means that it is not
supported.

The correct approach, in my opinion, would be to go with IORESOURCE_DISABLED
and make the necessary changes whereever needed. Effectively this means to
replace the "!res->flags" check with something like pci_res_used() [ pick
your preferred name ] and define it as

#define pci_res_used(res) ((res)->flags && !((res)->flags & IORESOURCE_DISABLED))

Is that the right direction ?

Thanks,
Guenter
--
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