linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Rajat Jain <rajatxjain@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Jiri Kosina <jkosina@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Rajat Jain <rajatjain@juniper.net>,
	Guenter Roeck <groeck@juniper.net>
Subject: Re: [PATCH 0/4] Driver for talking to PLX PEX8xxx PCIe switch over I2C
Date: Wed, 1 Oct 2014 09:29:50 +0200	[thread overview]
Message-ID: <20141001072949.GA1322@katana> (raw)
In-Reply-To: <CAA93t1out+gJO29_0tn1zLJv_MUwJ458XKNT3Lo6WW+mH9XeRQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3452 bytes --]


> ===========================================================
> ...<snip>...
> 
> +0. Why have an I2C interface to a PCIe switch?
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +Other than the regular PCI express interface, most modern PCIe switches (e.g.
> +from IDT and PLX) have an I2C based secondary interface. This interface allows
> +access to all the registers of the switch. Some of these registers may not even
> +be accessible over the regular PCI interface. Also, there are certain registers
> +that can be written to, using only the I2C interface and may only be read-only
> +using the PCI interface.
> +
> +This I2C interface is often used in designs involving these switches, and can
> +be used for a variety of use cases where the switch needs to be configured
> +independent of the PCI subsystem (and likely before PCI enumeration). Some
> +examples:
> +
> +* Dividing a PCIe switch into multiple "virtual" switches. Using this feature,
> +  a switch could be connected to 2 root ports for instance, each managing its
> +  own PCI hierarchy, and the traffic from one virtual switch does not leak into
> +  another.
> +
> +* Managing Transparent / Non-transparent bridging, and changing them
> on-the-fly.
> +  There are ports that can be converted into "Non-transparent" bridge ports.
> +  Essentially this is used to create different domains (not visible to
> +  software). In a dynamic distributed system, it may be desirable to change a
> +  transparent bridge to non-transparent or vice versa, for example, to handle a
> +  failover situation.
> +
> +* Buggy hardware / Bad EEPROM configuration. There may be cases where an errata
> +  involving register writes need to be applied before enumerating over PCI.
> +  Also these switches are typically attached to an EEPROM that is supposed to
> +  initialize the switch. If that EEPROM is not present, or contains bad
> +  initialization data, this I2C interface can be used to fix that.
> +
> +* Changing switch configuration on the fly. In a multi-homed or complex
> +  distributed systemsystem, there may be a need to change the switch
> +  configuration (eg. change the upstream port, or the port or lane
> +  configuration etc) to address run time scenarios (CPU plug out etc).
> +
> 
> ...<snip>...
> ===========================================================
> 
> I am myself leaning towards drivers/pci/switch/. And am wanting to
> hear what other think.

I had a closer look and my first question is now if we really need a
kernel driver for this?

The sysfs interface is basically to PEEK/POKE registers of the switch.
How registers get accessed is part of userspace. Well, then it might
even be easier to construct the proper i2c messages in userspace, too,
and send them via i2c-dev (instead of writing to various files in
sysfs).

The Kernel API is also PEEK/POKE register. I am not an PCI expert, but I
can't see a user in this form. What I'd expect would be more like

pci_switch_set_mode(some_device, PCI_BRIDGE_MODE_TRANSPARENT);

and then a shim layer would make sure the proper driver for the switch
sends the proper commands. Again, I don't know if the decision of
setting a mode/creating virtual switches... is even desirable in kernel
space. If so, then this is probably a sub-subsystem
drivers/pci/switches, but needs way more abstraction. Otherwise,
userspace will currently do IMO.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-10-01  7:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30  4:46 [PATCH 0/4] Driver for talking to PLX PEX8xxx PCIe switch over I2C Rajat Jain
2014-09-30 20:45 ` Bjorn Helgaas
2014-09-30 21:13   ` Wolfram Sang
2014-09-30 21:35     ` Guenter Roeck
2014-09-30 22:24       ` Greg Kroah-Hartman
2014-09-30 21:37     ` Rajat Jain
2014-10-01  7:29       ` Wolfram Sang [this message]
2014-10-01 21:32         ` Rajat Jain
2014-10-02  6:34           ` Wolfram Sang
2014-10-03  1:43             ` Rajat Jain

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=20141001072949.GA1322@katana \
    --to=wsa@the-dreams.de \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@juniper.net \
    --cc=jkosina@suse.cz \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rajatjain@juniper.net \
    --cc=rajatxjain@gmail.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;
as well as URLs for NNTP newsgroup(s).