From: Niklas Cassel <cassel@kernel.org>
To: Szuying Chen <chensiying21@gmail.com>,
"Jesse1_Chang@asmedia.com.tw" <Jesse1_Chang@asmedia.com.tw>,
"Richard_Hsu@asmedia.com.tw" <Richard_Hsu@asmedia.com.tw>,
Szuying Chen <Chloe_Chen@asmedia.com.tw>
Cc: Lennert Buytenhek <kernel@wantstofly.org>,
Damien Le Moal <dlemoal@kernel.org>,
linux-ide@vger.kernel.org
Subject: Re: ASMedia ASM1062 (AHCI) hang after "ahci 0000:28:00.0: Using 64-bit DMA addresses"
Date: Wed, 24 Jan 2024 11:41:18 +0100 [thread overview]
Message-ID: <ZbDpTrt0lU/llRMp@x1-carbon> (raw)
In-Reply-To: <ZbDjL0TDnUfzknZS@x1-carbon>
Hello ASMedia guys,
It seems like ASMedia ASM1061 does not work with recent Linux kernel versions:
https://lore.kernel.org/linux-ide/ZbAo_LqpbiGMfTtW@wantstofly.org/T/#m2e12f7f0060f0f6cbf3fcb9ec8eecc2c1d1b5799
Lennert on the linux-ide mailing list has done some detective work that
strongly suggests that ASMedia ASM1061 ignores the upper 21 bits of all
DMA addresses.
See full analysis here:
https://lore.kernel.org/linux-ide/ZbAo_LqpbiGMfTtW@wantstofly.org/T/#m02d07243492868085b56c6173efe42e814359017
Basically he modifies libahci.c:
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1667,6 +1667,12 @@ static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl)
dma_addr_t addr = sg_dma_address(sg);
u32 sg_len = sg_dma_len(sg);
+ printk(KERN_INFO "mapping dma_address=%.16lx sg_len=%.8lx dma_dir=%d\n",
+ (unsigned long)addr, (unsigned long)sg_len, qc->dma_dir);
+
+ if (qc->dma_dir == DMA_TO_DEVICE)
+ addr |= 0xfffff80000000000;
+
ahci_sg[si].addr = cpu_to_le32(addr & 0xffffffff);
ahci_sg[si].addr_hi = cpu_to_le32((addr >> 16) >> 16);
ahci_sg[si].flags_size = cpu_to_le32(sg_len - 1);
So he force sets all the upper 21 bits in the address sent to the device,
but can still mkfs.btrfs, mount and scrub the filesystem.
This should of course not have worked, and should have resulted in a bunch
of IOMMU page fault errors in the log, but it doesn't.
Can you guys verify that ASMedia ASM1061 only supports 43-bit DMA addresses,
even though it sets AHCI CAP.S64A, which says "Indicates whether the HBA can
access 64-bit data structures." ?
Kind regards,
Niklas
next prev parent reply other threads:[~2024-01-24 10:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 12:27 ASMedia ASM1062 (AHCI) hang after "ahci 0000:28:00.0: Using 64-bit DMA addresses" Lennert Buytenhek
2024-01-16 14:20 ` Niklas Cassel
2024-01-17 21:14 ` Lennert Buytenhek
2024-01-17 22:52 ` Niklas Cassel
2024-01-23 21:00 ` Lennert Buytenhek
2024-01-24 10:15 ` Niklas Cassel
2024-01-24 10:41 ` Niklas Cassel [this message]
2024-01-24 12:40 ` Lennert Buytenhek
2024-01-24 13:58 ` Lennert Buytenhek
2024-01-24 16:14 ` Robin Murphy
[not found] <20240130055757.2573-1-Chloe_Chen@asmedia.com.tw>
2024-01-31 11:06 ` ASMedia ASM1062 (AHCI) hang after "ahci 0000:28:00.0:Using " 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=ZbDpTrt0lU/llRMp@x1-carbon \
--to=cassel@kernel.org \
--cc=Chloe_Chen@asmedia.com.tw \
--cc=Jesse1_Chang@asmedia.com.tw \
--cc=Richard_Hsu@asmedia.com.tw \
--cc=chensiying21@gmail.com \
--cc=dlemoal@kernel.org \
--cc=kernel@wantstofly.org \
--cc=linux-ide@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