From: Sasha Levin Date: Tue, 5 Nov 2024 10:19:38 +0000 (-0500) Subject: Drop net-hns3-add-sync-command-to-sync-io-pgtable.patch X-Git-Tag: v4.19.323~95 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=91ce7567b12d33d55266b04936ad333105279c4a;p=thirdparty%2Fkernel%2Fstable-queue.git Drop net-hns3-add-sync-command-to-sync-io-pgtable.patch Signed-off-by: Sasha Levin --- diff --git a/queue-6.11/net-hns3-add-sync-command-to-sync-io-pgtable.patch b/queue-6.11/net-hns3-add-sync-command-to-sync-io-pgtable.patch deleted file mode 100644 index d8092b18f59..00000000000 --- a/queue-6.11/net-hns3-add-sync-command-to-sync-io-pgtable.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0ea8c71561bc40a678c7bf15e081737e1f2d15e2 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 25 Oct 2024 17:29:31 +0800 -Subject: net: hns3: add sync command to sync io-pgtable - -From: Jian Shen - -[ Upstream commit f2c14899caba76da93ff3fff46b4d5a8f43ce07e ] - -To avoid errors in pgtable prefectch, add a sync command to sync -io-pagtable. - -This is a supplement for the previous patch. -We want all the tx packet can be handled with tx bounce buffer path. -But it depends on the remain space of the spare buffer, checked by the -hns3_can_use_tx_bounce(). In most cases, maybe 99.99%, it returns true. -But once it return false by no available space, the packet will be handled -with the former path, which will map/unmap the skb buffer. -Then the driver will face the smmu prefetch risk again. - -So add a sync command in this case to avoid smmu prefectch, -just protects corner scenes. - -Fixes: 295ba232a8c3 ("net: hns3: add device version to replace pci revision") -Signed-off-by: Jian Shen -Signed-off-by: Peiyang Wang -Signed-off-by: Jijie Shao -Signed-off-by: Paolo Abeni -Signed-off-by: Sasha Levin ---- - .../net/ethernet/hisilicon/hns3/hns3_enet.c | 27 +++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -index ac88e301f2211..8760b4e9ade6b 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -@@ -381,6 +381,24 @@ static const struct hns3_rx_ptype hns3_rx_ptype_tbl[] = { - #define HNS3_INVALID_PTYPE \ - ARRAY_SIZE(hns3_rx_ptype_tbl) - -+static void hns3_dma_map_sync(struct device *dev, unsigned long iova) -+{ -+ struct iommu_domain *domain = iommu_get_domain_for_dev(dev); -+ struct iommu_iotlb_gather iotlb_gather; -+ size_t granule; -+ -+ if (!domain || !iommu_is_dma_domain(domain)) -+ return; -+ -+ granule = 1 << __ffs(domain->pgsize_bitmap); -+ iova = ALIGN_DOWN(iova, granule); -+ iotlb_gather.start = iova; -+ iotlb_gather.end = iova + granule - 1; -+ iotlb_gather.pgsize = granule; -+ -+ iommu_iotlb_sync(domain, &iotlb_gather); -+} -+ - static irqreturn_t hns3_irq_handle(int irq, void *vector) - { - struct hns3_enet_tqp_vector *tqp_vector = vector; -@@ -1728,7 +1746,9 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv, - unsigned int type) - { - struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; -+ struct hnae3_handle *handle = ring->tqp->handle; - struct device *dev = ring_to_dev(ring); -+ struct hnae3_ae_dev *ae_dev; - unsigned int size; - dma_addr_t dma; - -@@ -1760,6 +1780,13 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv, - return -ENOMEM; - } - -+ /* Add a SYNC command to sync io-pgtale to avoid errors in pgtable -+ * prefetch -+ */ -+ ae_dev = hns3_get_ae_dev(handle); -+ if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) -+ hns3_dma_map_sync(dev, dma); -+ - desc_cb->priv = priv; - desc_cb->length = size; - desc_cb->dma = dma; --- -2.43.0 - diff --git a/queue-6.11/series b/queue-6.11/series index ccfd7bc73d9..2cee7ba86bd 100644 --- a/queue-6.11/series +++ b/queue-6.11/series @@ -54,7 +54,6 @@ mlxsw-spectrum_ipip-fix-memory-leak-when-changing-re.patch net-ethernet-mtk_wed-fix-path-of-mt7988-wo-firmware.patch netfilter-nft_payload-sanitize-offset-and-length-bef.patch net-hns3-default-enable-tx-bounce-buffer-when-smmu-e.patch -net-hns3-add-sync-command-to-sync-io-pgtable.patch net-hns3-fixed-reset-failure-issues-caused-by-the-in.patch net-hns3-fix-missing-features-due-to-dev-features-co.patch net-hns3-resolved-the-issue-that-the-debugfs-query-r.patch diff --git a/queue-6.6/net-hns3-add-sync-command-to-sync-io-pgtable.patch b/queue-6.6/net-hns3-add-sync-command-to-sync-io-pgtable.patch deleted file mode 100644 index bd6528d2279..00000000000 --- a/queue-6.6/net-hns3-add-sync-command-to-sync-io-pgtable.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 98cb88cce78da8a369cf780343d0280f9d3af4ca Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 25 Oct 2024 17:29:31 +0800 -Subject: net: hns3: add sync command to sync io-pgtable - -From: Jian Shen - -[ Upstream commit f2c14899caba76da93ff3fff46b4d5a8f43ce07e ] - -To avoid errors in pgtable prefectch, add a sync command to sync -io-pagtable. - -This is a supplement for the previous patch. -We want all the tx packet can be handled with tx bounce buffer path. -But it depends on the remain space of the spare buffer, checked by the -hns3_can_use_tx_bounce(). In most cases, maybe 99.99%, it returns true. -But once it return false by no available space, the packet will be handled -with the former path, which will map/unmap the skb buffer. -Then the driver will face the smmu prefetch risk again. - -So add a sync command in this case to avoid smmu prefectch, -just protects corner scenes. - -Fixes: 295ba232a8c3 ("net: hns3: add device version to replace pci revision") -Signed-off-by: Jian Shen -Signed-off-by: Peiyang Wang -Signed-off-by: Jijie Shao -Signed-off-by: Paolo Abeni -Signed-off-by: Sasha Levin ---- - .../net/ethernet/hisilicon/hns3/hns3_enet.c | 27 +++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -index 1f9bbf13214fb..bfcebf4e235ef 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -@@ -381,6 +381,24 @@ static const struct hns3_rx_ptype hns3_rx_ptype_tbl[] = { - #define HNS3_INVALID_PTYPE \ - ARRAY_SIZE(hns3_rx_ptype_tbl) - -+static void hns3_dma_map_sync(struct device *dev, unsigned long iova) -+{ -+ struct iommu_domain *domain = iommu_get_domain_for_dev(dev); -+ struct iommu_iotlb_gather iotlb_gather; -+ size_t granule; -+ -+ if (!domain || !iommu_is_dma_domain(domain)) -+ return; -+ -+ granule = 1 << __ffs(domain->pgsize_bitmap); -+ iova = ALIGN_DOWN(iova, granule); -+ iotlb_gather.start = iova; -+ iotlb_gather.end = iova + granule - 1; -+ iotlb_gather.pgsize = granule; -+ -+ iommu_iotlb_sync(domain, &iotlb_gather); -+} -+ - static irqreturn_t hns3_irq_handle(int irq, void *vector) - { - struct hns3_enet_tqp_vector *tqp_vector = vector; -@@ -1728,7 +1746,9 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv, - unsigned int type) - { - struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; -+ struct hnae3_handle *handle = ring->tqp->handle; - struct device *dev = ring_to_dev(ring); -+ struct hnae3_ae_dev *ae_dev; - unsigned int size; - dma_addr_t dma; - -@@ -1760,6 +1780,13 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv, - return -ENOMEM; - } - -+ /* Add a SYNC command to sync io-pgtale to avoid errors in pgtable -+ * prefetch -+ */ -+ ae_dev = hns3_get_ae_dev(handle); -+ if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) -+ hns3_dma_map_sync(dev, dma); -+ - desc_cb->priv = priv; - desc_cb->length = size; - desc_cb->dma = dma; --- -2.43.0 - diff --git a/queue-6.6/series b/queue-6.6/series index 6ad195094f6..a0fe05acfa8 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -38,7 +38,6 @@ mlxsw-spectrum_ptp-add-missing-verification-before-p.patch mlxsw-spectrum_ipip-fix-memory-leak-when-changing-re.patch netfilter-nft_payload-sanitize-offset-and-length-bef.patch net-hns3-default-enable-tx-bounce-buffer-when-smmu-e.patch -net-hns3-add-sync-command-to-sync-io-pgtable.patch net-hns3-fix-missing-features-due-to-dev-features-co.patch net-hns3-resolved-the-issue-that-the-debugfs-query-r.patch net-hns3-don-t-auto-enable-misc-vector.patch