All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: 李佑鸿 <dayou5941@163.com>
Cc: dlemoal@kernel.org, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org, liyouhong@kylinos.cn
Subject: Re: Re: Re: [PATCH] ata: libahci: fix panic when accessing ports beyond MMIO region
Date: Fri, 24 Apr 2026 13:07:23 +0200	[thread overview]
Message-ID: <aetO6yuzx5MZF-ZZ@ryzen> (raw)
In-Reply-To: <26f59adf.571d.19dbe310f41.Coremail.dayou5941@163.com>

On Fri, Apr 24, 2026 at 02:32:59PM +0800, 李佑鸿  wrote:
> However, in the following code:
> cap = readl(mmio + HOST_CAP); /* When cap = 0xFFFFFFFF */
> if (hpriv->saved_cap)
>     cap = (cap & ~(HOST_CAP_SSS | HOST_CAP_MPS)) | hpriv->saved_cap; /* When hpriv->saved_cap = 0xEF36FF81 */

Sorry for that. From the name hpriv->saved_cap, I assumed that it would
actually override hpriv->cap, but it seems that it only allows you to
set additional caps, not to override/clear caps that are broken...

I guess we could theoretically do:

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 1d73a53370cf..94c3c740134a 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -2003,6 +2003,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        if (pdev->vendor == 0x177d && pdev->device == 0xa01c)
                hpriv->irq_handler = ahci_thunderx_irq_handler;
+
+       /* Phytium SATA controller has bogus CAP register */
+       if (pdev->vendor == 0x1db7 && pdev->device == 0xd001)
+               writel(0xEF36FF81, hpriv->mmio + HOST_CAP);
 #endif
 
        /* save initial config */



However, that said, I agree with Damien, I think a better solution is to
fail the probe(). Will reply to that mail with more details.


Kind regards,
Niklas

  parent reply	other threads:[~2026-04-24 11:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22  8:03 [PATCH] ata: libahci: fix panic when accessing ports beyond MMIO region dayou5941
2026-04-22 14:36 ` Niklas Cassel
     [not found]   ` <55809835.8838.19db9be1205.Coremail.dayou5941@163.com>
2026-04-23 17:19     ` Niklas Cassel
2026-04-24  2:43       ` Damien Le Moal
     [not found]         ` <13d7d471.6389.19dbe594e14.Coremail.dayou5941@163.com>
2026-04-24 11:07           ` Niklas Cassel
2026-04-24 11:15             ` Damien Le Moal
2026-04-25  6:15             ` Re:Re: " 李佑鸿 
     [not found]       ` <26f59adf.571d.19dbe310f41.Coremail.dayou5941@163.com>
2026-04-24 11:07         ` Niklas Cassel [this message]
2026-04-30  0:59 ` kernel test robot
2026-04-30 12:48   ` Niklas Cassel

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=aetO6yuzx5MZF-ZZ@ryzen \
    --to=cassel@kernel.org \
    --cc=dayou5941@163.com \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liyouhong@kylinos.cn \
    /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.