From: Niklas Cassel <cassel@kernel.org>
To: Huacai Chen <chenhuacai@loongson.cn>
Cc: Damien Le Moal <dlemoal@kernel.org>,
linux-ide@vger.kernel.org, Huacai Chen <chenhuacai@kernel.org>,
Xuerui Wang <kernel@xen0n.name>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ahci: Marvell controllers prefer DMA for ATAPI
Date: Mon, 9 Sep 2024 09:38:16 +0200 [thread overview]
Message-ID: <Zt6l6DVeDGzb5W7N@ryzen.lan> (raw)
In-Reply-To: <20240908094604.433035-1-chenhuacai@loongson.cn>
On Sun, Sep 08, 2024 at 05:46:04PM +0800, Huacai Chen wrote:
> We use Marvell CD/DVD controllers on many Loongson-based machines. We
> found its PIO doesn't work well, and on the opposite its DMA seems work
> very well. We don't know the detail of the controller, but we can set
> the ATA_FLAG_ATAPI_DMA and ATA_HORKAGE_ATAPI_MOD16_DMA flags on these
> controllers to prefer ATAPI DMA.
>
> BTW, return -EOPNOTSUPP instead of 1 if ATAPI DMA is not supported in
> atapi_check_dma().
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> drivers/ata/ahci.c | 3 +++
> drivers/ata/libata-core.c | 6 +++++-
> include/linux/libata.h | 1 +
> 3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index a05c17249448..b195e87e7109 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1939,6 +1939,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
> if (hpriv->cap & HOST_CAP_PMP)
> pi.flags |= ATA_FLAG_PMP;
>
> + if (pdev->vendor == PCI_VENDOR_ID_MARVELL_EXT)
> + pi.flags |= ATA_FLAG_ATAPI_DMA;
> +
Hello Huacai,
You are not providing a lot of information about:
1) The SATA controller.
2) The CD/DVD drive that you are using.
For 1), since you are patching ahci_init_one(), it appears to be a
AHCI controller from Marvell.
However, we do not write quirks that affect all PCI device IDs
for a specific vendor.
Please define a new board type in "enum board_ids" in ahci.c, e.g.
something like board_ahci_atapi_force_dma or board_ahci_atapi_prefer_dma,
and then add specific PCI vendor IDs and device IDs in ahci_pci_tbl that
should apply this quirk.
For 2), you are not giving us any information, so have you verified that
this problem happens with more than one specific CD/DVD drive model?
It would be interesting to know if the problem exists even if you
are using CD/DVD drives from different vendors.
If the problem is only for a specific drive model, then perhaps this
shouldn't be a controller quirk, but rather a device quirk?
Device specific quirks are defined in __ata_dev_quirks in libata-core.c.
Kind regards,
Niklas
next prev parent reply other threads:[~2024-09-09 7:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-08 9:46 [PATCH] ahci: Marvell controllers prefer DMA for ATAPI Huacai Chen
2024-09-09 7:38 ` Niklas Cassel [this message]
2024-09-09 7:47 ` Niklas Cassel
2025-02-17 7:01 ` WangYuli
2025-02-17 11:29 ` Niklas Cassel
2025-02-17 13:30 ` Huacai Chen
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=Zt6l6DVeDGzb5W7N@ryzen.lan \
--to=cassel@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=dlemoal@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox