All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ahci: asm1064: correct count of reported ports
@ 2024-02-14 16:57 Niklas Cassel
  2024-02-14 17:24 ` Andrey Melnikov
  2024-02-19  9:30 ` Niklas Cassel
  0 siblings, 2 replies; 5+ messages in thread
From: Niklas Cassel @ 2024-02-14 16:57 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel; +Cc: Andrey Jr. Melnikov, linux-ide

From: "Andrey Jr. Melnikov" <temnota.am@gmail.com>

The ASM1064 SATA host controller always reports wrongly,
that it has 24 ports. But in reality, it only has four ports.

before:
ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xffff0f impl SATA mode
ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst

after:
ahci 0000:04:00.0: ASM1064 has only four ports
ahci 0000:04:00.0: forcing port_map 0xffff0f -> 0xf
ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xf impl SATA mode
ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst

Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
Changes since V1: use switch case.

 drivers/ata/ahci.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index da2e74fce2d9..682ff550ccfb 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -671,9 +671,17 @@ MODULE_PARM_DESC(mobile_lpm_policy, "Default LPM policy for mobile chipsets");
 static void ahci_pci_save_initial_config(struct pci_dev *pdev,
 					 struct ahci_host_priv *hpriv)
 {
-	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && pdev->device == 0x1166) {
-		dev_info(&pdev->dev, "ASM1166 has only six ports\n");
-		hpriv->saved_port_map = 0x3f;
+	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA) {
+		switch (pdev->device) {
+		case 0x1166:
+			dev_info(&pdev->dev, "ASM1166 has only six ports\n");
+			hpriv->saved_port_map = 0x3f;
+			break;
+		case 0x1064:
+			dev_info(&pdev->dev, "ASM1064 has only four ports\n");
+			hpriv->saved_port_map = 0xf;
+			break;
+		}
 	}
 
 	if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ahci: asm1064: correct count of reported ports
  2024-02-14 16:57 [PATCH v2] ahci: asm1064: correct count of reported ports Niklas Cassel
@ 2024-02-14 17:24 ` Andrey Melnikov
  2024-02-14 18:13   ` Niklas Cassel
  2024-02-19  9:30 ` Niklas Cassel
  1 sibling, 1 reply; 5+ messages in thread
From: Andrey Melnikov @ 2024-02-14 17:24 UTC (permalink / raw)
  To: Niklas Cassel; +Cc: Damien Le Moal, linux-ide

ср, 14 февр. 2024 г. в 19:58, Niklas Cassel <cassel@kernel.org>:
>
> From: "Andrey Jr. Melnikov" <temnota.am@gmail.com>
>
> The ASM1064 SATA host controller always reports wrongly,
> that it has 24 ports. But in reality, it only has four ports.
>
> before:
> ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
> ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xffff0f impl SATA mode
> ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst
>
> after:
> ahci 0000:04:00.0: ASM1064 has only four ports
> ahci 0000:04:00.0: forcing port_map 0xffff0f -> 0xf
> ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
> ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xf impl SATA mode
> ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst
>
> Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
> Changes since V1: use switch case.

I think we should stop abusing saved_port_map and convert all quirk's
to use mask_port_map.

>  drivers/ata/ahci.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index da2e74fce2d9..682ff550ccfb 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -671,9 +671,17 @@ MODULE_PARM_DESC(mobile_lpm_policy, "Default LPM policy for mobile chipsets");
>  static void ahci_pci_save_initial_config(struct pci_dev *pdev,
>                                          struct ahci_host_priv *hpriv)
>  {
> -       if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && pdev->device == 0x1166) {
> -               dev_info(&pdev->dev, "ASM1166 has only six ports\n");
> -               hpriv->saved_port_map = 0x3f;
> +       if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA) {
> +               switch (pdev->device) {
> +               case 0x1166:
> +                       dev_info(&pdev->dev, "ASM1166 has only six ports\n");
> +                       hpriv->saved_port_map = 0x3f;
> +                       break;
> +               case 0x1064:
> +                       dev_info(&pdev->dev, "ASM1064 has only four ports\n");
> +                       hpriv->saved_port_map = 0xf;
> +                       break;
> +               }
>         }
>
>         if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) {
> --
> 2.43.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ahci: asm1064: correct count of reported ports
  2024-02-14 17:24 ` Andrey Melnikov
@ 2024-02-14 18:13   ` Niklas Cassel
  0 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2024-02-14 18:13 UTC (permalink / raw)
  To: Andrey Melnikov; +Cc: Damien Le Moal, linux-ide

Hello Andrey,

On Wed, Feb 14, 2024 at 08:24:25PM +0300, Andrey Melnikov wrote:
> ср, 14 февр. 2024 г. в 19:58, Niklas Cassel <cassel@kernel.org>:
> >
> > From: "Andrey Jr. Melnikov" <temnota.am@gmail.com>
> >
> > The ASM1064 SATA host controller always reports wrongly,
> > that it has 24 ports. But in reality, it only has four ports.
> >
> > before:
> > ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
> > ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xffff0f impl SATA mode
> > ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst
> >
> > after:
> > ahci 0000:04:00.0: ASM1064 has only four ports
> > ahci 0000:04:00.0: forcing port_map 0xffff0f -> 0xf
> > ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
> > ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xf impl SATA mode
> > ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst
> >
> > Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
> > Signed-off-by: Niklas Cassel <cassel@kernel.org>
> > ---
> > Changes since V1: use switch case.
> 
> I think we should stop abusing saved_port_map and convert all quirk's
> to use mask_port_map.

That sounds like a great idea to me.
Do you plan to send some patches?

If so, I could hold off this patch until I get something from you.


Kind regards,
Niklas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ahci: asm1064: correct count of reported ports
  2024-02-14 16:57 [PATCH v2] ahci: asm1064: correct count of reported ports Niklas Cassel
  2024-02-14 17:24 ` Andrey Melnikov
@ 2024-02-19  9:30 ` Niklas Cassel
  2024-02-19 10:37   ` Niklas Cassel
  1 sibling, 1 reply; 5+ messages in thread
From: Niklas Cassel @ 2024-02-19  9:30 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Andrey Jr. Melnikov, linux-ide

On Wed, Feb 14, 2024 at 05:57:57PM +0100, Niklas Cassel wrote:
> From: "Andrey Jr. Melnikov" <temnota.am@gmail.com>
> 
> The ASM1064 SATA host controller always reports wrongly,
> that it has 24 ports. But in reality, it only has four ports.
> 
> before:
> ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
> ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xffff0f impl SATA mode
> ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst
> 
> after:
> ahci 0000:04:00.0: ASM1064 has only four ports
> ahci 0000:04:00.0: forcing port_map 0xffff0f -> 0xf
> ahci 0000:04:00.0: SSS flag set, parallel bus scan disabled
> ahci 0000:04:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xf impl SATA mode
> ahci 0000:04:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst
> 
> Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---

While I agree with Andrey that we should change the quirks that use
saved_port_map to instead use force_port_map (so that we don't have
two different ways to apply port_map quirks), that clean up can be
done on top of this fix.

---

Applied:
https://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git/log/?h=for-6.8-fixes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ahci: asm1064: correct count of reported ports
  2024-02-19  9:30 ` Niklas Cassel
@ 2024-02-19 10:37   ` Niklas Cassel
  0 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2024-02-19 10:37 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Andrey Jr. Melnikov, linux-ide

On Mon, Feb 19, 2024 at 10:30:07AM +0100, Niklas Cassel wrote:
> On Wed, Feb 14, 2024 at 05:57:57PM +0100, Niklas Cassel wrote:

(snip)

> While I agree with Andrey that we should change the quirks that use
> saved_port_map to instead use force_port_map (so that we don't have
> two different ways to apply port_map quirks), that clean up can be
> done on top of this fix.

s/force_port_map/mask_port_map/

(force_port_map was the third way of applying these quirks,
but it has been removed already.)


Kind regards,
Niklas

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-19 10:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14 16:57 [PATCH v2] ahci: asm1064: correct count of reported ports Niklas Cassel
2024-02-14 17:24 ` Andrey Melnikov
2024-02-14 18:13   ` Niklas Cassel
2024-02-19  9:30 ` Niklas Cassel
2024-02-19 10:37   ` Niklas Cassel

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.