<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/pci/msi.c, branch v3.4.2</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>x86/PCI: Expand the x86_msi_ops to have a restore MSIs.</title>
<updated>2012-01-06T22:02:26+00:00</updated>
<author>
<name>Konrad Rzeszutek Wilk</name>
<email>konrad.wilk@oracle.com</email>
</author>
<published>2011-12-16T22:38:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=76ccc297018d25d55b789bbd508861ef1e2cdb0c'/>
<id>76ccc297018d25d55b789bbd508861ef1e2cdb0c</id>
<content type='text'>
The MSI restore function will become a function pointer in an
x86_msi_ops struct. It defaults to the implementation in the
io_apic.c and msi.c. We piggyback on the indirection mechanism
introduced by "x86: Introduce x86_msi_ops".

Cc: x86@kernel.org
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: linux-pci@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The MSI restore function will become a function pointer in an
x86_msi_ops struct. It defaults to the implementation in the
io_apic.c and msi.c. We piggyback on the indirection mechanism
introduced by "x86: Introduce x86_msi_ops".

Cc: x86@kernel.org
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: linux-pci@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: msi: fix imbalanced refcount of msi irq sysfs objects</title>
<updated>2012-01-06T20:11:17+00:00</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2012-01-03T15:29:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=424eb391596a38ddf422bee1617e4b9dea60126f'/>
<id>424eb391596a38ddf422bee1617e4b9dea60126f</id>
<content type='text'>
This warning was recently reported to me:

------------[ cut here ]------------
WARNING: at lib/kobject.c:595 kobject_put+0x50/0x60()
Hardware name: VMware Virtual Platform
kobject: '(null)' (ffff880027b0df40): is not initialized, yet kobject_put() is
being called.
Modules linked in: vmxnet3(+) vmw_balloon i2c_piix4 i2c_core shpchp raid10
vmw_pvscsi
Pid: 630, comm: modprobe Tainted: G        W   3.1.6-1.fc16.x86_64 #1
Call Trace:
 [&lt;ffffffff8106b73f&gt;] warn_slowpath_common+0x7f/0xc0
 [&lt;ffffffff8106b836&gt;] warn_slowpath_fmt+0x46/0x50
 [&lt;ffffffff810da293&gt;] ? free_desc+0x63/0x70
 [&lt;ffffffff812a9aa0&gt;] kobject_put+0x50/0x60
 [&lt;ffffffff812e4c25&gt;] free_msi_irqs+0xd5/0x120
 [&lt;ffffffff812e524c&gt;] pci_enable_msi_block+0x24c/0x2c0
 [&lt;ffffffffa017c273&gt;] vmxnet3_alloc_intr_resources+0x173/0x240 [vmxnet3]
 [&lt;ffffffffa0182e94&gt;] vmxnet3_probe_device+0x615/0x834 [vmxnet3]
 [&lt;ffffffff812d141c&gt;] local_pci_probe+0x5c/0xd0
 [&lt;ffffffff812d2cb9&gt;] pci_device_probe+0x109/0x130
 [&lt;ffffffff8138ba2c&gt;] driver_probe_device+0x9c/0x2b0
 [&lt;ffffffff8138bceb&gt;] __driver_attach+0xab/0xb0
 [&lt;ffffffff8138bc40&gt;] ? driver_probe_device+0x2b0/0x2b0
 [&lt;ffffffff8138bc40&gt;] ? driver_probe_device+0x2b0/0x2b0
 [&lt;ffffffff8138a8ac&gt;] bus_for_each_dev+0x5c/0x90
 [&lt;ffffffff8138b63e&gt;] driver_attach+0x1e/0x20
 [&lt;ffffffff8138b240&gt;] bus_add_driver+0x1b0/0x2a0
 [&lt;ffffffffa0188000&gt;] ? 0xffffffffa0187fff
 [&lt;ffffffff8138c246&gt;] driver_register+0x76/0x140
 [&lt;ffffffff815ca414&gt;] ? printk+0x51/0x53
 [&lt;ffffffffa0188000&gt;] ? 0xffffffffa0187fff
 [&lt;ffffffff812d2996&gt;] __pci_register_driver+0x56/0xd0
 [&lt;ffffffffa018803a&gt;] vmxnet3_init_module+0x3a/0x3c [vmxnet3]
 [&lt;ffffffff81002042&gt;] do_one_initcall+0x42/0x180
 [&lt;ffffffff810aad71&gt;] sys_init_module+0x91/0x200
 [&lt;ffffffff815dccc2&gt;] system_call_fastpath+0x16/0x1b
---[ end trace 44593438a59a9558 ]---
Using INTx interrupt, #Rx queues: 1.

It occurs when populate_msi_sysfs fails, which in turn causes free_msi_irqs to
be called.  Because populate_msi_sysfs fails, we never registered any of the
msi irq sysfs objects, but free_msi_irqs still calls kobject_del and kobject_put
on each of them, which gets flagged in the above stack trace.

The fix is pretty straightforward.  We can key of the parent pointer in the
kobject.  It is only set if the kobject_init_and_add succededs in
populate_msi_sysfs.  If anything fails there, each kobject has its parent reset
to NULL

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
CC: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
CC: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
CC: linux-pci@vger.kernel.org
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This warning was recently reported to me:

------------[ cut here ]------------
WARNING: at lib/kobject.c:595 kobject_put+0x50/0x60()
Hardware name: VMware Virtual Platform
kobject: '(null)' (ffff880027b0df40): is not initialized, yet kobject_put() is
being called.
Modules linked in: vmxnet3(+) vmw_balloon i2c_piix4 i2c_core shpchp raid10
vmw_pvscsi
Pid: 630, comm: modprobe Tainted: G        W   3.1.6-1.fc16.x86_64 #1
Call Trace:
 [&lt;ffffffff8106b73f&gt;] warn_slowpath_common+0x7f/0xc0
 [&lt;ffffffff8106b836&gt;] warn_slowpath_fmt+0x46/0x50
 [&lt;ffffffff810da293&gt;] ? free_desc+0x63/0x70
 [&lt;ffffffff812a9aa0&gt;] kobject_put+0x50/0x60
 [&lt;ffffffff812e4c25&gt;] free_msi_irqs+0xd5/0x120
 [&lt;ffffffff812e524c&gt;] pci_enable_msi_block+0x24c/0x2c0
 [&lt;ffffffffa017c273&gt;] vmxnet3_alloc_intr_resources+0x173/0x240 [vmxnet3]
 [&lt;ffffffffa0182e94&gt;] vmxnet3_probe_device+0x615/0x834 [vmxnet3]
 [&lt;ffffffff812d141c&gt;] local_pci_probe+0x5c/0xd0
 [&lt;ffffffff812d2cb9&gt;] pci_device_probe+0x109/0x130
 [&lt;ffffffff8138ba2c&gt;] driver_probe_device+0x9c/0x2b0
 [&lt;ffffffff8138bceb&gt;] __driver_attach+0xab/0xb0
 [&lt;ffffffff8138bc40&gt;] ? driver_probe_device+0x2b0/0x2b0
 [&lt;ffffffff8138bc40&gt;] ? driver_probe_device+0x2b0/0x2b0
 [&lt;ffffffff8138a8ac&gt;] bus_for_each_dev+0x5c/0x90
 [&lt;ffffffff8138b63e&gt;] driver_attach+0x1e/0x20
 [&lt;ffffffff8138b240&gt;] bus_add_driver+0x1b0/0x2a0
 [&lt;ffffffffa0188000&gt;] ? 0xffffffffa0187fff
 [&lt;ffffffff8138c246&gt;] driver_register+0x76/0x140
 [&lt;ffffffff815ca414&gt;] ? printk+0x51/0x53
 [&lt;ffffffffa0188000&gt;] ? 0xffffffffa0187fff
 [&lt;ffffffff812d2996&gt;] __pci_register_driver+0x56/0xd0
 [&lt;ffffffffa018803a&gt;] vmxnet3_init_module+0x3a/0x3c [vmxnet3]
 [&lt;ffffffff81002042&gt;] do_one_initcall+0x42/0x180
 [&lt;ffffffff810aad71&gt;] sys_init_module+0x91/0x200
 [&lt;ffffffff815dccc2&gt;] system_call_fastpath+0x16/0x1b
---[ end trace 44593438a59a9558 ]---
Using INTx interrupt, #Rx queues: 1.

It occurs when populate_msi_sysfs fails, which in turn causes free_msi_irqs to
be called.  Because populate_msi_sysfs fails, we never registered any of the
msi irq sysfs objects, but free_msi_irqs still calls kobject_del and kobject_put
on each of them, which gets flagged in the above stack trace.

The fix is pretty straightforward.  We can key of the parent pointer in the
kobject.  It is only set if the kobject_init_and_add succededs in
populate_msi_sysfs.  If anything fails there, each kobject has its parent reset
to NULL

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
CC: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
CC: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
CC: linux-pci@vger.kernel.org
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: msi: Disable msi interrupts when we initialize a pci device</title>
<updated>2012-01-06T20:10:29+00:00</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2011-10-17T18:46:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d5dea7d95c48d7bc951cee4910a7fd9c0cd26fb0'/>
<id>d5dea7d95c48d7bc951cee4910a7fd9c0cd26fb0</id>
<content type='text'>
I traced a nasty kexec on panic boot failure to the fact that we had
screaming msi interrupts and we were not disabling the msi messages at
kernel startup.  The booting kernel had not enabled those interupts so
was not prepared to handle them.

I can see no reason why we would ever want to leave the msi interrupts
enabled at boot if something else has enabled those interrupts.  The pci
spec specifies that msi interrupts should be off by default.  Drivers
are expected to enable the msi interrupts if they want to use them.  Our
interrupt handling code reprograms the interrupt handlers at boot and
will not be be able to do anything useful with an unexpected interrupt.

This patch applies cleanly all of the way back to 2.6.32 where I noticed
the problem.

Cc: stable@kernel.org
Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I traced a nasty kexec on panic boot failure to the fact that we had
screaming msi interrupts and we were not disabling the msi messages at
kernel startup.  The booting kernel had not enabled those interupts so
was not prepared to handle them.

I can see no reason why we would ever want to leave the msi interrupts
enabled at boot if something else has enabled those interrupts.  The pci
spec specifies that msi interrupts should be off by default.  Drivers
are expected to enable the msi interrupts if they want to use them.  Our
interrupt handling code reprograms the interrupt handlers at boot and
will not be be able to do anything useful with an unexpected interrupt.

This patch applies cleanly all of the way back to 2.6.32 where I noticed
the problem.

Cc: stable@kernel.org
Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>PCI/sysfs: add per pci device msi[x] irq listing (v5)</title>
<updated>2012-01-06T20:10:25+00:00</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2011-10-06T18:08:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=da8d1c8ba4dcb16d60be54b233deca9a7cac98dc'/>
<id>da8d1c8ba4dcb16d60be54b233deca9a7cac98dc</id>
<content type='text'>
This patch adds a per-pci-device subdirectory in sysfs called:
/sys/bus/pci/devices/&lt;device&gt;/msi_irqs

This sub-directory exports the set of msi vectors allocated by a given
pci device, by creating a numbered sub-directory for each vector beneath
msi_irqs.  For each vector various attributes can be exported.
Currently the only attribute is called mode, which tracks the
operational mode of that vector (msi vs. msix)

Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds a per-pci-device subdirectory in sysfs called:
/sys/bus/pci/devices/&lt;device&gt;/msi_irqs

This sub-directory exports the set of msi vectors allocated by a given
pci device, by creating a numbered sub-directory for each vector beneath
msi_irqs.  For each vector various attributes can be exported.
Currently the only attribute is called mode, which tracks the
operational mode of that vector (msi vs. msix)

Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pci: Fix files needing export.h for EXPORT_SYMBOL/THIS_MODULE</title>
<updated>2011-10-31T23:31:22+00:00</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-05-27T13:37:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=363c75db1d7bbda0aa90e680565f2673bab92ee4'/>
<id>363c75db1d7bbda0aa90e680565f2673bab92ee4</id>
<content type='text'>
They were implicitly getting it from device.h --&gt; module.h but
we want to clean that up.  So add the minimal header for these
macros.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They were implicitly getting it from device.h --&gt; module.h but
we want to clean that up.  So add the minimal header for these
macros.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drivers: Final irq namespace conversion</title>
<updated>2011-03-29T12:48:19+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2011-03-28T15:49:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=dced35aeb0367dda2636ee9ee914bda14510dcc9'/>
<id>dced35aeb0367dda2636ee9ee914bda14510dcc9</id>
<content type='text'>
Scripted with coccinelle.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Scripted with coccinelle.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Add mask bit definition for MSI-X table</title>
<updated>2010-12-23T20:53:08+00:00</updated>
<author>
<name>Sheng Yang</name>
<email>sheng@linux.intel.com</email>
</author>
<published>2010-11-11T07:46:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8d805286968811223cca002134ba3d81244d5313'/>
<id>8d805286968811223cca002134ba3d81244d5313</id>
<content type='text'>
Then we can use it instead of magic number 1.

Reviewed-by: Hidetoshi Seto &lt;seto.hidetoshi@jp.fujitsu.com&gt;
Cc: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Signed-off-by: Sheng Yang &lt;sheng@linux.intel.com&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Then we can use it instead of magic number 1.

Reviewed-by: Hidetoshi Seto &lt;seto.hidetoshi@jp.fujitsu.com&gt;
Cc: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Signed-off-by: Sheng Yang &lt;sheng@linux.intel.com&gt;
Signed-off-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>msi: Introduce default_[teardown|setup]_msi_irqs with fallback.</title>
<updated>2010-10-18T14:49:33+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2010-10-06T20:05:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1525bf0d8f059a38c6e79353583854e1981b2e67'/>
<id>1525bf0d8f059a38c6e79353583854e1981b2e67</id>
<content type='text'>
Introduce an override for the arch_[teardown|setup]_msi_irqs
that can be utilized to fallback to the default arch_* code.

If a platform wants to utilize the code paths defined
in driver/pci/msi.c it has to define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
or HAVE_DEFAULT_MSI_SETUP_IRQS. Otherwise the old mechanism
of over-ridding the arch_* works fine.

Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Cc: x86@kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce an override for the arch_[teardown|setup]_msi_irqs
that can be utilized to fallback to the default arch_* code.

If a platform wants to utilize the code paths defined
in driver/pci/msi.c it has to define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
or HAVE_DEFAULT_MSI_SETUP_IRQS. Otherwise the old mechanism
of over-ridding the arch_* works fine.

Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Cc: x86@kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>pci: Cleanup the irq_desc mess in msi</title>
<updated>2010-10-12T14:53:34+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2010-09-28T17:09:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=39431acb1a4c464e62471cb3058b8ffffb9244db'/>
<id>39431acb1a4c464e62471cb3058b8ffffb9244db</id>
<content type='text'>
Handing down irq_desc to msi just so that msi can access
irq_desc.irq_data.msi_desc is a pretty stupid idea. The calling code
can hand down a pointer to msi_desc so msi code does not need to know
about the irq descriptor at all.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Handing down irq_desc to msi just so that msi can access
irq_desc.irq_data.msi_desc is a pretty stupid idea. The calling code
can hand down a pointer to msi_desc so msi code does not need to know
about the irq descriptor at all.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pci: Convert msi to new irq_chip functions</title>
<updated>2010-10-12T14:53:34+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2010-09-28T14:46:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1c9db52534a2c0e9776788cd34ccc193289fc18c'/>
<id>1c9db52534a2c0e9776788cd34ccc193289fc18c</id>
<content type='text'>
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: Russell King &lt;linux@arm.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: Russell King &lt;linux@arm.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
