mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Renaud Barbier <Renaud.Barbier@ametek.com>
To: Barebox List <barebox@lists.infradead.org>
Subject: PCI memory mapping
Date: Mon, 7 Apr 2025 14:55:06 +0000	[thread overview]
Message-ID: <DM5PR07MB35326053D9A1078A2B35A979ECAA2@DM5PR07MB3532.namprd07.prod.outlook.com> (raw)

Hello,
Barebox version: 2024-09

I am porting the Linux PCIE driver for Broadcom Cortex-A9 (ARMv7) chip.
So far I am able to detect the bridge and NVME device attach to it:

pci: pci_scan_bus for bus 0
pci:  last_io = 0x00000000, last_mem = 0x20000000, last_mem_pref = 0x00000000
pci: class = 00000604, hdr_type = 00000001
pci: 00:00 [14e4:b170]

pci: pci_scan_bus for bus 1
pci:  last_io = 0x00000000, last_mem = 0x20000000, last_mem_pref = 0x00000000
pci: class = 00000108, hdr_type = 00000000
pci: 01:00 [126f:2263]
ERROR: pci: last_mem = 0x20000000, 16384
pci: pbar0: mask=ffffc004 NP-MEM 16384 bytes
...
pci: class = 00000108, hdr_type = 00000000
pci: 01:f8 [126f:2263]
ERROR: pci: last_mem = 0x2007c000, 16384
pci: pbar0: mask=ffffc004 NP-MEM 16384 bytes
pci: pci_scan_bus returning with max=02
pci: bridge NP limit at 0x20100000

The PCI memory address is assigned to the device and map (pci_iomap from nvme_dev_map)  but access to this PCI space crashes the system:

pci: pci_scan_bus returning with max=02
ERROR: nvme_dev_map: bar = 0x20000000
nvme pci-126f:2263.0: enabling bus mastering
ERROR: pci:  __pci_set_master
ERROR: nvme_pci_enable: address: 0x2000001c
unable to handle paging request at address 0x2000001c
pc : [<9fe3d6e4>]    lr : [<9fe3d6d8>]
sp : 9fff7f38  ip : 00000002  fp : 00000000
r10: 0006b52c  r9 : 40000000  r8 : 9fea9b88
r7 : 7fe18500  r6 : 7fe295a8  r5 : 9fe8e5b8  r4 : 7fe29538
r3 : 20000000  r2 : 00000000  r1 : 0000000a  r0 : 00000027
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
[<9fe3d6e4>] (nvme_probe+0xd8/0x4c4) from [<9fe14650>] (device_probe+0x64/0x15c)
[<9fe14650>] (device_probe+0x64/0x15c) from [<9fe14778>] (match+0x30/0x68)

Tracing the problem, I found that if I limit the scanning in pci_scan_bus to 1 device/function
-       for (devfn = 0; devfn < 0xff; ++devfn) {
+       for (devfn = 0; devfn < 0x8; ++devfn) { ==> At 0x10 I see the crash.

Then, the NVME device is detected:
nvme pci-126f:2263.0: serial: A012410180620000000
nvme pci-126f:2263.0: model: SM681GEF AGS
nvme pci-126f:2263.0: firmware: TFX7GB

Has anybody seen this problem before (I havenoyt seen that on the LS1046A)?
I am not seeing much diff with the master branch in /drivers/pci and drivers/nvme

Cheers,
Renaud









                 reply	other threads:[~2025-04-07 16:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=DM5PR07MB35326053D9A1078A2B35A979ECAA2@DM5PR07MB3532.namprd07.prod.outlook.com \
    --to=renaud.barbier@ametek.com \
    --cc=barebox@lists.infradead.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