ASmedia Pcie to SATA controller - Samsung 860 EV0 SSD -EMEM address decode error

we have connected the Jetson tx2 pcie port to IDT switch and one of the switch port we have connected ASMedia pcie to sata card and on the sata port connected samsung 860 EVO (SSD) .

In lspci we have detected the SATA controller but not detected on /dev/sda.

03:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 02) (prog-if 01 [AHCI 1.0])
	Subsystem: ASMedia Technology Inc. ASM1062 Serial ATA Controller
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 440
	Region 0: I/O ports at 1020 
	Region 1: I/O ports at 1030 
	Region 2: I/O ports at 1028 
	Region 3: I/O ports at 1034 
	Region 4: I/O ports at 1000 
	Region 5: Memory at 51010000 (32-bit, non-prefetchable) 
	[virtual] Expansion ROM at 51000000 [disabled] 
	Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: 618b6000  Data: 0001
	Capabilities: [78] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [80] Express (v2) Legacy Endpoint, MSI 00
		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <1us, L1 <8us
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
		LnkCap:	Port #1, Speed 5GT/s, Width x1, ASPM not supported, Exit Latency L0s unlimited, L1 <2us
			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range ABC, TimeoutDis+, LTR-, OBFF Not Supported
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [100 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Kernel driver in use: ahci
	Kernel modules: ahci

Dmesg shows that

tegra186-padctl 3520000.pinctrl: padctl mmio start 0x0000000003520000 end 0x0000000003520fff
[    9.418273] tegra186-padctl 3520000.pinctrl: ao mmio start 0x0000000003540000 end 0x0000000003540fff
[    9.418327] tegra186-padctl 3520000.pinctrl: FUSE_SKU_USB_CALIB_0 0x32c098
[    9.418330] tegra186-padctl 3520000.pinctrl: FUSE_USB_CALIB_EXT_0 0x8
[    9.420794] tegra186-padctl 3520000.pinctrl: using UTMI port 0 for otg
[    9.913035] ata3: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    9.919574] (255) csw_afiw: EMEM address decode error
[    9.924639]   status = 0x20010031; addr = 0x618b6000
[    9.929625]   secure: no, access-type: write
[    9.929635] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[    9.929641] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[    9.929660] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[    9.929664] mc-err: Too many MC errors; throttling prints
[   10.504187] gk20a 17000000.gp10b: railgate is disabled.
[   10.716480] Bridge firewalling registered
[   10.843347] ip_tables: (C) 2000-2006 Netfilter Core Team
[   11.192893] CPU1: shutdown
[   11.195614] psci: CPU1 killed.
[   11.229938] CPU2: shutdown
[   11.232666] psci: CPU2 killed.
[   11.332633] Netfilter messages via NETLINK v0.30.
[   11.373288] ctnetlink v0.93: registering with nfnetlink.
[   11.596766] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[   12.095805] eqos 2490000.ether_qos eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   12.105140] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   12.503532] fuse init (API version 7.23)
[   14.917497] ata3.00: qc timeout (cmd 0xec)
[   14.922148] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[   15.322802] IPVS: Creating netns size=1424 id=2
[   15.416959] ata3: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[   15.424409] (255) csw_afiw: EMEM address decode error
[   15.429502]   status = 0x20010031; addr = 0x618b6000
[   15.434502]   secure: no, access-type: write
[   15.438804] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[   15.448654] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[   15.458525] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[   15.468388] mc-err: Too many MC errors; throttling prints
[   16.173831] IPVS: Creating netns size=1424 id=3
[   25.420902] ata3.00: qc timeout (cmd 0xec)
[   25.425150] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[   25.431311] ata3: limiting SATA link speed to 3.0 Gbps
[   27.649056] ata3: SATA link down (SStatus 1 SControl 320)
[   27.654583] (255) csw_afiw: EMEM address decode error
[   27.659762]   status = 0x20010031; addr = 0x618b6000
[   27.664805]   secure: no, access-type: write
[   27.669146] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[   27.679032] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[   27.688939] unknown mcerr fault, int_status=0x00000000, ch_int_status=0x00000000, hubc_int_status=0x00000000
[   27.698835] mc-err: Too many MC errors; throttling prints
[   27.977051] ata4: SATA link down (SStatus 0 SControl 300)
[ 1731.352060] Shikra IDT NTB driver version 2.01.00
[ 1731.357190] Allocated LOCAL EP data structure

Please guide us in what all configuration need to be chosen in order to avoid this error.

1 Like

What is the software version being used here?
I think the issue here seems to be that this particular endpoint doesn’t support 64-bit MSI and supports only 32-bit MSI, but looks like the system has allocated a 64-bit MSI target address, which resulted in EMEM address decoding error.
I think you are using r28.2 or older. If that is indeed the case, please apply below patch to solve the issue.

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 364e36f293c0..f79d96970351 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -3062,7 +3062,7 @@ static int tegra_pcie_enable_msi(struct tegra_pcie *pcie, bool no_init)
                }

                /* setup AFI/FPCI range */
-               msi->pages = __get_free_pages(GFP_DMA32, 0);
+               msi->pages = __get_free_pages(GFP_DMA, 0);
        }
        base = virt_to_phys((void *)msi->pages);

Thanks for your info. Now Iam unable to detect SSD and device is shown as /dev/sda .

But when Iam trying to create a file system ext4 on it Iam getting this error.

ata3: SATA link down (SStatus 0 SControl 300)
[    9.748631] ata4: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    9.755157] ata4.00: supports DRM functions and may not be fully accessible
[    9.755550] ata4.00: disabling queued TRIM support
[    9.755553] ata4.00: ATA-11: Samsung SSD 860 EVO 1TB, RVT02B6Q, max UDMA/133
[    9.755555] ata4.00: 1953525168 sectors, multi 1: LBA48 NCQ (depth 31/32), AA
[    9.756413] ata4.00: supports DRM functions and may not be fully accessible
[    9.756713] ata4.00: disabling queued TRIM support
[    9.757232] ata4.00: configured for UDMA/133
[    9.757638] scsi 3:0:0:0: Direct-Access     ATA      Samsung SSD 860  2B6Q PQ: 0 ANSI: 5
[    9.758546] ata4.00: Enabling discard_zeroes_data
[    9.758577] sd 3:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[    9.758828] sd 3:0:0:0: [sda] Write Protect is off
[    9.758832] sd 3:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    9.758898] sd 3:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    9.759440] ata4.00: Enabling discard_zeroes_data
[    9.762623] ata4.00: Enabling discard_zeroes_data
[    9.762909] sd 3:0:0:0: [sda] Attached SCSI disk
[    9.763183] Wake76 for irq=199
[    9.763184] Wake77 for irq=199
[    9.763184] Wake78 for irq=199
[    9.763185] Wake79 for irq=199
[    9.763186] Wake80 for irq=199
[    9.763186] Wake81 for irq=199
[    9.763187] Wake82 for irq=199
[    9.763680] xhci-tegra 3530000.xhci: can't get usb3-0 phy (-517)
[    9.765767] Wake76 for irq=199
[    9.765768] Wake77 for irq=199
[    9.765769] Wake78 for irq=199
[    9.765770] Wake79 for irq=199
[    9.765771] Wake80 for irq=199
[    9.765771] Wake81 for irq=199
[    9.765772] Wake82 for irq=199
[    9.765973] tegra-xotg xotg: usb2 phy is not available yet
[    9.766371] tegra-usb-cd usb_cd: otg phy is not available yet
[    9.767084] tegra-xudc-new 3550000.xudc: usb2 phy is not available yet
[    9.767505] tegra186-padctl 3520000.pinctrl: padctl mmio start 0x0000000003520000 end 0x0000000003520fff
[    9.767517] tegra186-padctl 3520000.pinctrl: ao mmio start 0x0000000003540000 end 0x0000000003540fff
[    9.767569] tegra186-padctl 3520000.pinctrl: FUSE_SKU_USB_CALIB_0 0x30c896
[    9.767572] tegra186-padctl 3520000.pinctrl: FUSE_USB_CALIB_EXT_0 0x9
[    9.768624] tegra186-padctl 3520000.pinctrl: using UTMI port 0 for otg
[   10.262249] IPVS: Creating netns size=1424 id=1
[   10.403952] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   10.414153] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   10.810403] gk20a 17000000.gp10b: railgate is disabled.
[   11.727497] Bridge firewalling registered
[   11.943078] ip_tables: (C) 2000-2006 Netfilter Core Team
[   12.875589] Netfilter messages via NETLINK v0.30.
[   12.890826] ctnetlink v0.93: registering with nfnetlink.
[   13.320902] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[   13.655751] eqos 2490000.ether_qos eth0: Link is Up - 1Gbps/Full - flow control off
[   13.664879] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   14.259579] fuse init (API version 7.23)
[   15.886904] IPVS: Creating netns size=1424 id=2
[   16.184259] IPVS: Creating netns size=1424 id=3

ERROR
=======

[  196.596489] ata4.00: exception Emask 0x10 SAct 0x0 SErr 0x400000 action 0x6 frozen
[  196.604170] ata4.00: irq_stat 0x08000000, interface fatal error
[  196.610292] ata4: SError: { Handshk }
[  196.614086] ata4.00: failed command: DATA SET MANAGEMENT
[  196.619499] ata4.00: cmd 06/01:01:00:00:00/00:00:00:00:00/a0 tag 23 dma 512 out
                        res 50/00:00:00:00:00/00:00:00:00:00/a0 Emask 0x10 (ATA bus error)
[  196.634910] ata4.00: status: { DRDY }
[  196.638661] ata4: hard resetting link
[  206.641132] ata4: softreset failed (1st FIS failed)
[  206.646092] ata4: hard resetting link
[  216.649715] ata4: softreset failed (1st FIS failed)
[  216.654676] ata4: hard resetting link
[  251.659348] ata4: softreset failed (1st FIS failed)
[  251.664307] ata4: limiting SATA link speed to 3.0 Gbps
[  251.669647] ata4: hard resetting link
[  256.671553] ata4: softreset failed (1st FIS failed)
[  256.676536] ata4: reset failed, giving up
[  256.680759] ata4.00: disabled
[  256.683923] ata4.00: device reported invalid CHS sector 0
[  256.689468] ata4: EH complete
[  256.692601] sd 3:0:0:0: [sda] tag#27 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.700899] sd 3:0:0:0: [sda] tag#27 CDB: opcode=0x93 93 08 00 00 00 00 2e c0 80 00 00 3f ff c0 00 00
[  256.710160] blk_update_request: I/O error, dev sda, sector 784367616
[  256.710385] sd 3:0:0:0: [sda] tag#28 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.710400] sd 3:0:0:0: [sda] tag#28 CDB: opcode=0x93 93 08 00 00 00 00 2f 00 7f c0 00 00 00 40 00 00
[  256.710407] blk_update_request: I/O error, dev sda, sector 788561856
[  256.741925] sd 3:0:0:0: [sda] tag#29 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.750279] sd 3:0:0:0: [sda] tag#29 CDB: opcode=0x28 28 00 00 00 00 00 00 00 08 00
[  256.758011] blk_update_request: I/O error, dev sda, sector 0
[  256.764024] sd 3:0:0:0: [sda] tag#30 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.772299] sd 3:0:0:0: [sda] tag#30 CDB: opcode=0x28 28 00 00 00 00 00 00 00 08 00
[  256.779966] blk_update_request: I/O error, dev sda, sector 0
[  256.807554] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.815734] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 00 00 00 00 00 08 00
[  256.823312] blk_update_request: I/O error, dev sda, sector 0
[  256.828976] Buffer I/O error on dev sda, logical block 0, async page read
[  256.835926] sd 3:0:0:0: [sda] tag#1 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.844102] sd 3:0:0:0: [sda] tag#1 CDB: opcode=0x28 28 00 00 00 00 00 00 00 08 00
[  256.851669] blk_update_request: I/O error, dev sda, sector 0
[  256.857339] Buffer I/O error on dev sda, logical block 0, async page read
[  256.864221] sd 3:0:0:0: [sda] tag#2 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.872415] sd 3:0:0:0: [sda] tag#2 CDB: opcode=0x28 28 00 00 00 00 00 00 00 08 00
[  256.879998] blk_update_request: I/O error, dev sda, sector 0
[  256.885786] sd 3:0:0:0: [sda] tag#3 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  256.893993] sd 3:0:0:0: [sda] tag#3 CDB: opcode=0x28 28 00 00 00 00 00 00 00 08 00
[  256.901577] blk_update_request: I/O error, dev sda, sector 0
[  257.171199] sd 3:0:0:0: [sda] tag#4 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  257.179441] sd 3:0:0:0: [sda] tag#4 CDB: opcode=0x28 28 00 00 04 00 00 00 00 08 00
[  257.187024] blk_update_request: I/O error, dev sda, sector 262144
[  257.193328] sd 3:0:0:0: [sda] tag#5 UNKNOWN(0x2003) Result: hostbyte=0x04 driverbyte=0x00
[  257.201563] sd 3:0:0:0: [sda] tag#5 CDB: opcode=0x28 28 00 00 04 00 00 00 00 08 00
[  257.209155] blk_update_request: I/O error, dev sda, sector 262144
[  257.223558] Buffer I/O error on dev sda, logical block 524288, lost async page write
[  257.231613] Buffer I/O error on dev sda, logical block 1048576, lost async page write
[  257.239530] Buffer I/O error on dev sda, logical block 1572864, lost async page write
[  257.247384] Buffer I/O error on dev sda, logical block 2097152, lost async page write
[  257.255252] Buffer I/O error on dev sda, logical block 2621440, lost async page write
[  257.263136] Buffer I/O error on dev sda, logical block 3145728, lost async page write
[  257.271044] Buffer I/O error on dev sda, logical block 1, lost async page write
[  257.278385] Buffer I/O error on dev sda, logical block 2, lost async page write
[  257.597353] VFS: Dirty inode writeback failed for block device sda (err=-5).
[  257.605450] sd 3:0:0:0: [sda] Read Capacity(16) failed: Result: hostbyte=0x04 driverbyte=0x00
[  257.614180] sd 3:0:0:0: [sda] Sense not available.
[  257.619798] sd 3:0:0:0: [sda] Read Capacity(10) failed: Result: hostbyte=0x04 driverbyte=0x00
[  257.628478] sd 3:0:0:0: [sda] Sense not available.
[  257.634176] sda: detected capacity change from 1000204886016 to 0

Is this the observation with other SATA drives also? Also, did you confirm that there is no issue from SMPS side? ( We have seen similar issues when SMPS wasn’t powered up/ continue to be in the powered up state after enumeration)