From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: linux-pci@vger.kernel.org, ntb@lists.linux.dev
Subject: Re: [PATCH v9 02/10] PCI: dwc: Expose endpoint DMA resources
Date: Tue, 10 Nov 2026 08:50:12 +0000 [thread overview]
Message-ID: <sashiko-outbox-206666@kernel.org> (raw)
In-Reply-To: <20261110082459.1798763-3-den@valinux.co.jp>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] PCI: dwc: stale edma->dw in dw_pcie_ep_get_aux_resources()
after eDMA removal
--
commit 2170b2570701b4b321fbbb9a308f0eed9f7a8dda
Author: Koichiro Den <den@valinux.co.jp>
PCI: dwc: Expose endpoint DMA resources
This commit exposes the endpoint-integrated eDMA register window and
linked-list memory through the EPC auxiliary resource API, gated on the
local dw-edma device being registered.
> diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
> index 630ba172280c2..7166ec7f212bd 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
> @@ -858,6 +858,15 @@ dw_pcie_ep_find_bar_rsvd_region(struct dw_pcie_ep *ep,
> return NULL;
> }
>
> +static int dw_pcie_ep_check_edma_vfunc(u8 vfunc_no)
> +{
> + /*
> + * The DWC endpoint databook says it is not possible to assign the
> + * DMA/HDMA registers to any Virtual Function.
> + */
> + return vfunc_no ? -EOPNOTSUPP : 0;
> +}
> +
> static int
> dw_pcie_ep_get_aux_resources_count(struct pci_epc *epc, u8 func_no,
> u8 vfunc_no)
> @@ -865,14 +874,30 @@ dw_pcie_ep_get_aux_resources_count(struct pci_epc *epc, u8 func_no,
> struct dw_pcie_ep *ep = epc_get_drvdata(epc);
> struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> struct dw_edma_chip *edma = &pci->edma;
> + u16 ll_wr_cnt, ll_rd_cnt;
> + int count = 0;
> + int ret;
>
> if (!pci->edma_reg_size)
> return 0;
>
> - if (edma->db_offset == ~0)
> + ret = dw_pcie_ep_check_edma_vfunc(vfunc_no);
> + if (ret)
> + return ret;
> +
> + if (!edma->dw)
> return 0;
[Severity: Medium]
Can edma->dw remain a non-NULL stale pointer here (and in
dw_pcie_ep_get_aux_resources()) after the local dw-edma device is removed?
dw_edma_probe() sets chip->dw = dw, but when the device is torn down via
dw_pcie_edma_remove() -> dw_edma_remove() (for example, on the
err_remove_edma error path in dw_pcie_ep_init_registers() or during a
PERST# reset in dw_pcie_ep_cleanup()), neither function clears chip->dw.
While dw_edma_emul_irq_free() resets db_offset to ~0, the
PCI_EPC_AUX_DMA_CTRL_MMIO and PCI_EPC_AUX_DMA_DESC_MEM resources only check
!edma->dw and !edma->cfg_non_ll, so callers will still receive DMA control
and linked-list resources for an unregistered dw-edma device.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110082459.1798763-1-den@valinux.co.jp?part=2
next prev parent reply other threads:[~2026-11-10 8:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 8:24 [PATCH v9 00/10] PCI: endpoint: Remote DMA support via vNTB Koichiro Den
2026-11-10 8:24 ` [PATCH v9 01/10] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
2026-11-10 8:32 ` sashiko-bot
2026-11-10 8:24 ` [PATCH v9 02/10] PCI: dwc: Expose endpoint DMA resources Koichiro Den
2026-11-10 8:50 ` sashiko-bot [this message]
2026-11-10 14:41 ` Koichiro Den
2026-11-10 8:24 ` [PATCH v9 03/10] PCI: endpoint: pci-epf-vntb: Move epf_ntb_is_bar_used() up Koichiro Den
2026-11-10 8:31 ` sashiko-bot
2026-11-10 8:24 ` [PATCH v9 04/10] PCI: endpoint: Add pci-epf-ntb.h for the shared NTB control layout Koichiro Den
2026-11-10 8:28 ` sashiko-bot
2026-11-10 8:24 ` [PATCH v9 05/10] PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels Koichiro Den
2026-11-10 8:50 ` sashiko-bot
2026-11-10 8:24 ` [PATCH v9 06/10] PCI: endpoint: pci-epf-vntb: Allow DMA and MW to share a BAR Koichiro Den
2026-11-10 8:57 ` sashiko-bot
2026-11-10 15:00 ` Frank Li
2026-11-10 8:24 ` [PATCH v9 07/10] Documentation: PCI: endpoint: Document vNTB DMA export Koichiro Den
2026-11-10 8:33 ` sashiko-bot
2026-11-10 8:24 ` [PATCH v9 08/10] NTB: ntb_hw_epf: Use the shared NTB control layout Koichiro Den
2026-11-10 8:38 ` sashiko-bot
2026-11-10 8:24 ` [PATCH v9 09/10] NTB: ntb_hw_epf: Discover vNTB-embedded DMA Koichiro Den
2026-11-10 8:58 ` sashiko-bot
2026-11-10 15:40 ` Koichiro Den
2026-11-10 8:24 ` [PATCH v9 10/10] NTB: ntb_hw_epf: Support DMA and MW sharing a BAR Koichiro Den
2026-11-10 8:52 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-206666@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=den@valinux.co.jp \
--cc=linux-pci@vger.kernel.org \
--cc=ntb@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.