On 24.10.18 11:35, minskey guo wrote:
On Wednesday, October 24, 2018 at 4:37:29 PM UTC+8, minskey guo wrote:
I am still debugging this issue. Some update about it:

    It is NOT an PCI INT A issue. it is interrupt allocation issue. Linux uses 
"allocated_irqs" bitmap to record allocated intr vectors, and marks the first 
32 as 1 for x86 system reserved intr/exception.

    However, when Linux boot in non-root cell, seems that it doesn't have chance to do 
that, as a result, the "allocated_irqs" bitmap is all'0. And in the routine 
__irq_alloc_descs(), Linux will allocate vector 0 (bit 0) for my AHCI controller.

     If u run into the same issue or any suggestion/indication about how to 
solve it, please let me know


-Minskey


On Monday, October 22, 2018 at 7:20:48 PM UTC+8, minskey guo wrote:
I am trying to pass AHCI controller to non-root cell on Intel NUC7i5D. Should i 
pass IOAPIC to non-root cell as well or something else to achieve that goal ?

My hardware is:
    00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller 
[AHCI mode] (rev 21) (prog-if 01 [AHCI 1.0])
        Subsystem: Intel Corporation Sunrise Point-LP SATA Controller [AHCI 
mode]
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- 
<MAbort- >SERR- <PERR- INTx-
        Latency: 0
        Interrupt: pin A routed to IRQ 125
        Region 0: Memory at df248000 (32-bit, non-prefetchable) [size=8K]
        Region 1: Memory at df24c000 (32-bit, non-prefetchable) [size=256]
        Region 2: I/O ports at f090 [size=8]
        Region 3: I/O ports at f080 [size=4]
        Region 4: I/O ports at f060 [size=32]
        Region 5: Memory at df24b000 (32-bit, non-prefetchable) [size=2K]
        Capabilities: <access denied>
        Kernel driver in use: ahci
        Kernel modules: ahci


During non-root cell booting, I get the following error :


[    1.952370] ahci 0000:00:17.0: enabling device (0400 -> 0403)
[    1.958152] ahci 0000:00:17.0: can't find IRQ for PCI INT A; please try 
using pci=biosirq
/home/test/work/jailhouse/hypervisor/arch/x86/pci.c:349: irq ret=133
/home/test/work/jailhouse/hypervisor/arch/x86/pci.c:363: irq vector=133
[    1.978770] ahci 0000:00:17.0: AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 
impl SATA mode
[    1.987013] ahci 0000:00:17.0: flags: 64bit ncq pm led clo only pio slum 
part deso sadm sd
[    1.995961] WARNING: CPU: 0 PID: 1 at drivers/ata/libata-core.c:6632 
ata_host_activate+0x3b
[    1.999919] Modules linked in:
[    1.999919] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc7+ #17
[    1.999919] RIP: 0010:ata_host_activate+0x33/0xfb
[    1.999919] Code: ce 41 55 49 89 d5 41 54 4d 89 c4 55 89 f5 53 48 89 fb 41 
51 e8 01 b7 ff f
[    1.999919] RSP: 0000:ffffc9000001bcb0 EFLAGS: 00010282
[    1.999919] RAX: 0000000000000000 RBX: ffff880003f6f200 RCX: 0000000000000001
[    1.999919] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 00000000ffffffff
[    1.999919] RBP: 0000000000000000 R08: 0000000080000001 R09: ffffea00000c0f08
[    1.999919] R10: 0000000000000005 R11: 0000000000000000 R12: ffffffff820e1640
[    1.999919] R13: ffffffff815002d3 R14: 0000000000000080 R15: ffff880003eb08a8
[    1.999919] FS:  0000000000000000(0000) GS:ffff880004400000(0000) 
knlGS:0000000000000000
[    1.999919] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    1.999919] CR2: ffffc900000bc000 CR3: 000000000200a001 CR4: 00000000003626b0
[    1.999919] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    1.999919] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    1.999919] Call Trace:
[    1.999919]  ahci_init_one+0xa74/0xad4
[    1.999919]  ? pm_runtime_deactivate_timer+0x5/0x2d

and then,

     2.516932] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    7.590677] ata1.00: qc timeout (cmd 0xec)
[    7.595870] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[    7.916948] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[   18.086679] ata1.00: qc timeout (cmd 0xec)
[   18.091872] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[   18.097995] ata1: limiting SATA link speed to 3.0 Gbps
[   18.416935] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[   48.550679] ata1.00: qc timeout (cmd 0xec)
[   48.555871] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[   48.876933] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[   48.884284] VFS: Cannot open root device "sda3" or unknown-block(0,0): error 
-6
[   48.891640] Please append a correct "root=" boot option; here are the 
available partitions:
[   48.900035] 0100           65536 ram0
[   48.900036]  (driver?)



thanks,
-Minskey

I am not sure if it is the right way to do it, but it works now with the 
following patch for linux-kernel of non-root cell:


diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c
index 7654febd5102..464bc860afea 100644
--- a/arch/x86/kernel/apic/vector.c
+++ b/arch/x86/kernel/apic/vector.c
@@ -653,7 +654,11 @@ int __init arch_probe_nr_irqs(void)
          * We don't know if PIC is present at this point so we need to do
          * probe() to get the right number of legacy IRQs.
          */
-       return legacy_pic->probe();
+               nr = legacy_pic->probe();
+       if (nr == 0)
+               return 32;
+       return nr;
+
  }

  void lapic_assign_legacy_vector(unsigned int irq, bool replace)


Yeah, now I recall as well that we used to have a dummy alloc to reserve vector 0 in the non-root Linux cell on x86 to avoid these "side effects". I think to recall removing that prior to upstreaming because partitioning the IOAPIC for legacy interrupts is hard anyway (due to legacy interrupt routing challenges), and I didn't want to push this workaround for a rather fragile and phasing out use case (everyone should be on MSI/MSI-X by now).

So, is your AHCI controller not supporting MSI?

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

--
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to