2013-03-04 16:28:58

by Thomas Petazzoni

[permalink] [raw]
Subject: Re: [PATCH 05/32] lib: devres: don't enclose pcim_*() functions in CONFIG_HAS_IOPORT

Dear Arnd Bergmann,

On Tue, 12 Feb 2013 22:36:37 +0000, Arnd Bergmann wrote:

> > I have the feeling that the problem is more complex than that. My
> > understanding is that the pcim_iomap_regions() function used by
> > drivers/ata/libata-sff.c can perfectly be used to map memory BARs, and
> > not necessarily I/O BARs. Therefore, this driver can perfectly be used
> > in an architecture where CONFIG_NO_IOPORT is selected.
>
> That is correct.
>
> > The thing is that pcim_iomap_regions() transparently allows to remap an
> > I/O BAR is such a BAR is passed as argument, or a memory BAR if such a
> > BAR is passed as argument.
> >
> > Therefore, I continue to believe that the pcim_*() functions are useful
> > even if the platform doesn't have CONFIG_HAS_IOPORT.
>
> Yes, the pcim_ functions are useful in principle, but it falls back
> to the __pci_ioport_map() for IORESOURCE_IO, and that needs to
> return an error if CONFIG_HAS_IOPORT is not set.
> I think it would be correct if you add this hunk:
>
> diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c
> index 0d83ea8..f9b6387 100644
> --- a/lib/pci_iomap.c
> +++ b/lib/pci_iomap.c
> @@ -33,7 +33,7 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
> return NULL;
> if (maxlen && len > maxlen)
> len = maxlen;
> - if (flags & IORESOURCE_IO)
> + if (IS_ENABLED(CONFIG_HAS_IOPORT) && (flags & IORESOURCE_IO))
> return __pci_ioport_map(dev, start, len);
> if (flags & IORESOURCE_MEM) {
> if (flags & IORESOURCE_CACHEABLE)
>
> in order to prevent a link error when CONFIG_HAS_IOPORT is unset.

FWIW, a patch that is doing what I was initially proposing has been
merged for 3.9, and it doesn't contain the
IS_ENABLED(CONFIG_HAS_IOPORT) test you were proposing (and which I
think was correct). See:

commit 9ed8a30f3471347c1b763bd062fa78ae80f18eae
Author: Jingoo Han <[email protected]>
Date: Wed Feb 27 17:02:42 2013 -0800

Best regards,

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com


2013-03-04 20:30:57

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 05/32] lib: devres: don't enclose pcim_*() functions in CONFIG_HAS_IOPORT

On Monday 04 March 2013, Thomas Petazzoni wrote:
> FWIW, a patch that is doing what I was initially proposing has been
> merged for 3.9, and it doesn't contain the
> IS_ENABLED(CONFIG_HAS_IOPORT) test you were proposing (and which I
> think was correct). See:
>
> commit 9ed8a30f3471347c1b763bd062fa78ae80f18eae
> Author: Jingoo Han <[email protected]>
> Date: Wed Feb 27 17:02:42 2013 -0800
>

Sigh.

I'll take it as an additional incentive to finally clean up the logic behind
CONFIG_HAS_IOPORT by introducing a CONFIG_HAS_IOPORT_MAP symbol to replace it.

Thanks for the heads up.

Arnd

2013-03-06 06:28:36

by Jingoo Han

[permalink] [raw]
Subject: Re: Re: [PATCH 05/32] lib: devres: don't enclose pcim_*() functions in CONFIG_HAS_IOPORT

On Tuesday, March 05, 2013 5:30 AM, Arnd Bergmann wrote:
>
> On Monday 04 March 2013, Thomas Petazzoni wrote:
> > FWIW, a patch that is doing what I was initially proposing has been
> > merged for 3.9, and it doesn't contain the
> > IS_ENABLED(CONFIG_HAS_IOPORT) test you were proposing (and which I
> > think was correct). See:
> >
> > commit 9ed8a30f3471347c1b763bd062fa78ae80f18eae
> > Author: Jingoo Han <[email protected]>
> > Date: Wed Feb 27 17:02:42 2013 -0800
> >
>
> Sigh.
>
> I'll take it as an additional incentive to finally clean up the logic behind
> CONFIG_HAS_IOPORT by introducing a CONFIG_HAS_IOPORT_MAP symbol to replace it.
>
> Thanks for the heads up.


Hi Thomas Petazzoni
Sorry, I did not know that you submitted the patch.
Like you, I am developing PCIe Host driver.
Also, I experienced the annoying build error related to
CONFIG_HAS_IOPORT.

Hi Arnd Bergmann,
I have just read the mailing thread.
If you resolve this situation properly, it will be very helpful.
Thank you.

Best regards,
Jingoo Han

>
> Arnd
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-03-06 08:26:09

by Thomas Petazzoni

[permalink] [raw]
Subject: Re: [PATCH 05/32] lib: devres: don't enclose pcim_*() functions in CONFIG_HAS_IOPORT

Dear Jingoo Han,

On Wed, 06 Mar 2013 06:28:08 +0000 (GMT), Jingoo Han wrote:

> Sorry, I did not know that you submitted the patch.

No problem, I'm happy to have one less patch to carry in my PCIe patch
set :)

> Like you, I am developing PCIe Host driver.

Just curious, do you already have some code? Thierry Reding and myself
have been looking at each other's PCIe host driver since a while in
order to make some consistent choices where possible. It would be good
to see your code as well.

Best regards,

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com