mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: "Durairaj, Sundarapandian" <sundarapandian.durairaj@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz,
	torvalds@osdl.org, alan@lxorguk.ukuu.org.uk, greg@kroah.com,
	Andi Kleen <ak@colin2.muc.de>,
	akpm@osdl.org, mj@ucw.cz, "Kondratiev,
	Vladimir" <vladimir.kondratiev@intel.com>,
	"Seshadri, Harinarayanan" <harinarayanan.seshadri@intel.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: [patch] PCI Express Enhanced Config Patch - 2.6.0-test11
Date: Wed, 28 Jan 2004 15:18:28 +0000	[thread overview]
Message-ID: <20040128151828.GJ11844@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <6B09584CC3D2124DB45C3B592414FA83011A336E@bgsmsx402.gar.corp.intel.com>

On Wed, Jan 28, 2004 at 03:08:01PM +0530, Durairaj, Sundarapandian wrote:
> -menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)"
> +menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA, PCI_EXPRESS)"

I think this is unnecessary.  For users, PCI Express is just another
form of PCI.

> +config PCI_EXPRESS
> +	bool "PCI_EXPRESS (EXPERIMENTAL)" 
> +	depends on EXPERIMENTAL && ACPI_BOOT

Can't we do this with select?  ie:

config PCI_EXPRESS
	bool "PCI Express (EXPERIMENTAL)"
	depends on EXPERIMENTAL
	select ACPI_BOOT

> +	help
> +	  PCI Express extends the configuration space from 256 bytes to
> +	  4k bytes. It also defines an enhanced configuration mechanism
> +	  to access the extended configuration space. With this option, 
> +	  you can specify that Linux will first attempt to access the 
> +	  PCI configuration space through enhanced config access 
> +	  mechanism (will work only on PCI Express based system)
> +	  otherwise other standard PCI access mechanism will be used.

I don't think this help is terribly helpful to the user.  How about:

	help
	  PCI Express is a new I/O architecture that is used in many
	  systems from 2004 onwards.  Even if there are no PCI Express
	  slots on your motherboard, it may use PCI Express internally.
	  If you don't know, it is safe to say Y here.

Also, I would place this entry after PCI and make it depend on PCI (since
all the PCI infrastructure is relevant to PCI Express).

> +#ifdef CONFIG_PCI_EXPRESS
> +	result = acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg);
> +	if (!result) {
> +		printk(KERN_WARNING PREFIX "MCFG not present\n");
> +		return 0;
> +	}
> +	else if (result < 0) {

CodingStyle recommends joining these last two lines together.

> +static int pci_express_conf_read(int seg, int bus,
> +		int devfn, int reg, int len, u32 *value)
> +{
> +	if (!value || (bus > 255) || (devfn > 255) || (reg > 4095)) {
> +		printk(KERN_ERR "pci_express_conf_read: "
> +					"Invalid Parameter\n");
> +  		return -EINVAL;
> +	}
> +
> +	/* Shoot misaligned transaction now */
> +	if (reg & (len-1)) {
> +		printk(KERN_ERR "pci_express_conf_read: "
> +					"misaligned transaction\n");
> +  		return -EINVAL;
> +	}

This last bit is not needed; Linux doesn't let misaligned requests get
this far.  See drivers/pci/access.c::pci_bus_read_config_##size

> @@ -90,6 +90,8 @@
>   *  %PCI_CAP_ID_CHSWP        CompactPCI HotSwap 
>   *
>   *  %PCI_CAP_ID_PCIX         PCI-X
> + *  %PCI_CAP_ID_EXP          PCI-EXP
> +

seems like a stray blank line?

>   */
>  int
>  pci_find_capability(struct pci_dev *dev, int cap)
> diff -Naur linux-2.6.0/drivers/pci/probe.c linux_pciexpress/drivers/pci/probe.c
> --- linux-2.6.0/drivers/pci/probe.c	2003-12-18 08:29:06.000000000 +0530
> +++ linux_pciexpress/drivers/pci/probe.c	2004-01-28 12:06:39.000000000 +0530
> @@ -17,6 +17,8 @@
>  
>  #define CARDBUS_LATENCY_TIMER	176	/* secondary latency timer */
>  #define CARDBUS_RESERVE_BUSNR	3
> +#define PCI_CFG_SPACE_SIZE	256
> +#define PCI_CFG_SPACE_EXP_SIZE	4096

fwiw, PCI-X 2 also has 4096 bytes of config space.  Perhaps we can just
agree that 'EXP' stands for 'Expanded', not 'Express' in this instance?
;-)

> +static int pci_cfg_space_size(struct pci_dev *dev)
> +{
> +#ifdef CONFIG_PCI_EXPRESS
> +	/* Find whether the device is PCI Express device */
> +	int is_pci_express_dev = 
> +		pci_find_capability(dev, PCI_CAP_ID_EXP);
> +	if (is_pci_express_dev)
> +		return PCI_CFG_SPACE_EXP_SIZE;
> +	else

I would drop the `else' here.

> +#endif
> +	return PCI_CFG_SPACE_SIZE; 
> +}
> +
>  /*
>   * Read the config data for a PCI device, sanity-check it
>   * and fill in the dev structure...
> @@ -515,6 +533,7 @@
>  	dev->multifunction = !!(hdr_type & 0x80);
>  	dev->vendor = l & 0xffff;
>  	dev->device = (l >> 16) & 0xffff;
> +	dev->cfg_size = pci_cfg_space_size(dev);

Good idea to cache it in the pci_dev.

> +static inline void pci_express_read(int bus, int devfn, int reg, 
> +		int len, u32 *value)
> +{
> +	unsigned long flags;
> +	spin_lock_irqsave(&pci_config_lock, flags);

You're already under the pci_lock spinlock (again see drivers/pci/access.c),
so I think this is unnecessary.


This is coming together nicely.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

  parent reply	other threads:[~2004-01-28 15:19 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-28  9:38 Durairaj, Sundarapandian
2004-01-28 14:42 ` Vladimir Kondratiev
2004-01-28 14:54   ` Christoph Hellwig
2004-01-28 15:00   ` Martin Mares
2004-01-28 15:18 ` Matthew Wilcox [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-01-30 16:58 Nakajima, Jun
2004-01-29 11:32 Durairaj, Sundarapandian
2004-01-29 15:09 ` Matthew Wilcox
2004-01-29 15:59   ` Matthew Wilcox
2004-01-29 16:05     ` Linus Torvalds
2004-01-29 16:42       ` Matthew Wilcox
2004-01-29 16:52         ` Linus Torvalds
2004-01-31 21:57         ` Eric W. Biederman
2004-02-01  4:41           ` Grant Grundler
2004-02-01  5:10           ` Matthew Wilcox
2004-02-01 11:00             ` Eric W. Biederman
2004-02-01 15:18               ` Matthew Wilcox
2004-02-01 18:28                 ` Eric W. Biederman
2004-02-01 20:11                   ` Matthew Wilcox
2004-02-01 21:35                     ` Eric W. Biederman
2004-02-01 11:10             ` Eric W. Biederman
2004-01-29 18:09       ` Greg KH
2004-01-30 16:33         ` Greg KH
2004-01-22 10:21 Durairaj, Sundarapandian
2004-01-22 10:44 ` Andrew Morton
2004-01-22 11:09 ` Martin Mares
2004-01-22 13:12 ` Andi Kleen
2004-01-22 18:21   ` Alan Cox
2004-01-22 19:40     ` Randy.Dunlap
2004-01-23 19:19       ` Pavel Machek
2004-01-23 19:31         ` Martin Mares
2004-01-23 20:08           ` Stefan Smietanowski
2004-01-22 16:40 ` Grant Grundler
2004-01-22 17:00 ` Greg KH
2004-01-07 16:44 Nakajima, Jun
2004-01-07 12:59 Durairaj, Sundarapandian
2004-01-07 14:08 ` Meelis Roos
2004-01-07 17:34 ` Vladimir Kondratiev
     [not found] <183UK-2Re-11@gated-at.bofh.it>
2003-12-29 19:12 ` Andi Kleen
2003-12-29 11:32 Durairaj, Sundarapandian
2003-12-29 11:53 ` Arjan van de Ven
2003-12-29 11:55 ` Christoph Hellwig
2003-12-29 12:51   ` Johan Sjoholm

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=20040128151828.GJ11844@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=ak@colin2.muc.de \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=greg@kroah.com \
    --cc=harinarayanan.seshadri@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=mj@ucw.cz \
    --cc=sundarapandian.durairaj@intel.com \
    --cc=torvalds@osdl.org \
    --cc=vladimir.kondratiev@intel.com \
    /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

all inboxes | Powered by JetHome®