* [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions()
@ 2024-08-22 13:47 Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 1/9] PCI: Make pcim_iounmap_region() a public function Philipp Stanner
` (9 more replies)
0 siblings, 10 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
Changes in v3:
- fpga/dfl-pci.c: remove now surplus wrapper around
pcim_iomap_region(). (Andy)
- block: mtip32xx: remove now surplus label. (Andy)
- vdpa: solidrun: Bugfix: Include forgotten place where stack UB
occurs. (Andy, Christophe)
- Some minor wording improvements in commit messages. (Me)
Changes in v2:
- Add a fix for the UB stack usage bug in vdap/solidrun. Separate
patch, put stable kernel on CC. (Christophe, Andy).
- Drop unnecessary pcim_release_region() in mtip32xx (Andy)
- Consequently, drop patch "PCI: Make pcim_release_region() a public
function", since there's no user anymore. (obsoletes the squash
requested by Damien).
- vdap/solidrun:
• make 'i' an 'unsigned short' (Andy, me)
• Use 'continue' to simplify loop (Andy)
• Remove leftover blank line
- Apply given Reviewed- / acked-bys (Andy, Damien, Bartosz)
Important things first:
This series is based on [1] and [2] which Bjorn Helgaas has currently
queued for v6.12 in the PCI tree.
This series shall remove pcim_iounmap_regions() in order to make way to
remove its brother, pcim_iomap_regions().
@Bjorn: Feel free to squash the PCI commits.
Regards,
P.
[1] https://lore.kernel.org/all/20240729093625.17561-4-pstanner@redhat.com/
[2] https://lore.kernel.org/all/20240807083018.8734-2-pstanner@redhat.com/
Philipp Stanner (9):
PCI: Make pcim_iounmap_region() a public function
fpga/dfl-pci.c: Replace deprecated PCI functions
block: mtip32xx: Replace deprecated PCI functions
gpio: Replace deprecated PCI functions
ethernet: cavium: Replace deprecated PCI functions
ethernet: stmicro: Simplify PCI devres usage
vdpa: solidrun: Fix UB bug with devres
vdap: solidrun: Replace deprecated PCI functions
PCI: Remove pcim_iounmap_regions()
.../driver-api/driver-model/devres.rst | 1 -
drivers/block/mtip32xx/mtip32xx.c | 16 +++---
drivers/fpga/dfl-pci.c | 16 ++----
drivers/gpio/gpio-merrifield.c | 14 ++---
.../net/ethernet/cavium/common/cavium_ptp.c | 10 ++--
.../ethernet/stmicro/stmmac/dwmac-loongson.c | 25 ++------
.../net/ethernet/stmicro/stmmac/stmmac_pci.c | 18 ++----
drivers/pci/devres.c | 24 +-------
drivers/vdpa/solidrun/snet_main.c | 57 ++++++++-----------
include/linux/pci.h | 2 +-
10 files changed, 61 insertions(+), 122 deletions(-)
--
2.46.0
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3 1/9] PCI: Make pcim_iounmap_region() a public function
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions Philipp Stanner
` (8 subsequent siblings)
9 siblings, 0 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
The function pcim_iounmap_regions() is problematic because it uses a
bitmask mechanism to release / iounmap multiple BARs at once. It, thus,
prevents getting rid of the problematic iomap table mechanism which was
deprecated in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(),
pcim_iomap_regions_request_all()").
Make pcim_iounmap_region() public as the successor of
pcim_iounmap_regions().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
---
drivers/pci/devres.c | 3 ++-
include/linux/pci.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index b97589e99fad..4dbba385e6b4 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -771,7 +771,7 @@ EXPORT_SYMBOL(pcim_iomap_region);
* Unmap a BAR and release its region manually. Only pass BARs that were
* previously mapped by pcim_iomap_region().
*/
-static void pcim_iounmap_region(struct pci_dev *pdev, int bar)
+void pcim_iounmap_region(struct pci_dev *pdev, int bar)
{
struct pcim_addr_devres res_searched;
@@ -782,6 +782,7 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar)
devres_release(&pdev->dev, pcim_addr_resource_release,
pcim_addr_resources_match, &res_searched);
}
+EXPORT_SYMBOL(pcim_iounmap_region);
/**
* pcim_iomap_regions - Request and iomap PCI BARs (DEPRECATED)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 01b9f1a351be..9625d8a7b655 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2297,6 +2297,7 @@ void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
int pcim_request_region(struct pci_dev *pdev, int bar, const char *name);
void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
const char *name);
+void pcim_iounmap_region(struct pci_dev *pdev, int bar);
int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name);
int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,
const char *name);
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 1/9] PCI: Make pcim_iounmap_region() a public function Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-27 3:28 ` Xu Yilun
2024-08-22 13:47 ` [PATCH v3 3/9] block: mtip32xx: " Philipp Stanner
` (7 subsequent siblings)
9 siblings, 1 reply; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the
PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
pcim_iomap_table(), pcim_iomap_regions_request_all()").
Port dfl-pci.c to the successor, pcim_iomap_region().
Consistently, replace pcim_iounmap_regions() with pcim_iounmap_region().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/fpga/dfl-pci.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 80cac3a5f976..602807d6afcc 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -39,14 +39,6 @@ struct cci_drvdata {
struct dfl_fpga_cdev *cdev; /* container device */
};
-static void __iomem *cci_pci_ioremap_bar0(struct pci_dev *pcidev)
-{
- if (pcim_iomap_regions(pcidev, BIT(0), DRV_NAME))
- return NULL;
-
- return pcim_iomap_table(pcidev)[0];
-}
-
static int cci_pci_alloc_irq(struct pci_dev *pcidev)
{
int ret, nvec = pci_msix_vec_count(pcidev);
@@ -235,9 +227,9 @@ static int find_dfls_by_default(struct pci_dev *pcidev,
u64 v;
/* start to find Device Feature List from Bar 0 */
- base = cci_pci_ioremap_bar0(pcidev);
- if (!base)
- return -ENOMEM;
+ base = pcim_iomap_region(pcidev, 0, DRV_NAME);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
/*
* PF device has FME and Ports/AFUs, and VF device only has one
@@ -296,7 +288,7 @@ static int find_dfls_by_default(struct pci_dev *pcidev,
}
/* release I/O mappings for next step enumeration */
- pcim_iounmap_regions(pcidev, BIT(0));
+ pcim_iounmap_region(pcidev, 0);
return ret;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 3/9] block: mtip32xx: Replace deprecated PCI functions
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 1/9] PCI: Make pcim_iounmap_region() a public function Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 4/9] gpio: " Philipp Stanner
` (6 subsequent siblings)
9 siblings, 0 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the
PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
pcim_iomap_table(), pcim_iomap_regions_request_all()").
In mtip32xx, these functions can easily be replaced by their respective
successors, pcim_request_region() and pcim_iomap(). Moreover, the
driver's calls to pcim_iounmap_regions() in probe()'s error path and in
remove() are not necessary. Cleanup can be performed by PCI devres
automatically.
Replace pcim_iomap_regions() and pcim_iomap_table().
Remove the calls to pcim_iounmap_regions().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/block/mtip32xx/mtip32xx.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index c6ef0546ffc9..bd40a06e4c0f 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2716,7 +2716,9 @@ static int mtip_hw_init(struct driver_data *dd)
int rv;
unsigned long timeout, timetaken;
- dd->mmio = pcim_iomap_table(dd->pdev)[MTIP_ABAR];
+ dd->mmio = pcim_iomap(dd->pdev, MTIP_ABAR, 0);
+ if (!dd->mmio)
+ return -ENOMEM;
mtip_detect_product(dd);
if (dd->product_type == MTIP_PRODUCT_UNKNOWN) {
@@ -3722,14 +3724,14 @@ static int mtip_pci_probe(struct pci_dev *pdev,
rv = pcim_enable_device(pdev);
if (rv < 0) {
dev_err(&pdev->dev, "Unable to enable device\n");
- goto iomap_err;
+ goto setmask_err;
}
/* Map BAR5 to memory. */
- rv = pcim_iomap_regions(pdev, 1 << MTIP_ABAR, MTIP_DRV_NAME);
+ rv = pcim_request_region(pdev, MTIP_ABAR, MTIP_DRV_NAME);
if (rv < 0) {
- dev_err(&pdev->dev, "Unable to map regions\n");
- goto iomap_err;
+ dev_err(&pdev->dev, "Unable to request regions\n");
+ goto setmask_err;
}
rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
@@ -3849,9 +3851,6 @@ static int mtip_pci_probe(struct pci_dev *pdev,
drop_cpu(dd->work[2].cpu_binding);
}
setmask_err:
- pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
-
-iomap_err:
kfree(dd);
pci_set_drvdata(pdev, NULL);
return rv;
@@ -3925,7 +3924,6 @@ static void mtip_pci_remove(struct pci_dev *pdev)
pci_disable_msi(pdev);
- pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
pci_set_drvdata(pdev, NULL);
put_disk(dd->disk);
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 4/9] gpio: Replace deprecated PCI functions
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
` (2 preceding siblings ...)
2024-08-22 13:47 ` [PATCH v3 3/9] block: mtip32xx: " Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 5/9] ethernet: cavium: " Philipp Stanner
` (5 subsequent siblings)
9 siblings, 0 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization,
Bartosz Golaszewski
pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the
PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace those functions with calls to pcim_iomap_region().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-merrifield.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index 421d7e3a6c66..274afcba31e6 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -78,24 +78,24 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
if (retval)
return retval;
- retval = pcim_iomap_regions(pdev, BIT(1) | BIT(0), pci_name(pdev));
- if (retval)
- return dev_err_probe(dev, retval, "I/O memory mapping error\n");
-
- base = pcim_iomap_table(pdev)[1];
+ base = pcim_iomap_region(pdev, 1, pci_name(pdev));
+ if (IS_ERR(base))
+ return dev_err_probe(dev, PTR_ERR(base), "I/O memory mapping error\n");
irq_base = readl(base + 0 * sizeof(u32));
gpio_base = readl(base + 1 * sizeof(u32));
/* Release the IO mapping, since we already get the info from BAR1 */
- pcim_iounmap_regions(pdev, BIT(1));
+ pcim_iounmap_region(pdev, 1);
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->dev = dev;
- priv->reg_base = pcim_iomap_table(pdev)[0];
+ priv->reg_base = pcim_iomap_region(pdev, 0, pci_name(pdev));
+ if (IS_ERR(priv->reg_base))
+ return dev_err_probe(dev, PTR_ERR(base), "I/O memory mapping error\n");
priv->pin_info.pin_ranges = mrfld_gpio_ranges;
priv->pin_info.nranges = ARRAY_SIZE(mrfld_gpio_ranges);
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 5/9] ethernet: cavium: Replace deprecated PCI functions
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
` (3 preceding siblings ...)
2024-08-22 13:47 ` [PATCH v3 4/9] gpio: " Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 14:44 ` Andy Shevchenko
2024-08-22 13:47 ` [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage Philipp Stanner
` (4 subsequent siblings)
9 siblings, 1 reply; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
pcim_iomap_regions() and pcim_iomap_table() have been deprecated by
the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with the function pcim_iomap_region().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/net/ethernet/cavium/common/cavium_ptp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cavium/common/cavium_ptp.c b/drivers/net/ethernet/cavium/common/cavium_ptp.c
index 9fd717b9cf69..1849c62cde1d 100644
--- a/drivers/net/ethernet/cavium/common/cavium_ptp.c
+++ b/drivers/net/ethernet/cavium/common/cavium_ptp.c
@@ -239,11 +239,11 @@ static int cavium_ptp_probe(struct pci_dev *pdev,
if (err)
goto error_free;
- err = pcim_iomap_regions(pdev, 1 << PCI_PTP_BAR_NO, pci_name(pdev));
- if (err)
+ clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO, pci_name(pdev));
+ if (IS_ERR(clock->reg_base)) {
+ err = PTR_ERR(clock->reg_base);
goto error_free;
-
- clock->reg_base = pcim_iomap_table(pdev)[PCI_PTP_BAR_NO];
+ }
spin_lock_init(&clock->spin_lock);
@@ -292,7 +292,7 @@ static int cavium_ptp_probe(struct pci_dev *pdev,
clock_cfg = readq(clock->reg_base + PTP_CLOCK_CFG);
clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN;
writeq(clock_cfg, clock->reg_base + PTP_CLOCK_CFG);
- pcim_iounmap_regions(pdev, 1 << PCI_PTP_BAR_NO);
+ pcim_iounmap_region(pdev, PCI_PTP_BAR_NO);
error_free:
devm_kfree(dev, clock);
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
` (4 preceding siblings ...)
2024-08-22 13:47 ` [PATCH v3 5/9] ethernet: cavium: " Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 14:46 ` Andy Shevchenko
2024-08-23 9:29 ` Serge Semin
2024-08-22 13:47 ` [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres Philipp Stanner
` (3 subsequent siblings)
9 siblings, 2 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
stmicro uses PCI devres in the wrong way. Resources requested
through pcim_* functions don't need to be cleaned up manually in the
remove() callback or in the error unwind path of a probe() function.
Moreover, there is an unnecessary loop which only requests and ioremaps
BAR 0, but iterates over all BARs nevertheless.
Furthermore, pcim_iomap_regions() and pcim_iomap_table() have been
deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with pcim_iomap_region().
Remove the unnecessary manual pcim_* cleanup calls.
Remove the unnecessary loop over all BARs.
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
.../ethernet/stmicro/stmmac/dwmac-loongson.c | 25 +++++--------------
.../net/ethernet/stmicro/stmmac/stmmac_pci.c | 18 +++++--------
2 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index 9e40c28d453a..5d42a9fad672 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -50,7 +50,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
struct plat_stmmacenet_data *plat;
struct stmmac_resources res;
struct device_node *np;
- int ret, i, phy_mode;
+ int ret, phy_mode;
np = dev_of_node(&pdev->dev);
@@ -88,14 +88,11 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
goto err_put_node;
}
- /* Get the base address of device */
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (pci_resource_len(pdev, i) == 0)
- continue;
- ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev));
- if (ret)
- goto err_disable_device;
- break;
+ memset(&res, 0, sizeof(res));
+ res.addr = pcim_iomap_region(pdev, 0, pci_name(pdev));
+ if (IS_ERR(res.addr)) {
+ ret = PTR_ERR(res.addr);
+ goto err_disable_device;
}
plat->bus_id = of_alias_get_id(np, "ethernet");
@@ -116,8 +113,6 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
loongson_default_data(plat);
pci_enable_msi(pdev);
- memset(&res, 0, sizeof(res));
- res.addr = pcim_iomap_table(pdev)[0];
res.irq = of_irq_get_byname(np, "macirq");
if (res.irq < 0) {
@@ -158,18 +153,10 @@ static void loongson_dwmac_remove(struct pci_dev *pdev)
{
struct net_device *ndev = dev_get_drvdata(&pdev->dev);
struct stmmac_priv *priv = netdev_priv(ndev);
- int i;
of_node_put(priv->plat->mdio_node);
stmmac_dvr_remove(&pdev->dev);
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (pci_resource_len(pdev, i) == 0)
- continue;
- pcim_iounmap_regions(pdev, BIT(i));
- break;
- }
-
pci_disable_msi(pdev);
pci_disable_device(pdev);
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 352b01678c22..f89a8a54c4e8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -188,11 +188,11 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
return ret;
}
- /* Get the base address of device */
+ /* Request the base address BAR of device */
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
if (pci_resource_len(pdev, i) == 0)
continue;
- ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));
+ ret = pcim_request_region(pdev, i, pci_name(pdev));
if (ret)
return ret;
break;
@@ -205,7 +205,10 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
return ret;
memset(&res, 0, sizeof(res));
- res.addr = pcim_iomap_table(pdev)[i];
+ /* Get the base address of device */
+ res.addr = pcim_iomap(pdev, i, 0);
+ if (!res.addr)
+ return -ENOMEM;
res.wol_irq = pdev->irq;
res.irq = pdev->irq;
@@ -231,16 +234,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
*/
static void stmmac_pci_remove(struct pci_dev *pdev)
{
- int i;
-
stmmac_dvr_remove(&pdev->dev);
-
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (pci_resource_len(pdev, i) == 0)
- continue;
- pcim_iounmap_regions(pdev, BIT(i));
- break;
- }
}
static int __maybe_unused stmmac_pci_suspend(struct device *dev)
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
` (5 preceding siblings ...)
2024-08-22 13:47 ` [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 14:34 ` Christophe JAILLET
2024-08-22 14:47 ` Andy Shevchenko
2024-08-22 13:47 ` [PATCH v3 8/9] vdap: solidrun: Replace deprecated PCI functions Philipp Stanner
` (2 subsequent siblings)
9 siblings, 2 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization,
stable, Christophe JAILLET
In psnet_open_pf_bar() and snet_open_vf_bar() a string later passed to
pcim_iomap_regions() is placed on the stack. Neither
pcim_iomap_regions() nor the functions it calls copy that string.
Should the string later ever be used, this, consequently, causes
undefined behavior since the stack frame will by then have disappeared.
Fix the bug by allocating the strings on the heap through
devm_kasprintf().
Cc: stable@vger.kernel.org # v6.3
Fixes: 51a8f9d7f587 ("virtio: vdpa: new SolidNET DPU driver.")
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Closes: https://lore.kernel.org/all/74e9109a-ac59-49e2-9b1d-d825c9c9f891@wanadoo.fr/
Suggested-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/vdpa/solidrun/snet_main.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c
index 99428a04068d..67235f6190ef 100644
--- a/drivers/vdpa/solidrun/snet_main.c
+++ b/drivers/vdpa/solidrun/snet_main.c
@@ -555,7 +555,7 @@ static const struct vdpa_config_ops snet_config_ops = {
static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
{
- char name[50];
+ char *name;
int ret, i, mask = 0;
/* We don't know which BAR will be used to communicate..
* We will map every bar with len > 0.
@@ -573,7 +573,10 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
return -ENODEV;
}
- snprintf(name, sizeof(name), "psnet[%s]-bars", pci_name(pdev));
+ name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
+ if (!name)
+ return -ENOMEM;
+
ret = pcim_iomap_regions(pdev, mask, name);
if (ret) {
SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
@@ -590,10 +593,12 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet)
{
- char name[50];
+ char *name;
int ret;
- snprintf(name, sizeof(name), "snet[%s]-bar", pci_name(pdev));
+ name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
+ if (!name)
+ return -ENOMEM;
/* Request and map BAR */
ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
if (ret) {
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 8/9] vdap: solidrun: Replace deprecated PCI functions
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
` (6 preceding siblings ...)
2024-08-22 13:47 ` [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 14:49 ` Andy Shevchenko
2024-08-22 13:47 ` [PATCH v3 9/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
2024-08-22 14:50 ` [PATCH v3 0/9] " Andy Shevchenko
9 siblings, 1 reply; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
solidrun utilizes pcim_iomap_regions(), which has been deprecated by the
PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
pcim_iomap_table(), pcim_iomap_regions_request_all()"), among other
things because it forces usage of quite a complicated bitmask mechanism.
The bitmask handling code can entirely be removed by replacing
pcim_iomap_regions() and pcim_iomap_table().
Replace pcim_iomap_regions() and pcim_iomap_table() with
pcim_iomap_region().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/vdpa/solidrun/snet_main.c | 52 +++++++++++--------------------
1 file changed, 18 insertions(+), 34 deletions(-)
diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c
index 67235f6190ef..fb15e844847d 100644
--- a/drivers/vdpa/solidrun/snet_main.c
+++ b/drivers/vdpa/solidrun/snet_main.c
@@ -556,36 +556,25 @@ static const struct vdpa_config_ops snet_config_ops = {
static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
{
char *name;
- int ret, i, mask = 0;
- /* We don't know which BAR will be used to communicate..
- * We will map every bar with len > 0.
- *
- * Later, we will discover the BAR and unmap all other BARs.
- */
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (pci_resource_len(pdev, i))
- mask |= (1 << i);
- }
-
- /* No BAR can be used.. */
- if (!mask) {
- SNET_ERR(pdev, "Failed to find a PCI BAR\n");
- return -ENODEV;
- }
+ unsigned short i;
name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
if (!name)
return -ENOMEM;
- ret = pcim_iomap_regions(pdev, mask, name);
- if (ret) {
- SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
- return ret;
- }
-
+ /* We don't know which BAR will be used to communicate..
+ * We will map every bar with len > 0.
+ *
+ * Later, we will discover the BAR and unmap all other BARs.
+ */
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (mask & (1 << i))
- psnet->bars[i] = pcim_iomap_table(pdev)[i];
+ if (!pci_resource_len(pdev, i))
+ continue;
+ psnet->bars[i] = pcim_iomap_region(pdev, i, name);
+ if (IS_ERR(psnet->bars[i])) {
+ SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
+ return PTR_ERR(psnet->bars[i]);
+ }
}
return 0;
@@ -600,14 +589,12 @@ static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet)
if (!name)
return -ENOMEM;
/* Request and map BAR */
- ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
- if (ret) {
+ snet->bar = pcim_iomap_region(pdev, snet->psnet->cfg.vf_bar, name);
+ if (IS_ERR(snet->bar)) {
SNET_ERR(pdev, "Failed to request and map PCI BAR for a VF\n");
- return ret;
+ return PTR_ERR(snet->bar);
}
- snet->bar = pcim_iomap_table(pdev)[snet->psnet->cfg.vf_bar];
-
return 0;
}
@@ -655,15 +642,12 @@ static int psnet_detect_bar(struct psnet *psnet, u32 off)
static void psnet_unmap_unused_bars(struct pci_dev *pdev, struct psnet *psnet)
{
- int i, mask = 0;
+ unsigned short i;
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
if (psnet->bars[i] && i != psnet->barno)
- mask |= (1 << i);
+ pcim_iounmap_region(pdev, i);
}
-
- if (mask)
- pcim_iounmap_regions(pdev, mask);
}
/* Read SNET config from PCI BAR */
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 9/9] PCI: Remove pcim_iounmap_regions()
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
` (7 preceding siblings ...)
2024-08-22 13:47 ` [PATCH v3 8/9] vdap: solidrun: Replace deprecated PCI functions Philipp Stanner
@ 2024-08-22 13:47 ` Philipp Stanner
2024-08-22 14:50 ` [PATCH v3 0/9] " Andy Shevchenko
9 siblings, 0 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-22 13:47 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Philipp Stanner, Damien Le Moal,
Hannes Reinecke, Chaitanya Kulkarni
Cc: linux-doc, linux-kernel, linux-block, linux-fpga, linux-gpio,
netdev, linux-stm32, linux-arm-kernel, linux-pci, virtualization
All users of pcim_iounmap_regions() have been removed by now.
Remove pcim_iounmap_regions().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
---
.../driver-api/driver-model/devres.rst | 1 -
drivers/pci/devres.c | 21 -------------------
include/linux/pci.h | 1 -
3 files changed, 23 deletions(-)
diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index ac9ee7441887..525f08694984 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -397,7 +397,6 @@ PCI
pcim_iomap_regions_request_all() : do request_region() on all and iomap() on multiple BARs
pcim_iomap_table() : array of mapped addresses indexed by BAR
pcim_iounmap() : do iounmap() on a single BAR
- pcim_iounmap_regions() : do iounmap() and release_region() on multiple BARs
pcim_pin_device() : keep PCI device enabled after release
pcim_set_mwi() : enable Memory-Write-Invalidate PCI transaction
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index 4dbba385e6b4..022c0bb243ad 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -1013,27 +1013,6 @@ int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,
}
EXPORT_SYMBOL(pcim_iomap_regions_request_all);
-/**
- * pcim_iounmap_regions - Unmap and release PCI BARs
- * @pdev: PCI device to map IO resources for
- * @mask: Mask of BARs to unmap and release
- *
- * Unmap and release regions specified by @mask.
- */
-void pcim_iounmap_regions(struct pci_dev *pdev, int mask)
-{
- int i;
-
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (!mask_contains_bar(mask, i))
- continue;
-
- pcim_iounmap_region(pdev, i);
- pcim_remove_bar_from_legacy_table(pdev, i);
- }
-}
-EXPORT_SYMBOL(pcim_iounmap_regions);
-
/**
* pcim_iomap_range - Create a ranged __iomap mapping within a PCI BAR
* @pdev: PCI device to map IO resources for
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9625d8a7b655..6c60f063c672 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2301,7 +2301,6 @@ void pcim_iounmap_region(struct pci_dev *pdev, int bar);
int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name);
int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,
const char *name);
-void pcim_iounmap_regions(struct pci_dev *pdev, int mask);
void __iomem *pcim_iomap_range(struct pci_dev *pdev, int bar,
unsigned long offset, unsigned long len);
--
2.46.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres
2024-08-22 13:47 ` [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres Philipp Stanner
@ 2024-08-22 14:34 ` Christophe JAILLET
2024-08-26 6:55 ` Philipp Stanner
2024-08-22 14:47 ` Andy Shevchenko
1 sibling, 1 reply; 24+ messages in thread
From: Christophe JAILLET @ 2024-08-22 14:34 UTC (permalink / raw)
To: Philipp Stanner
Cc: alexandre.torgue, alvaro.karsz, andy, axboe, bhelgaas, brgl,
broonie, christophe.jaillet, corbet, davem, dlechner, dlemoal,
edumazet, eperezma, hao.wu, hare, jasowang, joabreu, kch, kuba,
linus.walleij, linux-arm-kernel, linux-block, linux-doc,
linux-fpga, linux-gpio, linux-kernel, linux-pci, linux-stm32,
mcoquelin.stm32, mdf, mst, netdev, pabeni, richardcochran, stable,
trix, u.kleine-koenig, virtualization, xuanzhuo, yilun.xu
Le 22/08/2024 à 15:47, Philipp Stanner a écrit :
> In psnet_open_pf_bar() and snet_open_vf_bar() a string later passed to
> pcim_iomap_regions() is placed on the stack. Neither
> pcim_iomap_regions() nor the functions it calls copy that string.
>
> Should the string later ever be used, this, consequently, causes
> undefined behavior since the stack frame will by then have disappeared.
>
> Fix the bug by allocating the strings on the heap through
> devm_kasprintf().
>
> Cc: stable@vger.kernel.org # v6.3
> Fixes: 51a8f9d7f587 ("virtio: vdpa: new SolidNET DPU driver.")
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Closes: https://lore.kernel.org/all/74e9109a-ac59-49e2-9b1d-d825c9c9f891@wanadoo.fr/
> Suggested-by: Andy Shevchenko <andy@kernel.org>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> ---
> drivers/vdpa/solidrun/snet_main.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c
> index 99428a04068d..67235f6190ef 100644
> --- a/drivers/vdpa/solidrun/snet_main.c
> +++ b/drivers/vdpa/solidrun/snet_main.c
> @@ -555,7 +555,7 @@ static const struct vdpa_config_ops snet_config_ops = {
>
> static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
> {
> - char name[50];
> + char *name;
> int ret, i, mask = 0;
> /* We don't know which BAR will be used to communicate..
> * We will map every bar with len > 0.
> @@ -573,7 +573,10 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
> return -ENODEV;
> }
>
> - snprintf(name, sizeof(name), "psnet[%s]-bars", pci_name(pdev));
> + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
> + if (!name)
> + return -ENOMEM;
> +
> ret = pcim_iomap_regions(pdev, mask, name);
> if (ret) {
> SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
> @@ -590,10 +593,12 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
>
> static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet)
> {
> - char name[50];
> + char *name;
> int ret;
>
> - snprintf(name, sizeof(name), "snet[%s]-bar", pci_name(pdev));
> + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
s/psnet/snet/
> + if (!name)
> + return -ENOMEM;
> /* Request and map BAR */
> ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
> if (ret) {
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 5/9] ethernet: cavium: Replace deprecated PCI functions
2024-08-22 13:47 ` [PATCH v3 5/9] ethernet: cavium: " Philipp Stanner
@ 2024-08-22 14:44 ` Andy Shevchenko
2024-08-26 14:51 ` Philipp Stanner
0 siblings, 1 reply; 24+ messages in thread
From: Andy Shevchenko @ 2024-08-22 14:44 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Linus Walleij, Bartosz Golaszewski, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandre Torgue,
Jose Abreu, Maxime Coquelin, Bjorn Helgaas, Alvaro Karsz,
Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Richard Cochran, Mark Brown, David Lechner, Uwe Kleine-König,
Damien Le Moal, Hannes Reinecke, Chaitanya Kulkarni, linux-doc,
linux-kernel, linux-block, linux-fpga, linux-gpio, netdev,
linux-stm32, linux-arm-kernel, linux-pci, virtualization
On Thu, Aug 22, 2024 at 03:47:37PM +0200, Philipp Stanner wrote:
> pcim_iomap_regions() and pcim_iomap_table() have been deprecated by
> the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
> pcim_iomap_table(), pcim_iomap_regions_request_all()").
>
> Replace these functions with the function pcim_iomap_region().
...
> - err = pcim_iomap_regions(pdev, 1 << PCI_PTP_BAR_NO, pci_name(pdev));
> - if (err)
> + clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO, pci_name(pdev));
> + if (IS_ERR(clock->reg_base)) {
> + err = PTR_ERR(clock->reg_base);
> goto error_free;
> -
> - clock->reg_base = pcim_iomap_table(pdev)[PCI_PTP_BAR_NO];
> + }
Perhaps
clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO, pci_name(pdev));
err = PTR_ERR_OR_ZERO(clock->reg_base);
if (err)
goto error_free;
This will make your patch smaller and neater.
P.S. Do you use --histogram diff algo when preparing patches?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage
2024-08-22 13:47 ` [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage Philipp Stanner
@ 2024-08-22 14:46 ` Andy Shevchenko
2024-08-23 9:29 ` Serge Semin
1 sibling, 0 replies; 24+ messages in thread
From: Andy Shevchenko @ 2024-08-22 14:46 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Linus Walleij, Bartosz Golaszewski, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandre Torgue,
Jose Abreu, Maxime Coquelin, Bjorn Helgaas, Alvaro Karsz,
Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Richard Cochran, Mark Brown, David Lechner, Uwe Kleine-König,
Damien Le Moal, Hannes Reinecke, Chaitanya Kulkarni, linux-doc,
linux-kernel, linux-block, linux-fpga, linux-gpio, netdev,
linux-stm32, linux-arm-kernel, linux-pci, virtualization
On Thu, Aug 22, 2024 at 03:47:38PM +0200, Philipp Stanner wrote:
> stmicro uses PCI devres in the wrong way. Resources requested
> through pcim_* functions don't need to be cleaned up manually in the
> remove() callback or in the error unwind path of a probe() function.
>
> Moreover, there is an unnecessary loop which only requests and ioremaps
> BAR 0, but iterates over all BARs nevertheless.
>
> Furthermore, pcim_iomap_regions() and pcim_iomap_table() have been
> deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
> pcim_iomap_table(), pcim_iomap_regions_request_all()").
>
> Replace these functions with pcim_iomap_region().
>
> Remove the unnecessary manual pcim_* cleanup calls.
>
> Remove the unnecessary loop over all BARs.
...
> - /* Get the base address of device */
> + /* Request the base address BAR of device */
It's a tautology, "BAR" == Base Address ...
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres
2024-08-22 13:47 ` [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres Philipp Stanner
2024-08-22 14:34 ` Christophe JAILLET
@ 2024-08-22 14:47 ` Andy Shevchenko
1 sibling, 0 replies; 24+ messages in thread
From: Andy Shevchenko @ 2024-08-22 14:47 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Linus Walleij, Bartosz Golaszewski, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandre Torgue,
Jose Abreu, Maxime Coquelin, Bjorn Helgaas, Alvaro Karsz,
Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Richard Cochran, Mark Brown, David Lechner, Uwe Kleine-König,
Damien Le Moal, Hannes Reinecke, Chaitanya Kulkarni, linux-doc,
linux-kernel, linux-block, linux-fpga, linux-gpio, netdev,
linux-stm32, linux-arm-kernel, linux-pci, virtualization, stable,
Christophe JAILLET
On Thu, Aug 22, 2024 at 03:47:39PM +0200, Philipp Stanner wrote:
> In psnet_open_pf_bar() and snet_open_vf_bar() a string later passed to
> pcim_iomap_regions() is placed on the stack. Neither
> pcim_iomap_regions() nor the functions it calls copy that string.
>
> Should the string later ever be used, this, consequently, causes
> undefined behavior since the stack frame will by then have disappeared.
>
> Fix the bug by allocating the strings on the heap through
> devm_kasprintf().
...
> - snprintf(name, sizeof(name), "psnet[%s]-bars", pci_name(pdev));
> + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
> + if (!name)
> + return -ENOMEM;
> +
> ret = pcim_iomap_regions(pdev, mask, name);
...
> - snprintf(name, sizeof(name), "snet[%s]-bar", pci_name(pdev));
> + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
> + if (!name)
> + return -ENOMEM;
+ Blank line as in the above snippet?
> /* Request and map BAR */
> ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 8/9] vdap: solidrun: Replace deprecated PCI functions
2024-08-22 13:47 ` [PATCH v3 8/9] vdap: solidrun: Replace deprecated PCI functions Philipp Stanner
@ 2024-08-22 14:49 ` Andy Shevchenko
0 siblings, 0 replies; 24+ messages in thread
From: Andy Shevchenko @ 2024-08-22 14:49 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Linus Walleij, Bartosz Golaszewski, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandre Torgue,
Jose Abreu, Maxime Coquelin, Bjorn Helgaas, Alvaro Karsz,
Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Richard Cochran, Mark Brown, David Lechner, Uwe Kleine-König,
Damien Le Moal, Hannes Reinecke, Chaitanya Kulkarni, linux-doc,
linux-kernel, linux-block, linux-fpga, linux-gpio, netdev,
linux-stm32, linux-arm-kernel, linux-pci, virtualization
On Thu, Aug 22, 2024 at 03:47:40PM +0200, Philipp Stanner wrote:
> solidrun utilizes pcim_iomap_regions(), which has been deprecated by the
> PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
> pcim_iomap_table(), pcim_iomap_regions_request_all()"), among other
> things because it forces usage of quite a complicated bitmask mechanism.
> The bitmask handling code can entirely be removed by replacing
> pcim_iomap_regions() and pcim_iomap_table().
>
> Replace pcim_iomap_regions() and pcim_iomap_table() with
> pcim_iomap_region().
...
> /* Request and map BAR */
> - ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
> - if (ret) {
> + snet->bar = pcim_iomap_region(pdev, snet->psnet->cfg.vf_bar, name);
PTR_ERR_OR_ZERO() ?
> + if (IS_ERR(snet->bar)) {
> SNET_ERR(pdev, "Failed to request and map PCI BAR for a VF\n");
> - return ret;
> + return PTR_ERR(snet->bar);
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions()
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
` (8 preceding siblings ...)
2024-08-22 13:47 ` [PATCH v3 9/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
@ 2024-08-22 14:50 ` Andy Shevchenko
9 siblings, 0 replies; 24+ messages in thread
From: Andy Shevchenko @ 2024-08-22 14:50 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Linus Walleij, Bartosz Golaszewski, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandre Torgue,
Jose Abreu, Maxime Coquelin, Bjorn Helgaas, Alvaro Karsz,
Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Richard Cochran, Mark Brown, David Lechner, Uwe Kleine-König,
Damien Le Moal, Hannes Reinecke, Chaitanya Kulkarni, linux-doc,
linux-kernel, linux-block, linux-fpga, linux-gpio, netdev,
linux-stm32, linux-arm-kernel, linux-pci, virtualization
On Thu, Aug 22, 2024 at 03:47:32PM +0200, Philipp Stanner wrote:
> Important things first:
> This series is based on [1] and [2] which Bjorn Helgaas has currently
> queued for v6.12 in the PCI tree.
>
> This series shall remove pcim_iounmap_regions() in order to make way to
> remove its brother, pcim_iomap_regions().
For the non-commented ones (by me or by others)
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage
2024-08-22 13:47 ` [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage Philipp Stanner
2024-08-22 14:46 ` Andy Shevchenko
@ 2024-08-23 9:29 ` Serge Semin
2024-08-26 6:30 ` Philipp Stanner
1 sibling, 1 reply; 24+ messages in thread
From: Serge Semin @ 2024-08-23 9:29 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Damien Le Moal, Hannes Reinecke,
Chaitanya Kulkarni, linux-doc, linux-kernel, linux-block,
linux-fpga, linux-gpio, netdev, linux-stm32, linux-arm-kernel,
linux-pci, virtualization
Hi Philipp
On Thu, Aug 22, 2024 at 03:47:38PM +0200, Philipp Stanner wrote:
> stmicro uses PCI devres in the wrong way. Resources requested
> through pcim_* functions don't need to be cleaned up manually in the
> remove() callback or in the error unwind path of a probe() function.
>
> Moreover, there is an unnecessary loop which only requests and ioremaps
> BAR 0, but iterates over all BARs nevertheless.
>
> Furthermore, pcim_iomap_regions() and pcim_iomap_table() have been
> deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
> pcim_iomap_table(), pcim_iomap_regions_request_all()").
>
> Replace these functions with pcim_iomap_region().
>
> Remove the unnecessary manual pcim_* cleanup calls.
>
> Remove the unnecessary loop over all BARs.
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Thanks for the series. But please note the network subsystem
dev-process requires to submit the cleanup/feature changes on top of
the net-next tree:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/
Just recently a Yanteng' (+cc) series
https://lore.kernel.org/netdev/cover.1723014611.git.siyanteng@loongson.cn/
was merged in which significantly refactored the Loongson MAC driver.
Seeing your patch isn't based on these changes, there is a high
probability that the patch won't get cleanly applied onto the
net-next tree. So please either rebase your patch onto the net-next
tree, or at least merge in the Yanteng' series in your tree and
rebase the patch onto it and let's hope there have been no other
conflicting patches merged in into the net-next tree.
-Serge(y)
> ---
> .../ethernet/stmicro/stmmac/dwmac-loongson.c | 25 +++++--------------
> .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 18 +++++--------
> 2 files changed, 12 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index 9e40c28d453a..5d42a9fad672 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -50,7 +50,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
> struct plat_stmmacenet_data *plat;
> struct stmmac_resources res;
> struct device_node *np;
> - int ret, i, phy_mode;
> + int ret, phy_mode;
>
> np = dev_of_node(&pdev->dev);
>
> @@ -88,14 +88,11 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
> goto err_put_node;
> }
>
> - /* Get the base address of device */
> - for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> - if (pci_resource_len(pdev, i) == 0)
> - continue;
> - ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev));
> - if (ret)
> - goto err_disable_device;
> - break;
> + memset(&res, 0, sizeof(res));
> + res.addr = pcim_iomap_region(pdev, 0, pci_name(pdev));
> + if (IS_ERR(res.addr)) {
> + ret = PTR_ERR(res.addr);
> + goto err_disable_device;
> }
>
> plat->bus_id = of_alias_get_id(np, "ethernet");
> @@ -116,8 +113,6 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
>
> loongson_default_data(plat);
> pci_enable_msi(pdev);
> - memset(&res, 0, sizeof(res));
> - res.addr = pcim_iomap_table(pdev)[0];
>
> res.irq = of_irq_get_byname(np, "macirq");
> if (res.irq < 0) {
> @@ -158,18 +153,10 @@ static void loongson_dwmac_remove(struct pci_dev *pdev)
> {
> struct net_device *ndev = dev_get_drvdata(&pdev->dev);
> struct stmmac_priv *priv = netdev_priv(ndev);
> - int i;
>
> of_node_put(priv->plat->mdio_node);
> stmmac_dvr_remove(&pdev->dev);
>
> - for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> - if (pci_resource_len(pdev, i) == 0)
> - continue;
> - pcim_iounmap_regions(pdev, BIT(i));
> - break;
> - }
> -
> pci_disable_msi(pdev);
> pci_disable_device(pdev);
> }
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> index 352b01678c22..f89a8a54c4e8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> @@ -188,11 +188,11 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
> return ret;
> }
>
> - /* Get the base address of device */
> + /* Request the base address BAR of device */
> for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> if (pci_resource_len(pdev, i) == 0)
> continue;
> - ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));
> + ret = pcim_request_region(pdev, i, pci_name(pdev));
> if (ret)
> return ret;
> break;
> @@ -205,7 +205,10 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
> return ret;
>
> memset(&res, 0, sizeof(res));
> - res.addr = pcim_iomap_table(pdev)[i];
> + /* Get the base address of device */
> + res.addr = pcim_iomap(pdev, i, 0);
> + if (!res.addr)
> + return -ENOMEM;
> res.wol_irq = pdev->irq;
> res.irq = pdev->irq;
>
> @@ -231,16 +234,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
> */
> static void stmmac_pci_remove(struct pci_dev *pdev)
> {
> - int i;
> -
> stmmac_dvr_remove(&pdev->dev);
> -
> - for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> - if (pci_resource_len(pdev, i) == 0)
> - continue;
> - pcim_iounmap_regions(pdev, BIT(i));
> - break;
> - }
> }
>
> static int __maybe_unused stmmac_pci_suspend(struct device *dev)
> --
> 2.46.0
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage
2024-08-23 9:29 ` Serge Semin
@ 2024-08-26 6:30 ` Philipp Stanner
0 siblings, 0 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-26 6:30 UTC (permalink / raw)
To: Serge Semin
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Damien Le Moal, Hannes Reinecke,
Chaitanya Kulkarni, linux-doc, linux-kernel, linux-block,
linux-fpga, linux-gpio, netdev, linux-stm32, linux-arm-kernel,
linux-pci, virtualization
On Fri, 2024-08-23 at 12:29 +0300, Serge Semin wrote:
> Hi Philipp
>
> On Thu, Aug 22, 2024 at 03:47:38PM +0200, Philipp Stanner wrote:
> > stmicro uses PCI devres in the wrong way. Resources requested
> > through pcim_* functions don't need to be cleaned up manually in
> > the
> > remove() callback or in the error unwind path of a probe()
> > function.
> >
> > Moreover, there is an unnecessary loop which only requests and
> > ioremaps
> > BAR 0, but iterates over all BARs nevertheless.
> >
> > Furthermore, pcim_iomap_regions() and pcim_iomap_table() have been
> > deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI:
> > Deprecate
> > pcim_iomap_table(), pcim_iomap_regions_request_all()").
> >
> > Replace these functions with pcim_iomap_region().
> >
> > Remove the unnecessary manual pcim_* cleanup calls.
> >
> > Remove the unnecessary loop over all BARs.
> >
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
>
> Thanks for the series. But please note the network subsystem
> dev-process requires to submit the cleanup/feature changes on top of
> the net-next tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/
That seems a policy I haven't seen so far; usually the assumption is
that you branch out from Linus's master.
Anyways, I of course am going to help with setting up something
mergeable
>
> Just recently a Yanteng' (+cc) series
> https://lore.kernel.org/netdev/cover.1723014611.git.siyanteng@loongson.cn/
> was merged in which significantly refactored the Loongson MAC driver.
> Seeing your patch isn't based on these changes, there is a high
> probability that the patch won't get cleanly applied onto the
> net-next tree. So please either rebase your patch onto the net-next
> tree, or at least merge in the Yanteng' series in your tree and
> rebase the patch onto it and let's hope there have been no other
> conflicting patches merged in into the net-next tree.
I'll take a look into that, thx
P.
>
> -Serge(y)
>
>
> > ---
> > .../ethernet/stmicro/stmmac/dwmac-loongson.c | 25 +++++----------
> > ----
> > .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 18 +++++--------
> > 2 files changed, 12 insertions(+), 31 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > index 9e40c28d453a..5d42a9fad672 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > @@ -50,7 +50,7 @@ static int loongson_dwmac_probe(struct pci_dev
> > *pdev, const struct pci_device_id
> > struct plat_stmmacenet_data *plat;
> > struct stmmac_resources res;
> > struct device_node *np;
> > - int ret, i, phy_mode;
> > + int ret, phy_mode;
> >
> > np = dev_of_node(&pdev->dev);
> >
> > @@ -88,14 +88,11 @@ static int loongson_dwmac_probe(struct pci_dev
> > *pdev, const struct pci_device_id
> > goto err_put_node;
> > }
> >
> > - /* Get the base address of device */
> > - for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> > - if (pci_resource_len(pdev, i) == 0)
> > - continue;
> > - ret = pcim_iomap_regions(pdev, BIT(0),
> > pci_name(pdev));
> > - if (ret)
> > - goto err_disable_device;
> > - break;
> > + memset(&res, 0, sizeof(res));
> > + res.addr = pcim_iomap_region(pdev, 0, pci_name(pdev));
> > + if (IS_ERR(res.addr)) {
> > + ret = PTR_ERR(res.addr);
> > + goto err_disable_device;
> > }
> >
> > plat->bus_id = of_alias_get_id(np, "ethernet");
> > @@ -116,8 +113,6 @@ static int loongson_dwmac_probe(struct pci_dev
> > *pdev, const struct pci_device_id
> >
> > loongson_default_data(plat);
> > pci_enable_msi(pdev);
> > - memset(&res, 0, sizeof(res));
> > - res.addr = pcim_iomap_table(pdev)[0];
> >
> > res.irq = of_irq_get_byname(np, "macirq");
> > if (res.irq < 0) {
> > @@ -158,18 +153,10 @@ static void loongson_dwmac_remove(struct
> > pci_dev *pdev)
> > {
> > struct net_device *ndev = dev_get_drvdata(&pdev->dev);
> > struct stmmac_priv *priv = netdev_priv(ndev);
> > - int i;
> >
> > of_node_put(priv->plat->mdio_node);
> > stmmac_dvr_remove(&pdev->dev);
> >
> > - for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> > - if (pci_resource_len(pdev, i) == 0)
> > - continue;
> > - pcim_iounmap_regions(pdev, BIT(i));
> > - break;
> > - }
> > -
> > pci_disable_msi(pdev);
> > pci_disable_device(pdev);
> > }
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> > b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> > index 352b01678c22..f89a8a54c4e8 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> > @@ -188,11 +188,11 @@ static int stmmac_pci_probe(struct pci_dev
> > *pdev,
> > return ret;
> > }
> >
> > - /* Get the base address of device */
> > + /* Request the base address BAR of device */
> > for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> > if (pci_resource_len(pdev, i) == 0)
> > continue;
> > - ret = pcim_iomap_regions(pdev, BIT(i),
> > pci_name(pdev));
> > + ret = pcim_request_region(pdev, i,
> > pci_name(pdev));
> > if (ret)
> > return ret;
> > break;
> > @@ -205,7 +205,10 @@ static int stmmac_pci_probe(struct pci_dev
> > *pdev,
> > return ret;
> >
> > memset(&res, 0, sizeof(res));
> > - res.addr = pcim_iomap_table(pdev)[i];
> > + /* Get the base address of device */
> > + res.addr = pcim_iomap(pdev, i, 0);
> > + if (!res.addr)
> > + return -ENOMEM;
> > res.wol_irq = pdev->irq;
> > res.irq = pdev->irq;
> >
> > @@ -231,16 +234,7 @@ static int stmmac_pci_probe(struct pci_dev
> > *pdev,
> > */
> > static void stmmac_pci_remove(struct pci_dev *pdev)
> > {
> > - int i;
> > -
> > stmmac_dvr_remove(&pdev->dev);
> > -
> > - for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> > - if (pci_resource_len(pdev, i) == 0)
> > - continue;
> > - pcim_iounmap_regions(pdev, BIT(i));
> > - break;
> > - }
> > }
> >
> > static int __maybe_unused stmmac_pci_suspend(struct device *dev)
> > --
> > 2.46.0
> >
> >
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres
2024-08-22 14:34 ` Christophe JAILLET
@ 2024-08-26 6:55 ` Philipp Stanner
0 siblings, 0 replies; 24+ messages in thread
From: Philipp Stanner @ 2024-08-26 6:55 UTC (permalink / raw)
To: Christophe JAILLET
Cc: alexandre.torgue, alvaro.karsz, andy, axboe, bhelgaas, brgl,
broonie, corbet, davem, dlechner, dlemoal, edumazet, eperezma,
hao.wu, hare, jasowang, joabreu, kch, kuba, linus.walleij,
linux-arm-kernel, linux-block, linux-doc, linux-fpga, linux-gpio,
linux-kernel, linux-pci, linux-stm32, mcoquelin.stm32, mdf, mst,
netdev, pabeni, richardcochran, stable, trix, u.kleine-koenig,
virtualization, xuanzhuo, yilun.xu
On Thu, 2024-08-22 at 16:34 +0200, Christophe JAILLET wrote:
> Le 22/08/2024 à 15:47, Philipp Stanner a écrit :
> > In psnet_open_pf_bar() and snet_open_vf_bar() a string later passed
> > to
> > pcim_iomap_regions() is placed on the stack. Neither
> > pcim_iomap_regions() nor the functions it calls copy that string.
> >
> > Should the string later ever be used, this, consequently, causes
> > undefined behavior since the stack frame will by then have
> > disappeared.
> >
> > Fix the bug by allocating the strings on the heap through
> > devm_kasprintf().
> >
> > Cc: stable@vger.kernel.org # v6.3
> > Fixes: 51a8f9d7f587 ("virtio: vdpa: new SolidNET DPU driver.")
> > Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > Closes:
> > https://lore.kernel.org/all/74e9109a-ac59-49e2-9b1d-d825c9c9f891@wanadoo.fr/
> > Suggested-by: Andy Shevchenko <andy@kernel.org>
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > ---
> > drivers/vdpa/solidrun/snet_main.c | 13 +++++++++----
> > 1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/vdpa/solidrun/snet_main.c
> > b/drivers/vdpa/solidrun/snet_main.c
> > index 99428a04068d..67235f6190ef 100644
> > --- a/drivers/vdpa/solidrun/snet_main.c
> > +++ b/drivers/vdpa/solidrun/snet_main.c
> > @@ -555,7 +555,7 @@ static const struct vdpa_config_ops
> > snet_config_ops = {
> >
> > static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet
> > *psnet)
> > {
> > - char name[50];
> > + char *name;
> > int ret, i, mask = 0;
> > /* We don't know which BAR will be used to communicate..
> > * We will map every bar with len > 0.
> > @@ -573,7 +573,10 @@ static int psnet_open_pf_bar(struct pci_dev
> > *pdev, struct psnet *psnet)
> > return -ENODEV;
> > }
> >
> > - snprintf(name, sizeof(name), "psnet[%s]-bars",
> > pci_name(pdev));
> > + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-
> > bars", pci_name(pdev));
> > + if (!name)
> > + return -ENOMEM;
> > +
> > ret = pcim_iomap_regions(pdev, mask, name);
> > if (ret) {
> > SNET_ERR(pdev, "Failed to request and map PCI
> > BARs\n");
> > @@ -590,10 +593,12 @@ static int psnet_open_pf_bar(struct pci_dev
> > *pdev, struct psnet *psnet)
> >
> > static int snet_open_vf_bar(struct pci_dev *pdev, struct snet
> > *snet)
> > {
> > - char name[50];
> > + char *name;
> > int ret;
> >
> > - snprintf(name, sizeof(name), "snet[%s]-bar",
> > pci_name(pdev));
> > + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-
> > bars", pci_name(pdev));
>
> s/psnet/snet/
sharp eyes ;)
Thx,
P.
>
> > + if (!name)
> > + return -ENOMEM;
> > /* Request and map BAR */
> > ret = pcim_iomap_regions(pdev, BIT(snet->psnet-
> > >cfg.vf_bar), name);
> > if (ret) {
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 5/9] ethernet: cavium: Replace deprecated PCI functions
2024-08-22 14:44 ` Andy Shevchenko
@ 2024-08-26 14:51 ` Philipp Stanner
2024-08-26 15:41 ` Andy Shevchenko
0 siblings, 1 reply; 24+ messages in thread
From: Philipp Stanner @ 2024-08-26 14:51 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Linus Walleij, Bartosz Golaszewski, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexandre Torgue,
Jose Abreu, Maxime Coquelin, Bjorn Helgaas, Alvaro Karsz,
Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Richard Cochran, Mark Brown, David Lechner, Uwe Kleine-König,
Damien Le Moal, Hannes Reinecke, Chaitanya Kulkarni, linux-doc,
linux-kernel, linux-block, linux-fpga, linux-gpio, netdev,
linux-stm32, linux-arm-kernel, linux-pci, virtualization
On Thu, 2024-08-22 at 17:44 +0300, Andy Shevchenko wrote:
> On Thu, Aug 22, 2024 at 03:47:37PM +0200, Philipp Stanner wrote:
> > pcim_iomap_regions() and pcim_iomap_table() have been deprecated by
> > the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
> > pcim_iomap_table(), pcim_iomap_regions_request_all()").
> >
> > Replace these functions with the function pcim_iomap_region().
>
> ...
>
> > - err = pcim_iomap_regions(pdev, 1 << PCI_PTP_BAR_NO,
> > pci_name(pdev));
> > - if (err)
> > + clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO,
> > pci_name(pdev));
> > + if (IS_ERR(clock->reg_base)) {
> > + err = PTR_ERR(clock->reg_base);
> > goto error_free;
> > -
> > - clock->reg_base = pcim_iomap_table(pdev)[PCI_PTP_BAR_NO];
> > + }
>
> Perhaps
>
> clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO,
> pci_name(pdev));
> err = PTR_ERR_OR_ZERO(clock->reg_base);
> if (err)
> goto error_free;
>
> This will make your patch smaller and neater.
>
> P.S. Do you use --histogram diff algo when preparing patches?
So far not.
Should one do that?
P.
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 5/9] ethernet: cavium: Replace deprecated PCI functions
2024-08-26 14:51 ` Philipp Stanner
@ 2024-08-26 15:41 ` Andy Shevchenko
2024-08-26 15:52 ` Philipp Stanner
0 siblings, 1 reply; 24+ messages in thread
From: Andy Shevchenko @ 2024-08-26 15:41 UTC (permalink / raw)
To: Philipp Stanner
Cc: Andy Shevchenko, Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix,
Moritz Fischer, Xu Yilun, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Damien Le Moal, Hannes Reinecke,
Chaitanya Kulkarni, linux-doc, linux-kernel, linux-block,
linux-fpga, linux-gpio, netdev, linux-stm32, linux-arm-kernel,
linux-pci, virtualization
On Mon, Aug 26, 2024 at 5:51 PM Philipp Stanner <pstanner@redhat.com> wrote:
> On Thu, 2024-08-22 at 17:44 +0300, Andy Shevchenko wrote:
> > On Thu, Aug 22, 2024 at 03:47:37PM +0200, Philipp Stanner wrote:
...
> > > - err = pcim_iomap_regions(pdev, 1 << PCI_PTP_BAR_NO,
> > > pci_name(pdev));
> > > - if (err)
> > > + clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO,
> > > pci_name(pdev));
> > > + if (IS_ERR(clock->reg_base)) {
> > > + err = PTR_ERR(clock->reg_base);
> > > goto error_free;
> > > -
> > > - clock->reg_base = pcim_iomap_table(pdev)[PCI_PTP_BAR_NO];
> > > + }
> >
> > Perhaps
> >
> > clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO,
> > pci_name(pdev));
> > err = PTR_ERR_OR_ZERO(clock->reg_base);
> > if (err)
> > goto error_free;
> >
> > This will make your patch smaller and neater.
> >
> > P.S. Do you use --histogram diff algo when preparing patches?
>
> So far not.
> Should one do that?
Id doesn't alter your code, it's in addition to what I suggested, but
as Linus shared that there is no reason to avoid using --histogram not
only in Linux kernel, but in general as it produces more
human-readable diff:s.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 5/9] ethernet: cavium: Replace deprecated PCI functions
2024-08-26 15:41 ` Andy Shevchenko
@ 2024-08-26 15:52 ` Philipp Stanner
2024-08-26 17:12 ` Andy Shevchenko
0 siblings, 1 reply; 24+ messages in thread
From: Philipp Stanner @ 2024-08-26 15:52 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Andy Shevchenko, Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix,
Moritz Fischer, Xu Yilun, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Damien Le Moal, Hannes Reinecke,
Chaitanya Kulkarni, linux-doc, linux-kernel, linux-block,
linux-fpga, linux-gpio, netdev, linux-stm32, linux-arm-kernel,
linux-pci, virtualization
On Mon, 2024-08-26 at 18:41 +0300, Andy Shevchenko wrote:
> On Mon, Aug 26, 2024 at 5:51 PM Philipp Stanner <pstanner@redhat.com>
> wrote:
> > On Thu, 2024-08-22 at 17:44 +0300, Andy Shevchenko wrote:
> > > On Thu, Aug 22, 2024 at 03:47:37PM +0200, Philipp Stanner wrote:
>
> ...
>
> > > > - err = pcim_iomap_regions(pdev, 1 << PCI_PTP_BAR_NO,
> > > > pci_name(pdev));
> > > > - if (err)
> > > > + clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO,
> > > > pci_name(pdev));
> > > > + if (IS_ERR(clock->reg_base)) {
> > > > + err = PTR_ERR(clock->reg_base);
> > > > goto error_free;
> > > > -
> > > > - clock->reg_base = pcim_iomap_table(pdev)[PCI_PTP_BAR_NO];
> > > > + }
> > >
> > > Perhaps
> > >
> > > clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO,
> > > pci_name(pdev));
> > > err = PTR_ERR_OR_ZERO(clock->reg_base);
> > > if (err)
> > > goto error_free;
> > >
> > > This will make your patch smaller and neater.
> > >
> > > P.S. Do you use --histogram diff algo when preparing patches?
> >
> > So far not.
> > Should one do that?
>
> Id doesn't alter your code, it's in addition to what I suggested, but
> as Linus shared that there is no reason to avoid using --histogram
> not
> only in Linux kernel, but in general as it produces more
> human-readable diff:s.
If the Boss says so, one can surely do that \o/
Though if it has 0 disadvantages I'd propose proposing to the git-devs
to make it the default.
P.
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 5/9] ethernet: cavium: Replace deprecated PCI functions
2024-08-26 15:52 ` Philipp Stanner
@ 2024-08-26 17:12 ` Andy Shevchenko
0 siblings, 0 replies; 24+ messages in thread
From: Andy Shevchenko @ 2024-08-26 17:12 UTC (permalink / raw)
To: Philipp Stanner
Cc: Andy Shevchenko, Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix,
Moritz Fischer, Xu Yilun, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Damien Le Moal, Hannes Reinecke,
Chaitanya Kulkarni, linux-doc, linux-kernel, linux-block,
linux-fpga, linux-gpio, netdev, linux-stm32, linux-arm-kernel,
linux-pci, virtualization
On Mon, Aug 26, 2024 at 6:52 PM Philipp Stanner <pstanner@redhat.com> wrote:
> On Mon, 2024-08-26 at 18:41 +0300, Andy Shevchenko wrote:
...
> Though if it has 0 disadvantages I'd propose proposing to the git-devs
> to make it the default.
It's slower. so the people from https://occ.deadnet.se/about/ won't be happy.
And more power consuming, so maybe not so environment friendly after all :-P
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions
2024-08-22 13:47 ` [PATCH v3 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions Philipp Stanner
@ 2024-08-27 3:28 ` Xu Yilun
0 siblings, 0 replies; 24+ messages in thread
From: Xu Yilun @ 2024-08-27 3:28 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jonathan Corbet, Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer,
Xu Yilun, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Bjorn Helgaas,
Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Richard Cochran, Mark Brown, David Lechner,
Uwe Kleine-König, Damien Le Moal, Hannes Reinecke,
Chaitanya Kulkarni, linux-doc, linux-kernel, linux-block,
linux-fpga, linux-gpio, netdev, linux-stm32, linux-arm-kernel,
linux-pci, virtualization
On Thu, Aug 22, 2024 at 03:47:34PM +0200, Philipp Stanner wrote:
> pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the
> PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
> pcim_iomap_table(), pcim_iomap_regions_request_all()").
>
> Port dfl-pci.c to the successor, pcim_iomap_region().
>
> Consistently, replace pcim_iounmap_regions() with pcim_iounmap_region().
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2024-08-27 3:31 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 13:47 [PATCH v3 0/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 1/9] PCI: Make pcim_iounmap_region() a public function Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions Philipp Stanner
2024-08-27 3:28 ` Xu Yilun
2024-08-22 13:47 ` [PATCH v3 3/9] block: mtip32xx: " Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 4/9] gpio: " Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 5/9] ethernet: cavium: " Philipp Stanner
2024-08-22 14:44 ` Andy Shevchenko
2024-08-26 14:51 ` Philipp Stanner
2024-08-26 15:41 ` Andy Shevchenko
2024-08-26 15:52 ` Philipp Stanner
2024-08-26 17:12 ` Andy Shevchenko
2024-08-22 13:47 ` [PATCH v3 6/9] ethernet: stmicro: Simplify PCI devres usage Philipp Stanner
2024-08-22 14:46 ` Andy Shevchenko
2024-08-23 9:29 ` Serge Semin
2024-08-26 6:30 ` Philipp Stanner
2024-08-22 13:47 ` [PATCH v3 7/9] vdpa: solidrun: Fix UB bug with devres Philipp Stanner
2024-08-22 14:34 ` Christophe JAILLET
2024-08-26 6:55 ` Philipp Stanner
2024-08-22 14:47 ` Andy Shevchenko
2024-08-22 13:47 ` [PATCH v3 8/9] vdap: solidrun: Replace deprecated PCI functions Philipp Stanner
2024-08-22 14:49 ` Andy Shevchenko
2024-08-22 13:47 ` [PATCH v3 9/9] PCI: Remove pcim_iounmap_regions() Philipp Stanner
2024-08-22 14:50 ` [PATCH v3 0/9] " Andy Shevchenko
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).