linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	greg@kroah.com, linux-kernel@vger.kernel.org,
	Alan Cox <alan@redhat.com>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Martin Mares <mj@ucw.cz>
Subject: Re: PCI Express support for 2.4 kernel
Date: Tue, 16 Dec 2003 23:59:51 +0200	[thread overview]
Message-ID: <3FDF8057.7050901@intel.com> (raw)
In-Reply-To: <3FDF3C6C.9030609@pobox.com>

Jeff Garzik wrote:

> Vladimir Kondratiev wrote:
>
> Definitely looks a lot better, thanks.
>
> Still a few problems to consider...
>
>
>> diff -dur linux-2.4.23/arch/i386/config.in 
>> linux-2.4.23-pciexp/arch/i386/config.in
>> --- linux-2.4.23/arch/i386/config.in    2003-11-28 20:26:19.000000000 
>> +0200
>> +++ linux-2.4.23-pciexp/arch/i386/config.in    2003-12-16 
>> 11:18:46.000000000 +0200
>> @@ -292,6 +292,15 @@
>>        fi
>>        if [ "$CONFIG_PCI_GODIRECT" = "y" -o "$CONFIG_PCI_GOANY" = "y" 
>> ]; then
>>           define_bool CONFIG_PCI_DIRECT y
>> +         bool 'PCI-Express support' CONFIG_PCI_EXPRESS
>> +         if [ "$CONFIG_PCI_EXPRESS" = "y" ]; then
>> +            bool 'Enable PCI-E custom base address' 
>> CONFIG_PCIEXP_USE_CUSTOM_BASE
>> +            if [ "$CONFIG_PCIEXP_USE_CUSTOM_BASE" = "y" ]; then
>> +               hex 'PCI-Express base address' 
>> CONFIG_PCI_EXPRESS_BASE 0xe
>> +            else
>> +               define_hex CONFIG_PCI_EXPRESS_BASE 0xe
>> +            fi
>> +         fi
>>        fi
>>     fi
>>     bool 'ISA bus support' CONFIG_ISA
>
>
> This is OK for development...   But until (if ever?) there is a 
> standard way to detect PCI Express, I think it is better to maintain a 
> list of chipsets that support PCI Express.
>
> Users are really going to hate this, once the first chipset comes out 
> that uses a non-standard address.
>
Sure, it need to be replaced, or at least complemented, with real auto 
detection. If I only could provide this list...

>> +/**
>> + * I don't know how to detect it properly.
>> + * assume it is PCI-E, sanity_check will
>> + * stop me if it is not.
>> + * + * Also, this function supposed to set rrbar_phys
>> + */
>> +static int is_pcie_platform(void)
>> +{ return 1; }
>> +
>> +/**
>> + * Initializes PCI Express method for config space access.
>> + * + * There is no standard method to recognize presence of PCI 
>> Express,
>> + * thus we will assume it is PCI-E, and rely on sanity check to
>> + * deassert PCI-E presense. If PCI-E not present,
>> + * there is no physical RAM on RRBAR address, and we should read
>> + * something like 0xff.
>> + * + * @return 1 if OK, 0 if error
>> + */
>
>
> Well, I agree with the comment, but that's not what the code does.
>
> Where is your check for 0xff?
>
sanity_check do it for me.

> Further, is_pcie_platform() unconditionally returns 1... and is only 
> used once, in PCI-Ex-specific code.
>
See above, it is placeholder for real auto detection routine.

>
> Longer term, we want to provide some way to have the read/write 
> routines generic, but support arch-specific mapping methods, I would 
> think...
>
> 64-bit arches probably wouldn't need a spinlock at all for each 
> access, I bet, since it's just a single MMIO read or write.
>
Yes, separation into generic and platform specific part seems nice, but 
besides memory mapping and locking, all you have is
very simple arithmetic. Does it worth the work for separation?

For 64-bit world, agree, it could and should be done uniform.

>> +    switch (len) {
>> +    case 2:
>> +        if (reg & 1)
>> +            return -EINVAL;
>> +        break;
>> +    case 4:
>> +        if (reg & 3)
>> +            return -EINVAL;
>> +        break;
>> +    }
>
>
> I don't see that read and write should ever return an error.
>
> The above EINVAL conditions are a BUG().
>
Indeed, it may be better to BUG() here. I did not paid attention. By the 
way, for other access methods alignment is simply not verified. 
Probable, it is ensured by some other way and I can just remove this test?

>>
>> +    /* dummy read to flush PCI write */
>> +    readb(addr);
>
>
> This is going to choke some hardware, I guarantee.
>
> You always want to make sure your flush is of the same size at the 
> write.  Reading a byte from an address that the hardware defines as 
> "32-bit writes only" can get ugly real quick ;-)
>
Good point. s/readb(addr)/readl(addr & ~3)/

> Something I missed in the previous emails comments:
>
> The above seems wrong, to blindly assume PCI-Ex means PCI config space 
> will always be 4k.  What about downstream PCI bridges, and ancient 
> devices with only 256 bytes of config registers?
>
> It really seems like the config space size should be per-device or 
> per-bus.
>
Not this bad. For PCI devices after bridges, 4k also provided. 
Everything after 256 bytes is simply useless, but present. It reads as 0.


  parent reply	other threads:[~2003-12-16 22:00 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-14 20:00 PCI Express support for 2.4 kernel Vladimir Kondratiev
2003-12-14 20:46 ` Jeff Garzik
2003-12-15 10:01   ` Vladimir Kondratiev
2003-12-15 10:31     ` Gabriel Paubert
2003-12-15 12:44       ` Vladimir Kondratiev
2003-12-15 13:15         ` Arjan van de Ven
2003-12-15 13:58           ` Vladimir Kondratiev
2003-12-15 14:31             ` Arjan van de Ven
2003-12-15 14:44             ` Brian Gerst
2003-12-15 18:40             ` Greg KH
2003-12-15 19:23             ` Alan Cox
2003-12-15 20:00             ` Linus Torvalds
2003-12-16 10:20               ` Vladimir Kondratiev
2003-12-16 16:47                 ` Linus Torvalds
2003-12-17  6:30                   ` Vladimir Kondratiev
2003-12-17  6:46                     ` Linus Torvalds
2003-12-17  6:55                       ` Jeff Garzik
2003-12-17  7:24                         ` Vladimir Kondratiev
2003-12-17 16:17                           ` Linus Torvalds
2003-12-17  8:22                         ` Arjan van de Ven
2003-12-17 10:35                           ` Martin Mares
2003-12-17 23:06                           ` Alan Cox
2003-12-17 10:08                       ` Geert Uytterhoeven
2003-12-17 15:54                         ` Linus Torvalds
2003-12-17 16:14                           ` Geert Uytterhoeven
2003-12-17 17:44                           ` Dan Hopper
2003-12-17 18:14                             ` Vladimir Kondratiev
2003-12-17 21:44                         ` Martin Mares
2003-12-16 17:10                 ` Jeff Garzik
2003-12-16 17:48                   ` Arjan van de Ven
2003-12-16 17:55                     ` Jeff Garzik
2003-12-16 22:39                     ` Vladimir Kondratiev
2003-12-17  0:12                       ` Richard B. Johnson
2003-12-16 21:59                   ` Vladimir Kondratiev [this message]
2003-12-16 17:45                 ` Greg KH
2003-12-16 22:14                   ` Vladimir Kondratiev
2003-12-17 10:05                     ` Geert Uytterhoeven
2003-12-15 15:57       ` Vladimir Kondratiev
2003-12-15 10:42     ` Martin Mares
2003-12-15 10:07 ` Greg KH
2003-12-15 11:20   ` Vladimir Kondratiev
     [not found] <12InT-wQ-5@gated-at.bofh.it>
     [not found] ` <135Nw-5gv-3@gated-at.bofh.it>
     [not found]   ` <137wc-q1-23@gated-at.bofh.it>
2003-12-15 21:56     ` Andi Kleen
2003-12-15 22:48       ` Vladimir Kondratiev
2003-12-15 23:06         ` Andi Kleen
2003-12-15 23:14         ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2003-12-15 20:08 Nakajima, Jun
     [not found] <Pine.LNX.4.44.0312150917170.32061-100000@coffee.psychology.mcmaster.ca>
2003-12-15 15:52 ` Vladimir Kondratiev
2003-12-15 16:08   ` Kevin P. Fleming
2003-12-15 16:38     ` Vladimir Kondratiev
2003-12-15 16:55       ` Richard B. Johnson
2003-12-15 17:08         ` Tomas Szepe
2003-12-15 18:03           ` Richard B. Johnson
2003-12-15 18:15             ` Tomas Szepe
2003-12-15 18:35               ` Richard B. Johnson
2003-12-15 18:43                 ` Keith Owens
2003-12-15 18:45                 ` Tomas Szepe
2003-12-15 17:24         ` Vladimir Kondratiev
2003-12-15 17:22           ` Randy.Dunlap
2003-12-15 18:16           ` Greg KH
2003-12-15 18:20           ` Richard B. Johnson
2003-12-15 17:09   ` Keith Owens
2003-12-15 17:38     ` Tomas Szepe
2003-12-15 18:16       ` Keith Owens
2003-12-15 18:23         ` Tomas Szepe
     [not found] <12KJ6-4F2-13@gated-at.bofh.it>
     [not found] ` <12Lvu-5X5-5@gated-at.bofh.it>
     [not found]   ` <12XQ2-7Vs-9@gated-at.bofh.it>
2003-12-15 10:17     ` Andi Kleen
     [not found]     ` <12YsA-nt-1@gated-at.bofh.it>
     [not found]       ` <130kQ-3A0-13@gated-at.bofh.it>
     [not found]         ` <130Xy-4Ia-3@gated-at.bofh.it>
     [not found]           ` <131Ac-5Qy-3@gated-at.bofh.it>
     [not found]             ` <137cD-8eg-9@gated-at.bofh.it>
     [not found]               ` <13kD2-1kF-11@gated-at.bofh.it>
2003-12-16 17:44                 ` Andi Kleen
     [not found]                 ` <13r1S-3FB-11@gated-at.bofh.it>
     [not found]                   ` <13vyg-43O-7@gated-at.bofh.it>
2003-12-16 22:18                     ` Andi Kleen
     [not found]                 ` <13qIi-31G-1@gated-at.bofh.it>
     [not found]                   ` <13DvZ-2RY-9@gated-at.bofh.it>
     [not found]                     ` <13DFw-3a8-9@gated-at.bofh.it>
     [not found]                       ` <13DPq-3s4-7@gated-at.bofh.it>
     [not found]                         ` <13Fem-6iy-7@gated-at.bofh.it>
     [not found]                           ` <13SY1-35z-19@gated-at.bofh.it>
2003-12-17 23:22                             ` Andi Kleen
2003-12-17 23:38                               ` Alan Cox
     [not found] ` <12XQc-7Vs-29@gated-at.bofh.it>
     [not found]   ` <12Z5u-1tG-11@gated-at.bofh.it>
2003-12-15 14:58     ` Andi Kleen
2003-12-15 15:40       ` Vladimir Kondratiev
     [not found] <3FDCA569.5070006@pobox.com>
2003-12-15  4:47 ` Pete Zaitcev
2003-12-14 17:28 Vladimir Kondratiev
2003-12-15  7:48 ` Christoph Hellwig
2003-12-15 18:26 ` Linus Torvalds
2003-12-15 20:03   ` Jeff Garzik
2003-12-15 22:00     ` Linus Torvalds
2003-12-16  4:53       ` Jeff Garzik
2003-12-15 20:21   ` Vladimir Kondratiev
2003-12-15 20:36     ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FDF8057.7050901@intel.com \
    --to=vladimir.kondratiev@intel.com \
    --cc=alan@redhat.com \
    --cc=greg@kroah.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=mj@ucw.cz \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).