<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/pci/switch/switchtec.c, branch v6.1.87</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.87</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.87'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-03-26T22:20:47+00:00</updated>
<entry>
<title>PCI: switchtec: Fix an error handling path in switchtec_pci_probe()</title>
<updated>2024-03-26T22:20:47+00:00</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2023-12-24T14:30:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4421c746023bd368e17558eb9512ccfa6e82712c'/>
<id>urn:sha1:4421c746023bd368e17558eb9512ccfa6e82712c</id>
<content type='text'>
[ Upstream commit dec529b0b0572b32f9eb91c882dd1f08ca657efb ]

The commit in Fixes changed the logic on how resources are released and
introduced a new switchtec_exit_pci() that need to be called explicitly in
order to undo a corresponding switchtec_init_pci().

This was done in the remove function, but not in the probe.

Fix the probe now.

Fixes: df25461119d9 ("PCI: switchtec: Fix stdev_release() crash after surprise hot remove")
Link: https://lore.kernel.org/r/01446d2ccb91a578239915812f2b7dfbeb2882af.1703428183.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: switchtec: Fix stdev_release() crash after surprise hot remove</title>
<updated>2024-02-05T20:12:58+00:00</updated>
<author>
<name>Daniel Stodden</name>
<email>dns@arista.com</email>
</author>
<published>2023-11-22T04:23:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1d83c85922647758c1f1e4806a4c5c3cf591a20a'/>
<id>urn:sha1:1d83c85922647758c1f1e4806a4c5c3cf591a20a</id>
<content type='text'>
[ Upstream commit df25461119d987b8c81d232cfe4411e91dcabe66 ]

A PCI device hot removal may occur while stdev-&gt;cdev is held open. The call
to stdev_release() then happens during close or exit, at a point way past
switchtec_pci_remove(). Otherwise the last ref would vanish with the
trailing put_device(), just before return.

At that later point in time, the devm cleanup has already removed the
stdev-&gt;mmio_mrpc mapping. Also, the stdev-&gt;pdev reference was not a counted
one. Therefore, in DMA mode, the iowrite32() in stdev_release() will cause
a fatal page fault, and the subsequent dma_free_coherent(), if reached,
would pass a stale &amp;stdev-&gt;pdev-&gt;dev pointer.

Fix by moving MRPC DMA shutdown into switchtec_pci_remove(), after
stdev_kill(). Counting the stdev-&gt;pdev ref is now optional, but may prevent
future accidents.

Reproducible via the script at
https://lore.kernel.org/r/20231113212150.96410-1-dns@arista.com

Link: https://lore.kernel.org/r/20231122042316.91208-2-dns@arista.com
Signed-off-by: Daniel Stodden &lt;dns@arista.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
Reviewed-by: Dmitry Safonov &lt;dima@arista.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: switchtec: Return -EFAULT for copy_to_user() errors</title>
<updated>2023-03-10T08:33:31+00:00</updated>
<author>
<name>Bjorn Helgaas</name>
<email>bhelgaas@google.com</email>
</author>
<published>2022-12-16T16:21:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=86c1988d269526c257b11e319bafac9e402ccb16'/>
<id>urn:sha1:86c1988d269526c257b11e319bafac9e402ccb16</id>
<content type='text'>
[ Upstream commit ddc10938e08cd7aac63d8385f7305f7889df5179 ]

switchtec_dev_read() didn't handle copy_to_user() errors correctly: it
assigned "rc = -EFAULT", but actually returned either "size", -ENXIO, or
-EBADMSG instead.

Update the failure cases to unlock mrpc_mutex and return -EFAULT directly.

Link: https://lore.kernel.org/r/20221216162126.207863-3-helgaas@kernel.org
Fixes: 080b47def5e5 ("MicroSemi Switchtec management interface driver")
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: switchtec: Prefer ida_alloc()/free() over ida_simple_get()/remove()</title>
<updated>2022-06-09T17:28:21+00:00</updated>
<author>
<name>Ke Liu</name>
<email>liuke94@huawei.com</email>
</author>
<published>2022-06-02T07:11:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=aa195350cdc8e93a890c56d0999b17c441b60b97'/>
<id>urn:sha1:aa195350cdc8e93a890c56d0999b17c441b60b97</id>
<content type='text'>
Use ida_alloc() and ida_free() instead of deprecated ida_simple_get() and
ida_simple_remove().

Link: https://lore.kernel.org/r/20220602071115.3833935-1-liuke94@huawei.com
Signed-off-by: Ke Liu &lt;liuke94@huawei.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Acked-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
</content>
</entry>
<entry>
<title>PCI/switchtec: Declare local state_names[] as static</title>
<updated>2021-11-19T18:14:02+00:00</updated>
<author>
<name>Kelvin Cao</name>
<email>kelvin.cao@microchip.com</email>
</author>
<published>2021-11-19T00:38:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b76521f6482d2a2a691e4eb1a496d55d73aea064'/>
<id>urn:sha1:b76521f6482d2a2a691e4eb1a496d55d73aea064</id>
<content type='text'>
The local state_names[] array is constant and need not be allocated and
populated each time we enter stuser_set_state().  Declare it as static.

See the link below for the discussion.

  https://lore.kernel.org/r/20211014141859.11444-1-kelvin.cao@microchip.com/

[bhelgaas: simplify commit log]
Suggested-by: Krzysztof Wilczyński &lt;kw@linux.com&gt;
Link: https://lore.kernel.org/r/20211119003803.2333-3-kelvin.cao@microchip.com
Signed-off-by: Kelvin Cao &lt;kelvin.cao@microchip.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
</content>
</entry>
<entry>
<title>PCI/switchtec: Add Gen4 automotive device IDs</title>
<updated>2021-11-19T18:13:50+00:00</updated>
<author>
<name>Kelvin Cao</name>
<email>kelvin.cao@microchip.com</email>
</author>
<published>2021-11-19T00:38:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bb17b15813eacc85ae8cb0c3901408ba051ebf91'/>
<id>urn:sha1:bb17b15813eacc85ae8cb0c3901408ba051ebf91</id>
<content type='text'>
Advertise support of the Gen4 automotive variants in module's device ID
table and add the same IDs to the list of switchtec quirks.

Link: https://lore.kernel.org/r/20211119003803.2333-2-kelvin.cao@microchip.com
Signed-off-by: Kelvin Cao &lt;kelvin.cao@microchip.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
</content>
</entry>
<entry>
<title>PCI/switchtec: Add check of event support</title>
<updated>2021-10-14T14:22:47+00:00</updated>
<author>
<name>Logan Gunthorpe</name>
<email>logang@deltatee.com</email>
</author>
<published>2021-10-14T14:18:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9f37ab0412eba537377c38b1dde1a04fbd7b5264'/>
<id>urn:sha1:9f37ab0412eba537377c38b1dde1a04fbd7b5264</id>
<content type='text'>
Not all events are supported by every gen/variant of the Switchtec
firmware. To solve this, since Gen4, a new bit in each event header
is introduced to indicate if an event is supported by the firmware.

Link: https://lore.kernel.org/r/20211014141859.11444-6-kelvin.cao@microchip.com
Signed-off-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
Signed-off-by: Kelvin Cao &lt;kelvin.cao@microchip.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI/switchtec: Replace ENOTSUPP with EOPNOTSUPP</title>
<updated>2021-10-14T14:22:47+00:00</updated>
<author>
<name>Kelvin Cao</name>
<email>kelvin.cao@microchip.com</email>
</author>
<published>2021-10-14T14:18:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=67116444cf55e1d070ee2060ffe4d1c72917ec31'/>
<id>urn:sha1:67116444cf55e1d070ee2060ffe4d1c72917ec31</id>
<content type='text'>
ENOTSUPP is not a SUSV4 error code, and the following checkpatch.pl
warning will be given for new patches which still use ENOTSUPP.

    WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP

See the link below for the discussion.

  https://lore.kernel.org/netdev/20200511165319.2251678-1-kuba@kernel.org/

Replace ENOTSUPP with EOPNOTSUPP to align with future patches which will
be using EOPNOTSUPP.

Link: https://lore.kernel.org/r/20211014141859.11444-5-kelvin.cao@microchip.com
Signed-off-by: Kelvin Cao &lt;kelvin.cao@microchip.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI/switchtec: Update the way of getting management VEP instance ID</title>
<updated>2021-10-14T14:22:47+00:00</updated>
<author>
<name>Kelvin Cao</name>
<email>kelvin.cao@microchip.com</email>
</author>
<published>2021-10-14T14:18:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1420ac218abcc1df809eedfb0f7351941b01c785'/>
<id>urn:sha1:1420ac218abcc1df809eedfb0f7351941b01c785</id>
<content type='text'>
Gen4 firmware adds DMA VEP and NVMe VEP support in VEP (virtual EP)
instance ID register in addtion to management EP, update the way of
getting management VEP instance ID.

Link: https://lore.kernel.org/r/20211014141859.11444-4-kelvin.cao@microchip.com
Signed-off-by: Kelvin Cao &lt;kelvin.cao@microchip.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI/switchtec: Fix a MRPC error status handling issue</title>
<updated>2021-10-14T14:22:47+00:00</updated>
<author>
<name>Kelvin Cao</name>
<email>kelvin.cao@microchip.com</email>
</author>
<published>2021-10-14T14:18:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=551ec658b69807318aeef5506da886cf9587b251'/>
<id>urn:sha1:551ec658b69807318aeef5506da886cf9587b251</id>
<content type='text'>
If an error is encountered when executing a MRPC command, the firmware
will set the status register to SWITCHTEC_MRPC_STATUS_ERROR and return
the error code in the return value register.

Add handling of SWITCHTEC_MRPC_STATUS_ERROR on status register when
completing a MRPC command.

Link: https://lore.kernel.org/r/20211014141859.11444-3-kelvin.cao@microchip.com
Signed-off-by: Kelvin Cao &lt;kelvin.cao@microchip.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
</feed>
