Hello everyone,
Lately i've been trying to share memory between two cells using uio_ivshmem
driver (https://github.com/henning-schild-work/ivshmem-guest-code), as it has
been recommended here in multiple threads, in Ultrascale+ (arm64).
So firstly, i am using ivshmem-demo.bin to run on non-root cell and test
uio_ivshmem driver. I am using a customized ivshmem-demo.c from another user
that tweaked ivshmem-demo to work in arm64. When debugging this source file
(using printks), i've noticed that the code stops running when mmio_read16() is
called (the printks stop there).
Any ideas of what might be the problem??
I attach the log file of the session where i issue the commands to enable
ivshmem and the cells to share memory.
(NOTE: Some additional information: PCI_CFG_BASE=0xfc000000
lspci -v
00:00.0 Unassigned class [ff80]: Red Hat, Inc Inter-VM shared memory
Subsystem: Red Hat, Inc Inter-VM shared memory
Flags: bus master, fast devsel, latency 0, IRQ 55
Memory at fc100000 (64-bit, non-prefetchable) [size=256]
Kernel driver in use: uio_ivshmem
cat /proc/interrupts
55: 0 0 GICv2 136 Edge uio_ivshmem
cat /proc/iomem
fc000000-fc0fffff : PCI ECAM
fc100000-fc101fff : //pci@0
fc100000-fc1000ff : 0000:00:00.0
fc100000-fc1000ff : ivshmem
)
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2019.03.20 22:14:57 =~=~=~=~=~=~=~=~=~=~=~=
PMUFW: v1.0
U-Boot 2018.01 (Mar 18 2019 - 15:13:14 +0000) Xilinx ZynqMP ZCU100 RevC
I2C: ready
DRAM: 2 GiB
EL Level: EL2
Chip ID: zu3eg
MMC: sdhci@ff160000: 0 (SD), sdhci@ff170000: 1
reading uboot.env
In: serial@ff010000
Out: serial@ff010000
Err: serial@ff010000
Model: ZynqMP ZCU100 RevC
Board: Xilinx ZynqMP
Net: Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot: 2 1 0
reading image.ub
7277364 bytes read in 534 ms (13 MiB/s)
## Loading kernel from FIT Image at 03000000 ...
Using '[email protected]' configuration
Trying 'kernel@1' kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x03000108
Data Size: 7239052 Bytes = 6.9 MiB
Architecture: AArch64
OS: Linux
Load Address: 0x00080000
Entry Point: 0x00080000
Hash algo: sha1
Hash value: ebf5e66e501a766be2fada1f99d4f4441dde8cbe
Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 03000000 ...
Using '[email protected]' configuration
Trying '[email protected]' fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x036e7798
Data Size: 36390 Bytes = 35.5 KiB
Architecture: AArch64
Hash algo: sha1
Hash value: cdb5bc33b1bba3f8fc39185eb320945196cc4e1f
Verifying Hash Integrity ... sha1+ OK
Booting using the fdt blob at 0x36e7798
Uncompressing Kernel Image ... OK
Loading Device Tree to 0000000007ff4000, end 0000000007fffe25 ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.0-xilinx-v2018.2 (oe-user@oe-host) (gcc
version 7.2.0 (GCC)) #1 SMP Mon Mar 18 12:05:20 WET 2019
[ 0.000000] Boot CPU: AArch64 Processor [410fd034]
[ 0.000000] Machine model: ZynqMP ZCU100 RevC
[ 0.000000] earlycon: cdns0 at MMIO 0x00000000ff010000 (options '115200n8')
[ 0.000000] bootconsole [cdns0] enabled
[ 0.000000] Memory limited to 1536MB
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 256 MiB at 0x0000000050000000
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv1.1 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: MIGRATE_INFO_TYPE not supported.
[ 0.000000] random: fast init done
[ 0.000000] percpu: Embedded 21 pages/cpu @ffffffc04ff70000 s46488 r8192
d31336 u86016
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] CPU features: enabling workaround for ARM erratum 845719
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 383744
[ 0.000000] Kernel command line: earlycon clk_ignore_unused earlyprintk
mem=1536M root=/dev/mmcblk0p2 rw rootwait
[ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] Memory: 1244848K/1556480K available (9980K kernel code, 644K
rwdata, 3744K rodata, 512K init, 2168K bss, 49488K reserved, 262144K
cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] modules : 0xffffff8000000000 - 0xffffff8008000000 ( 128
MB)
[ 0.000000] vmalloc : 0xffffff8008000000 - 0xffffffbebfff0000 ( 250
GB)
[ 0.000000] .text : 0xffffff8008080000 - 0xffffff8008a40000 ( 9984
KB)
[ 0.000000] .rodata : 0xffffff8008a40000 - 0xffffff8008df0000 ( 3776
KB)
[ 0.000000] .init : 0xffffff8008df0000 - 0xffffff8008e70000 ( 512
KB)
[ 0.000000] .data : 0xffffff8008e70000 - 0xffffff8008f11200 ( 645
KB)
[ 0.000000] .bss : 0xffffff8008f11200 - 0xffffff800912f3b0 ( 2169
KB)
[ 0.000000] fixed : 0xffffffbefe7fd000 - 0xffffffbefec00000 ( 4108
KB)
[ 0.000000] PCI I/O : 0xffffffbefee00000 - 0xffffffbeffe00000 ( 16
MB)
[ 0.000000] vmemmap : 0xffffffbf00000000 - 0xffffffc000000000 ( 4
GB maximum)
[ 0.000000] 0xffffffbf00000000 - 0xffffffbf01500000 ( 21
MB actual)
[ 0.000000] memory : 0xffffffc000000000 - 0xffffffc060000000 ( 1536
MB)
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] GIC: Adjusting CPU interface base to 0x00000000f902f000
[ 0.000000] GIC: Using split EOI/Deactivate mode
[ 0.000000] arch_timer: cp15 timer(s) running at 99.99MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff
max_cycles: 0x1710236356, max_idle_ns: 440795202549 ns
[ 0.000004] sched_clock: 56 bits at 99MHz, resolution 10ns, wraps every
4398046511099ns
[ 0.008327] Console: colour dummy device 80x25
[ 0.012584] console [tty0] enabled
[ 0.015950] bootconsole [cdns0] disabled
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.0-xilinx-v2018.2 (oe-user@oe-host) (gcc
version 7.2.0 (GCC)) #1 SMP Mon Mar 18 12:05:20 WET 2019
[ 0.000000] Boot CPU: AArch64 Processor [410fd034]
[ 0.000000] Machine model: ZynqMP ZCU100 RevC
[ 0.000000] earlycon: cdns0 at MMIO 0x00000000ff010000 (options '115200n8')
[ 0.000000] bootconsole [cdns0] enabled
[ 0.000000] Memory limited to 1536MB
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 256 MiB at 0x0000000050000000
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv1.1 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: MIGRATE_INFO_TYPE not supported.
[ 0.000000] random: fast init done
[ 0.000000] percpu: Embedded 21 pages/cpu @ffffffc04ff70000 s46488 r8192
d31336 u86016
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] CPU features: enabling workaround for ARM erratum 845719
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 383744
[ 0.000000] Kernel command line: earlycon clk_ignore_unused earlyprintk
mem=1536M root=/dev/mmcblk0p2 rw rootwait
[ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] Memory: 1244848K/1556480K available (9980K kernel code, 644K
rwdata, 3744K rodata, 512K init, 2168K bss, 49488K reserved, 262144K
cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] modules : 0xffffff8000000000 - 0xffffff8008000000 ( 128
MB)
[ 0.000000] vmalloc : 0xffffff8008000000 - 0xffffffbebfff0000 ( 250
GB)
[ 0.000000] .text : 0xffffff8008080000 - 0xffffff8008a40000 ( 9984
KB)
[ 0.000000] .rodata : 0xffffff8008a40000 - 0xffffff8008df0000 ( 3776
KB)
[ 0.000000] .init : 0xffffff8008df0000 - 0xffffff8008e70000 ( 512
KB)
[ 0.000000] .data : 0xffffff8008e70000 - 0xffffff8008f11200 ( 645
KB)
[ 0.000000] .bss : 0xffffff8008f11200 - 0xffffff800912f3b0 ( 2169
KB)
[ 0.000000] fixed : 0xffffffbefe7fd000 - 0xffffffbefec00000 ( 4108
KB)
[ 0.000000] PCI I/O : 0xffffffbefee00000 - 0xffffffbeffe00000 ( 16
MB)
[ 0.000000] vmemmap : 0xffffffbf00000000 - 0xffffffc000000000 ( 4
GB maximum)
[ 0.000000] 0xffffffbf00000000 - 0xffffffbf01500000 ( 21
MB actual)
[ 0.000000] memory : 0xffffffc000000000 - 0xffffffc060000000 ( 1536
MB)
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] GIC: Adjusting CPU interface base to 0x00000000f902f000
[ 0.000000] GIC: Using split EOI/Deactivate mode
[ 0.000000] arch_timer: cp15 timer(s) running at 99.99MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff
max_cycles: 0x1710236356, max_idle_ns: 440795202549 ns
[ 0.000004] sched_clock: 56 bits at 99MHz, resolution 10ns, wraps every
4398046511099ns
[ 0.008327] Console: colour dummy device 80x25
[ 0.012584] console [tty0] enabled
[ 0.015950] bootconsole [cdns0] disabled
[ 0.019864] Calibrating delay loop (skipped), value calculated using timer
frequency.. 199.99 BogoMIPS (lpj=399999)
[ 0.019878] pid_max: default: 32768 minimum: 301
[ 0.020000] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.020018] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.020771] ASID allocator initialised with 65536 entries
[ 0.020828] Hierarchical SRCU implementation.
[ 0.021160] EFI services will not be available.
[ 0.021188] zynqmp_plat_init Platform Management API v1.0
[ 0.021196] zynqmp_plat_init Trustzone version v1.0
[ 0.021311] smp: Bringing up secondary CPUs ...
[ 0.021602] Detected VIPT I-cache on CPU1
[ 0.021641] CPU1: Booted secondary processor [410fd034]
[ 0.021947] Detected VIPT I-cache on CPU2
[ 0.021966] CPU2: Booted secondary processor [410fd034]
[ 0.022257] Detected VIPT I-cache on CPU3
[ 0.022276] CPU3: Booted secondary processor [410fd034]
[ 0.022318] smp: Brought up 1 node, 4 CPUs
[ 0.022351] SMP: Total of 4 processors activated.
[ 0.022360] CPU features: detected feature: 32-bit EL0 Support
[ 0.022371] CPU: All CPU(s) started at EL2
[ 0.022390] alternatives: patching kernel code
[ 0.023127] devtmpfs: initialized
[ 0.027289] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff,
max_idle_ns: 7645041785100000 ns
[ 0.027318] futex hash table entries: 1024 (order: 5, 131072 bytes)
[ 0.033551] xor: measuring software checksum speed
[ 0.071955] 8regs : 2303.000 MB/sec
[ 0.111983] 8regs_prefetch: 2053.000 MB/sec
[ 0.152013] 32regs : 2830.000 MB/sec
[ 0.192043] 32regs_prefetch: 2379.000 MB/sec
[ 0.192051] xor: using function: 32regs (2830.000 MB/sec)
[ 0.192142] pinctrl core: initialized pinctrl subsystem
[ 0.192879] NET: Registered protocol family 16
[ 0.193668] cpuidle: using governor menu
[ 0.194238] vdso: 2 pages (1 code @ ffffff8008a46000, 1 data @
ffffff8008e74000)
[ 0.194257] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[ 0.194883] DMA: preallocated 256 KiB pool for atomic allocations
[ 0.225349] reset_zynqmp reset-controller: Xilinx zynqmp reset driver probed
[ 0.225878] ARM CCI_400_r1 PMU driver probed
[ 0.230496] zynqmp-pinctrl ff180000.pinctrl: zynqmp pinctrl initialized
[ 0.239903] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[ 0.308307] raid6: int64x1 gen() 402 MB/s
[ 0.376257] raid6: int64x1 xor() 446 MB/s
[ 0.444359] raid6: int64x2 gen() 688 MB/s
[ 0.512382] raid6: int64x2 xor() 603 MB/s
[ 0.580393] raid6: int64x4 gen() 1042 MB/s
[ 0.648471] raid6: int64x4 xor() 742 MB/s
[ 0.716534] raid6: int64x8 gen() 980 MB/s
[ 0.784549] raid6: int64x8 xor() 745 MB/s
[ 0.852665] raid6: neonx1 gen() 727 MB/s
[ 0.920639] raid6: neonx1 xor() 853 MB/s
[ 0.988734] raid6: neonx2 gen() 1169 MB/s
[ 1.056761] raid6: neonx2 xor() 1208 MB/s
[ 1.124786] raid6: neonx4 gen() 1505 MB/s
[ 1.192855] raid6: neonx4 xor() 1442 MB/s
[ 1.260887] raid6: neonx8 gen() 1651 MB/s
[ 1.328936] raid6: neonx8 xor() 1533 MB/s
[ 1.328944] raid6: using algorithm neonx8 gen() 1651 MB/s
[ 1.328952] raid6: .... xor() 1533 MB/s, rmw enabled
[ 1.328960] raid6: using neon recovery algorithm
[ 1.330282] SCSI subsystem initialized
[ 1.330510] usbcore: registered new interface driver usbfs
[ 1.330550] usbcore: registered new interface driver hub
[ 1.330593] usbcore: registered new device driver usb
[ 1.330666] media: Linux media interface: v0.10
[ 1.330695] Linux video capture interface: v2.00
[ 1.330744] pps_core: LinuxPPS API ver. 1 registered
[ 1.330752] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
Giometti <[email protected]>
[ 1.330775] PTP clock support registered
[ 1.330806] EDAC MC: Ver: 3.0.0
[ 1.331213] zynqmp-ipi ff9905c0.mailbox: Probed ZynqMP IPI Mailbox driver.
[ 1.331385] FPGA manager framework
[ 1.331502] fpga-region fpga-full: FPGA Region probed
[ 1.331613] Advanced Linux Sound Architecture Driver Initialized.
[ 1.331928] Bluetooth: Core ver 2.22
[ 1.331958] NET: Registered protocol family 31
[ 1.331966] Bluetooth: HCI device and connection manager initialized
[ 1.331979] Bluetooth: HCI socket layer initialized
[ 1.331990] Bluetooth: L2CAP socket layer initialized
[ 1.332019] Bluetooth: SCO socket layer initialized
[ 1.332684] clocksource: Switched to clocksource arch_sys_counter
[ 1.332778] VFS: Disk quotas dquot_6.6.0
[ 1.332832] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 1.337201] NET: Registered protocol family 2
[ 1.337562] TCP established hash table entries: 16384 (order: 5, 131072
bytes)
[ 1.337677] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[ 1.338029] TCP: Hash tables configured (established 16384 bind 16384)
[ 1.338136] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[ 1.338181] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[ 1.338330] NET: Registered protocol family 1
[ 1.338593] RPC: Registered named UNIX socket transport module.
[ 1.338604] RPC: Registered udp transport module.
[ 1.338611] RPC: Registered tcp transport module.
[ 1.338618] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.339191] hw perfevents: no interrupt-affinity property for /pmu, guessing.
[ 1.339362] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters
available
[ 1.340198] audit: initializing netlink subsys (disabled)
[ 1.340609] audit: type=2000 audit(1.320:1): state=initialized
audit_enabled=0 res=1
[ 1.340655] workingset: timestamp_bits=62 max_order=19 bucket_order=0
[ 1.341601] NFS: Registering the id_resolver key type
[ 1.341635] Key type id_resolver registered
[ 1.341643] Key type id_legacy registered
[ 1.341659] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 1.341687] jffs2: version 2.2. (NAND) (SUMMARY) ?? 2001-2006 Red Hat, Inc.
[ 1.365604] Block layer SCSI generic (bsg) driver version 0.4 loaded (major
246)
[ 1.365629] io scheduler noop registered
[ 1.365637] io scheduler deadline registered
[ 1.365658] io scheduler cfq registered (default)
[ 1.365667] io scheduler mq-deadline registered
[ 1.365675] io scheduler kyber registered
[ 1.367217] xilinx-dpdma fd4c0000.dma: Xilinx DPDMA engine is probed
[ 1.367672] xilinx-zynqmp-dma fd500000.dma: ZynqMP DMA driver Probe success
[ 1.367834] xilinx-zynqmp-dma fd510000.dma: ZynqMP DMA driver Probe success
[ 1.367994] xilinx-zynqmp-dma fd520000.dma: ZynqMP DMA driver Probe success
[ 1.368155] xilinx-zynqmp-dma fd530000.dma: ZynqMP DMA driver Probe success
[ 1.368311] xilinx-zynqmp-dma fd540000.dma: ZynqMP DMA driver Probe success
[ 1.368471] xilinx-zynqmp-dma fd550000.dma: ZynqMP DMA driver Probe success
[ 1.368628] xilinx-zynqmp-dma fd560000.dma: ZynqMP DMA driver Probe success
[ 1.368818] xilinx-zynqmp-dma fd570000.dma: ZynqMP DMA driver Probe success
[ 1.369046] xilinx-zynqmp-dma ffa80000.dma: ZynqMP DMA driver Probe success
[ 1.369204] xilinx-zynqmp-dma ffa90000.dma: ZynqMP DMA driver Probe success
[ 1.369358] xilinx-zynqmp-dma ffaa0000.dma: ZynqMP DMA driver Probe success
[ 1.369513] xilinx-zynqmp-dma ffab0000.dma: ZynqMP DMA driver Probe success
[ 1.369668] xilinx-zynqmp-dma ffac0000.dma: ZynqMP DMA driver Probe success
[ 1.369828] xilinx-zynqmp-dma ffad0000.dma: ZynqMP DMA driver Probe success
[ 1.369989] xilinx-zynqmp-dma ffae0000.dma: ZynqMP DMA driver Probe success
[ 1.370147] xilinx-zynqmp-dma ffaf0000.dma: ZynqMP DMA driver Probe success
[ 1.397741] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 1.401427] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 1.406194] brd: module loaded
[ 1.410462] loop: module loaded
[ 1.411384] mtdoops: mtd device (mtddev=name/number) must be supplied
[ 1.413759] libphy: Fixed MDIO Bus: probed
[ 1.414869] tun: Universal TUN/TAP device driver, 1.6
[ 1.415106] CAN device driver interface
[ 1.416097] usbcore: registered new interface driver asix
[ 1.416168] usbcore: registered new interface driver ax88179_178a
[ 1.416199] usbcore: registered new interface driver cdc_ether
[ 1.416230] usbcore: registered new interface driver net1080
[ 1.416261] usbcore: registered new interface driver cdc_subset
[ 1.416295] usbcore: registered new interface driver zaurus
[ 1.416337] usbcore: registered new interface driver cdc_ncm
[ 1.416773] xilinx-axipmon ffa00000.perf-monitor: Probed Xilinx APM
[ 1.417321] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.417333] ehci-pci: EHCI PCI platform driver
[ 1.417639] usbcore: registered new interface driver uas
[ 1.417681] usbcore: registered new interface driver usb-storage
[ 1.418887] rtc_zynqmp ffa60000.rtc: rtc core: registered ffa60000.rtc as
rtc0
[ 1.418951] i2c /dev entries driver
[ 1.419789] IR NEC protocol handler initialized
[ 1.419799] IR RC5(x/sz) protocol handler initialized
[ 1.419807] IR RC6 protocol handler initialized
[ 1.419814] IR JVC protocol handler initialized
[ 1.419821] IR Sony protocol handler initialized
[ 1.419829] IR SANYO protocol handler initialized
[ 1.419837] IR Sharp protocol handler initialized
[ 1.419844] IR MCE Keyboard/mouse protocol handler initialized
[ 1.419852] IR XMP protocol handler initialized
[ 1.420976] usbcore: registered new interface driver uvcvideo
[ 1.420985] USB Video Class driver (1.1.1)
[ 1.421064] ltc2952-poweroff ltc2954: pm_power_off already registered
[ 1.421079] ltc2952-poweroff: probe of ltc2954 failed with error -16
[ 1.421857] Bluetooth: HCI UART driver ver 2.3
[ 1.421869] Bluetooth: HCI UART protocol H4 registered
[ 1.421877] Bluetooth: HCI UART protocol BCSP registered
[ 1.421907] Bluetooth: HCI UART protocol LL registered
[ 1.421916] Bluetooth: HCI UART protocol ATH3K registered
[ 1.421925] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 1.421976] Bluetooth: HCI UART protocol Intel registered
[ 1.421985] Bluetooth: HCI UART protocol QCA registered
[ 1.422023] usbcore: registered new interface driver bcm203x
[ 1.422059] usbcore: registered new interface driver bpa10x
[ 1.422098] usbcore: registered new interface driver bfusb
[ 1.422136] usbcore: registered new interface driver btusb
[ 1.422144] Bluetooth: Generic Bluetooth SDIO driver ver 0.1
[ 1.422200] usbcore: registered new interface driver ath3k
[ 1.422336] EDAC MC: ECC not enabled
[ 1.422657] EDAC DEVICE0: Giving out device to module zynqmp-ocm-edac
controller zynqmp_ocm: DEV ff960000.memory-controller (INTERRUPT)
[ 1.423748] sdhci: Secure Digital Host Controller Interface driver
[ 1.423758] sdhci: Copyright(c) Pierre Ossman
[ 1.423766] sdhci-pltfm: SDHCI platform and OF driver helper
[ 1.468763] mmc0: SDHCI controller on ff160000.sdhci [ff160000.sdhci] using
ADMA 64-bit
[ 1.474864] sdhci-arasan ff170000.sdhci: parsing dt failed (-517)
[ 1.475382] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.475572] usbcore: registered new interface driver usbhid
[ 1.475581] usbhid: USB HID core driver
[ 1.477550] fpga_manager fpga0: Xilinx ZynqMP FPGA Manager registered
[ 1.479479] pktgen: Packet Generator for packet performance testing.
Version: 2.75
[ 1.481708] Netfilter messages via NETLINK v0.30.
[ 1.481866] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 1.482025] Initializing XFRM netlink socket
[ 1.482105] NET: Registered protocol family 10
[ 1.482544] Segment Routing with IPv6
[ 1.482594] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 1.482733] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.483091] NET: Registered protocol family 17
[ 1.483109] NET: Registered protocol family 15
[ 1.483132] bridge: filtering via arp/ip/ip6tables is no longer available by
default. Update your scripts to load br_netfilter if you need this.
[ 1.483147] Ebtables v2.0 registered
[ 1.483568] can: controller area network core (rev 20170425 abi 9)
[ 1.483611] NET: Registered protocol family 29
[ 1.483621] can: raw protocol (rev 20170425)
[ 1.483629] can: broadcast manager protocol (rev 20170425 t)
[ 1.483641] can: netlink gateway (rev 20170425) max_hops=1
[ 1.483710] Bluetooth: RFCOMM TTY layer initialized
[ 1.483724] Bluetooth: RFCOMM socket layer initialized
[ 1.483749] Bluetooth: RFCOMM ver 1.11
[ 1.483760] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1.483768] Bluetooth: BNEP filters: protocol multicast
[ 1.483779] Bluetooth: BNEP socket layer initialized
[ 1.483787] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 1.483798] Bluetooth: HIDP socket layer initialized
[ 1.483935] 9pnet: Installing 9P2000 support
[ 1.483959] Key type dns_resolver registered
[ 1.485016] registered taskstats version 1
[ 1.485400] Btrfs loaded, crc32c=crc32c-generic
[ 1.492033] ff000000.serial: ttyPS1 at MMIO 0xff000000 (irq = 40, base_baud
= 6249999) is a xuartps
[ 1.493027] ff010000.serial: ttyPS0 at MMIO 0xff010000 (irq = 41, base_baud
= 6249999) is a xuartps
[ 1.517033] mmc0: new high speed SDHC card at address 0007
[ 1.517250] mmcblk0: mmc0:0007 DDINC 14.9 GiB
[ 1.518642] mmcblk0: p1 p2
[ 2.994634] console [ttyPS0] enabled
[ 2.999616] xilinx-psgtr fd400000.zynqmp_phy: Lane:1 type:8 protocol:4
pll_locked:yes
[ 3.007796] PLL: shutdown
[ 3.010473] PLL: shutdown
[ 3.013496] PLL: enable
[ 3.015978] PLL: shutdown
[ 3.019423] PLL: enable
[ 3.021895] xilinx-dp-snd-codec
fd4a0000.zynqmp-display:zynqmp_dp_snd_codec0: Xilinx DisplayPort Sound Codec
probed
[ 3.032527] xilinx-dp-snd-pcm zynqmp_dp_snd_pcm0: Xilinx DisplayPort Sound
PCM probed
[ 3.040504] xilinx-dp-snd-pcm zynqmp_dp_snd_pcm1: Xilinx DisplayPort Sound
PCM probed
[ 3.048886] xilinx-dp-snd-card fd4a0000.zynqmp-display:zynqmp_dp_snd_card:
xilinx-dp-snd-codec-dai <-> xilinx-dp-snd-codec-dai mapping ok
[ 3.061280] xilinx-dp-snd-card fd4a0000.zynqmp-display:zynqmp_dp_snd_card:
xilinx-dp-snd-codec-dai <-> xilinx-dp-snd-codec-dai mapping ok
[ 3.073936] xilinx-dp-snd-card fd4a0000.zynqmp-display:zynqmp_dp_snd_card:
Xilinx DisplayPort Sound Card probed
[ 3.084062] OF: graph: no port node found in /amba/zynqmp-display@fd4a0000
[ 3.090971] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 3.097503] [drm] No driver support for vblank timestamp query.
[ 3.103488] xlnx-drm xlnx-drm.0: bound fd4a0000.zynqmp-display (ops
zynqmp_dpsub_component_ops)
[ 4.188694] [drm] Cannot find any crtc or sizes
[ 4.193346] [drm] Initialized xlnx 1.0.0 20130509 for
fd4a0000.zynqmp-display on minor 0
[ 4.201380] zynqmp-display fd4a0000.zynqmp-display: ZynqMP DisplayPort
Subsystem driver probed
[ 4.211038] xilinx-psgtr fd400000.zynqmp_phy: Lane:2 type:0 protocol:3
pll_locked:yes
[ 4.222487] xilinx-psgtr fd400000.zynqmp_phy: Lane:3 type:1 protocol:3
pll_locked:yes
[ 4.232512] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 4.237933] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus
number 1
[ 4.245784] xhci-hcd xhci-hcd.0.auto: hcc params 0x0238f625 hci version
0x100 quirks 0x22010010
[ 4.254442] xhci-hcd xhci-hcd.0.auto: irq 49, io mem 0xfe300000
[ 4.260440] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 4.267149] usb usb1: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 4.274351] usb usb1: Product: xHCI Host Controller
[ 4.279206] usb usb1: Manufacturer: Linux 4.14.0-xilinx-v2018.2 xhci-hcd
[ 4.285891] usb usb1: SerialNumber: xhci-hcd.0.auto
[ 4.291064] hub 1-0:1.0: USB hub found
[ 4.294760] hub 1-0:1.0: 1 port detected
[ 4.298838] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 4.304249] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus
number 2
[ 4.311931] usb usb2: We don't know the algorithms for LPM for this host,
disabling LPM.
[ 4.320040] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[ 4.326751] usb usb2: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 4.333954] usb usb2: Product: xHCI Host Controller
[ 4.338812] usb usb2: Manufacturer: Linux 4.14.0-xilinx-v2018.2 xhci-hcd
[ 4.345497] usb usb2: SerialNumber: xhci-hcd.0.auto
[ 4.350599] hub 2-0:1.0: USB hub found
[ 4.354291] hub 2-0:1.0: 1 port detected
[ 4.359844] i2c i2c-0: Added multiplexed i2c bus 2
[ 4.364707] i2c i2c-0: Added multiplexed i2c bus 3
[ 4.369552] i2c i2c-0: Added multiplexed i2c bus 4
[ 4.374391] i2c i2c-0: Added multiplexed i2c bus 5
[ 4.379547] tps65086 6-005e: Failed to read revision register
[ 4.385324] i2c i2c-0: Added multiplexed i2c bus 6
[ 4.390633] ina2xx 7-0040: power monitor ina226 (Rshunt = 10000 uOhm)
[ 4.397028] i2c i2c-0: Added multiplexed i2c bus 7
[ 4.401906] i2c i2c-0: Added multiplexed i2c bus 8
[ 4.406745] i2c i2c-0: Added multiplexed i2c bus 9
[ 4.411461] pca954x 0-0075: registered 8 multiplexed busses for I2C switch
pca9548
[ 4.419033] cdns-i2c ff030000.i2c: 400 kHz mmio ff030000 irq 31
[ 4.426613] sdhci-arasan ff170000.sdhci: allocated mmc-pwrseq
[ 4.476690] mmc1: SDHCI controller on ff170000.sdhci [ff170000.sdhci] using
ADMA 64-bit
[ 4.491973] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[ 4.498874] rtc_zynqmp ffa60000.rtc: setting system clock to 1970-01-01
00:00:07 UTC (7)
[ 4.506893] of_cfs_init
[ 4.509363] of_cfs_init: OK
[ 4.512201] clk: Not disabling unused clocks
[ 4.516425] ALSA device list:
[ 4.519337] #0: DisplayPort monitor
[ 4.526897] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature
incompatibilities
[ 4.527191] sdhci-arasan ff170000.sdhci: card claims to support voltages
below defined range
[ 4.539633] mmc1: new high speed SDIO card at address 0001
[ 4.540279] wl18xx_driver wl18xx.1.auto: Direct firmware load for
ti-connectivity/wl1271-nvs.bin failed with error -2
[ 4.540307] wl18xx_driver wl18xx.1.auto: Direct firmware load for
ti-connectivity/wl18xx-conf.bin failed with error -2
[ 4.540310] wlcore: ERROR could not get configuration binary
ti-connectivity/wl18xx-conf.bin: -2
[ 4.540312] wlcore: WARNING falling back to default config
[ 4.712732] usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
[ 4.737062] usb 2-1: New USB device found, idVendor=0424, idProduct=5744
[ 4.743684] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=0
[ 4.750798] usb 2-1: Product: USB5744
[ 4.754440] usb 2-1: Manufacturer: Microchip Tech
[ 4.760027] hub 2-1:1.0: USB hub found
[ 4.763727] hub 2-1:1.0: 3 ports detected
[ 4.864686] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 4.877109] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[ 4.886070] wlcore: loaded
[ 5.017196] usb 1-1: New USB device found, idVendor=0424, idProduct=2744
[ 5.023820] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5.030935] usb 1-1: Product: USB2744
[ 5.034578] usb 1-1: Manufacturer: Microchip Tech
[ 5.048031] hub 1-1:1.0: USB hub found
[ 5.051731] hub 1-1:1.0: 4 ports detected
[ 5.364689] usb 1-1.4: new high-speed USB device number 3 using xhci-hcd
[ 5.436698] [drm] Cannot find any crtc or sizes
[ 5.469700] usb 1-1.4: New USB device found, idVendor=0424, idProduct=2740
[ 5.476500] usb 1-1.4: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[ 5.483790] usb 1-1.4: Product: Hub Controller
[ 5.488215] usb 1-1.4: Manufacturer: Microchip Tech
[ 6.245132] EXT4-fs (mmcblk0p2): recovery complete
[ 6.253133] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode.
Opts: (null)
[ 6.261175] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 6.270077] devtmpfs: mounted
[ 6.273204] Freeing unused kernel memory: 512K
INIT: version 2.88 booting
Starting udev
[ 6.633073] udevd[1763]: starting version 3.2.2
[ 6.676042] udevd[1764]: starting eudev-3.2.2
[ 6.813886] zynqmp_r5_remoteproc ff9a0100.zynqmp_r5_rproc: RPU core_conf:
split0
[ 6.822245] remoteproc remoteproc0: ff9a0100.zynqmp_r5_rproc is available
[ 7.178718] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data
may be corrupt. Please run fsck.
[ 7.214439] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
Fri Mar 8 17:33:18 UTC 2019
Starting internet superserver: inetd.
INIT: Entering runlevel: 5
Configuring network interfaces... Cannot find device "eth0"
Starting Dropbear SSH server: dropbear.
Starting syslogd/klogd: done
Starting tcf-agent: OK
PetaLinux 2018.2 ultra96_project /dev/ttyPS0
ultra96_project login: root
Password:
7[r[999;999H[6n8root@ultra96_project:~# ja modpor robe jailhos
use
[ 18.894265] jailhouse: loading out-of-tree module taints kernel.
root@ultra96_project:~# jailhouse enable ultra96.cell
Initializing Jailhouse hypervisor v0.10 (49-g16c517b-dirty) on CPU 1
Code location: 0x0000ffffc0200800
Page pool usage after early setup: mem 39/996, remap 0/131072
Initializing processors:
CPU 1... OK
CPU 3... OK
CPU 0... OK
CPU 2... OK
Initializing unit: irqchip
Initializing unit: PCI
Adding virtual PCI device 00:00.0 to cell "root"
Page pool usage after late setup: mem 59/996, remap 5/131072
Activating hypervisor
[ 25.417895] OF: PCI: host bridge /pci@0 ranges:
[ 25.422378] OF: PCI: MEM 0xfc100000..0xfc101fff -> 0xfc100000
[ 25.428641] pci-host-generic fc000000.pci: ECAM at [mem
0xfc000000-0xfc0fffff] for [bus 00]
[ 25.437009] pci-host-generic fc000000.pci: PCI host bridge to bus 0000:00
[ 25.443730] pci_bus 0000:00: root bus resource [bus 00]
[ 25.448933] pci_bus 0000:00: root bus resource [mem 0xfc100000-0xfc101fff]
[ 25.456016] pci 0000:00:00.0: BAR 0: assigned [mem 0xfc100000-0xfc1000ff
64bit]
[ 25.463381] The Jailhouse is opening.
root@ultra96_project:~# om insod mod uio_ivshmem.ko
[ 32.873728] uio_ivshmem 0000:00:00.0: enabling device (0000 -> 0002)
[ 32.880086] uio_ivshmem 0000:00:00.0: using jailhouse mode
root@ultra96_project:~# insmod uio_ivshmem.ko
jailhouse cl ell create i i
ultra96-linux-demo.cell
[ 52.597233] CPU2: shutdown
[ 52.599871] psci: CPU2 killed.
[ 52.625262] CPU3: shutdown
[ 52.627889] psci: CPU3 killed.
Adding virtual PCI device 00:00.0 to cell "non-root"
Shared memory connection established: "non-root" <--> "root"
Created cell "non-root"
Page pool usage after cell creation: mem 75/996, remap 5/131072
[ 52.649396] Created Jailhouse cell "non-root"
root@ultra96_project:~# jailhouse cell create ultra96-linux-demo.cell
cat /proc/interrupts
CPU0 CPU1
3: 1812 1352 GICv2 30 Level arch_timer
6: 0 0 GICv2 67 Level ff9905c0.mailbox
7: 0 0 GICv2 175 Level arm-pmu
8: 0 0 GICv2 176 Level arm-pmu
9: 0 0 GICv2 177 Level arm-pmu
10: 0 0 GICv2 178 Level arm-pmu
12: 0 0 GICv2 156 Level zynqmp-dma
13: 0 0 GICv2 157 Level zynqmp-dma
14: 0 0 GICv2 158 Level zynqmp-dma
15: 0 0 GICv2 159 Level zynqmp-dma
16: 0 0 GICv2 160 Level zynqmp-dma
17: 0 0 GICv2 161 Level zynqmp-dma
18: 0 0 GICv2 162 Level zynqmp-dma
19: 0 0 GICv2 163 Level zynqmp-dma
21: 0 0 GICv2 109 Level zynqmp-dma
22: 0 0 GICv2 110 Level zynqmp-dma
23: 0 0 GICv2 111 Level zynqmp-dma
24: 0 0 GICv2 112 Level zynqmp-dma
25: 0 0 GICv2 113 Level zynqmp-dma
26: 0 0 GICv2 114 Level zynqmp-dma
27: 0 0 GICv2 115 Level zynqmp-dma
28: 0 0 GICv2 116 Level zynqmp-dma
31: 8 0 GICv2 50 Level cdns-i2c
32: 0 0 GICv2 42 Level ff960000.memory-controller
33: 0 0 GICv2 57 Level axi-pmon
34: 0 0 GICv2 58 Level ffa60000.rtc
35: 0 0 GICv2 59 Level ffa60000.rtc
36: 1101 0 GICv2 80 Level mmc0
37: 296 0 GICv2 81 Level mmc1
38: 0 0 GICv2 51 Level ff040000.spi
39: 0 0 GICv2 52 Level ff050000.spi
41: 452 0 GICv2 54 Level xuartps
42: 0 0 GICv2 88 Level ams-irq
43: 0 0 GICv2 154 Level fd4c0000.dma
44: 0 0 GICv2 151 Level fd4a0000.zynqmp-display
45: 0 0 GICv2 61 Level ff9a0100.zynqmp_r5_rproc
49: 86 0 GICv2 102 Level xhci-hcd:usb1
53: 0 0 zynq-gpio 23 Edge sw4
54: 0 0 zynq-gpio 76 Edge wl18xx
55: 0 0 GICv2 136 Edge uio_ivshmem
IPI0: 1116 1320 Rescheduling interrupts
IPI1: 8 6 Function call interrupts
IPI2: 0 0 CPU stop interrupts
IPI3: 0 0 CPU stop (for crash dump) interrupts
IPI4: 389 492 Timer broadcast interrupts
IPI5: 0 0 IRQ work interrupts
IPI6: 0 0 CPU wake-up interrupts
Err: 0
root@ultra96_project:~# cat /proc/iomem
00000000-3ecfffff : System RAM
00080000-00deffff : Kernel code
00e70000-01134fff : Kernel data
3ed00000-3ed3ffff : 3ed00000.ddr
3fd00000-5fffffff : System RAM
7c000000-7c3fffff : Jailhouse hypervisor
fc000000-fc0fffff : PCI ECAM
fc100000-fc101fff : //pci@0
fc100000-fc1000ff : 0000:00:00.0
fc100000-fc1000ff : ivshmem
fd3d0000-fd3d0fff : siou
fd400000-fd43ffff : serdes
fd4a0000-fd4a0fff : dp
fd4aa000-fd4aafff : blend
fd4ab000-fd4abfff : av_buf
fd4ac000-fd4acfff : aud
fd4c0000-fd4c0fff : /amba/dma@fd4c0000
fd500000-fd500fff : /amba/dma@fd500000
fd510000-fd510fff : /amba/dma@fd510000
fd520000-fd520fff : /amba/dma@fd520000
fd530000-fd530fff : /amba/dma@fd530000
fd540000-fd540fff : /amba/dma@fd540000
fd550000-fd550fff : /amba/dma@fd550000
fd560000-fd560fff : /amba/dma@fd560000
fd570000-fd570fff : /amba/dma@fd570000
fd6e9000-fd6edfff : /amba/cci@fd6e0000/pmu@9000
fe20c100-fe23ffff : /amba/usb0@ff9d0000/dwc3@fe200000
fe300000-fe307fff : /amba/usb1@ff9e0000/dwc3@fe300000
fe300000-fe307fff : /amba/usb1@ff9e0000/dwc3@fe300000
fe30c100-fe33ffff : /amba/usb1@ff9e0000/dwc3@fe300000
ff000000-ff000fff : xuartps
ff010000-ff010fff : xuartps
ff030000-ff030fff : /amba/i2c@ff030000
ff040000-ff040fff : /amba/spi@ff040000
ff050000-ff050fff : /amba/spi@ff050000
ff0a0000-ff0a0fff : /amba/gpio@ff0a0000
ff160000-ff160fff : /amba/sdhci@ff160000
ff170000-ff170fff : /amba/sdhci@ff170000
ff960000-ff960fff : /amba/memory-controller@ff960000
ff9905c0-ff9905df : local_request_region
ff9905e0-ff9905ff : local_response_region
ff990e80-ff990e9f : remote_request_region
ff990ea0-ff990ebf : remote_response_region
ff9d0000-ff9d00ff : /amba/usb0@ff9d0000
ff9e0000-ff9e00ff : /amba/usb1@ff9e0000
ffa00000-ffa0ffff : /amba/perf-monitor@ffa00000
ffa50000-ffa507ff : ams-base
ffa60000-ffa600ff : /amba/rtc@ffa60000
ffa80000-ffa80fff : /amba/dma@ffa80000
ffa90000-ffa90fff : /amba/dma@ffa90000
ffaa0000-ffaa0fff : /amba/dma@ffaa0000
ffab0000-ffab0fff : /amba/dma@ffab0000
ffac0000-ffac0fff : /amba/dma@ffac0000
ffad0000-ffad0fff : /amba/dma@ffad0000
ffae0000-ffae0fff : /amba/dma@ffae0000
ffaf0000-ffaf0fff : /amba/dma@ffaf0000
ffe00000-ffe0ffff : ffe00000.tcm
ffe20000-ffe2ffff : ffe20000.tcm
root@ultra96_project:~# jailhouse cell load non-root ivshmem-demo.bin
Cell "non-root" can be loaded
root@ultra96_project:~# jailhouse cell load non-root ivshmem-demo.bin
[1P[1P[1P[1P[1@s[1@t[1@a[1@r[1@t
Started cell "non-root"
root@ultra96_project:~# iivvsshhmmeemm--ddeemmoo ssttaarrttiinngg......
^C
root@ultra96_project:~# /*
* Jailhouse, a Linux-based partitioning hypervisor
*
* Copyright (c) ARM Limited, 2014
* Copyright (c) Siemens AG, 2014-2017
*
* Authors:
* Jean-Philippe Brucker <[email protected]>
* Jan Kiszka <[email protected]>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*/
//#include <mach.h>
#include <inmate.h>
#define VENDORID 0x1af4
#define DEVICEID 0x1110
#define IVSHMEM_CFG_SHMEM_PTR 0x40
#define IVSHMEM_CFG_SHMEM_SZ 0x48
#define JAILHOUSE_SHMEM_PROTO_UNDEFINED 0x0000
//#define IVSHMEM_IRQ 38
#define IVSHMEM_IRQ 140
#define MAX_NDEV 4
//#define SHARED_MEM_ADDR 0x800400000
#define IVSHMEM_PCI_REG_ADDR 0xfc100000
static char str[64] = "Hello from bare-metal ivshmem-demo inmate!!! ";
static int irq_counter;
struct ivshmem_dev_data {
u16 bdf;
u32 *registers;
void *shmem;
//u32 *msix_table;
u64 shmemsz;
u64 bar2sz;
};
struct ivshmem_dev_data *d = NULL;
static struct ivshmem_dev_data devs[MAX_NDEV];
static u64 pci_cfg_read64(u16 bdf, unsigned int addr)
{
u64 bar;
bar = ((u64)pci_read_config(bdf, addr + 4, 4) << 32) |
pci_read_config(bdf, addr, 4);
return bar;
}
static void pci_cfg_write64(u16 bdf, unsigned int addr, u64 val)
{
pci_write_config(bdf, addr + 4, (u32)(val >> 32), 4);
pci_write_config(bdf, addr, (u32)val, 4);
}
static u64 get_bar_sz(u16 bdf, u8 barn)
{
u64 bar, tmp;
u64 barsz;
bar = pci_cfg_read64(bdf, PCI_CFG_BAR + (8 * barn));
pci_cfg_write64(bdf, PCI_CFG_BAR + (8 * barn), 0xffffffffffffffffULL);
tmp = pci_cfg_read64(bdf, PCI_CFG_BAR + (8 * barn));
barsz = ~(tmp & ~(0xf)) + 1;
pci_cfg_write64(bdf, PCI_CFG_BAR + (8 * barn), bar);
return barsz;
}
static int map_shmem_and_bars(struct ivshmem_dev_data *d)
{
if (0 > pci_find_cap(d->bdf, PCI_CAP_MSIX)) {
printk("IVSHMEM ERROR: device is not MSI-X capable\n");
//return 1;
}
d->shmemsz = pci_cfg_read64(d->bdf, IVSHMEM_CFG_SHMEM_SZ);
/*d->shmem = (void *)((u32)(0xffffffff & pci_cfg_read64(d->bdf, IVSHMEM_CFG_SHMEM_PTR)));*/
d->shmem = (void *)((u64)(0xffffffffffffffff & pci_cfg_read64(d->bdf, IVSHMEM_CFG_SHMEM_PTR)));
printk("IVSHMEM: shmem is at %p, shmemsz is %llu\n", d->shmem, d->shmemsz);
//d->registers = (u32 *)(((u64)(d->shmem + d->shmemsz + PAGE_SIZE - 1)) & PAGE_MASK); // this gives 0x800500000 as a result, which I believe is wrong
d->registers = (u32 *) IVSHMEM_PCI_REG_ADDR; //added by Giovani
/* (u32 *)(((u32)(d->shmem + d->shmemsz + PAGE_SIZE - 1)) & PAGE_MASK);*/
/*pci_cfg_write64(d->bdf, PCI_CFG_BAR, (u32)d->registers);*/
pci_cfg_write64(d->bdf, PCI_CFG_BAR, (u64)d->registers);
printk("IVSHMEM: bar0 is at %p\n", d->registers);
d->bar2sz = get_bar_sz(d->bdf, 2);
/*
d->msix_table =
(u32 *)(d->registers + PAGE_SIZE);
pci_cfg_write64(d->bdf, PCI_CFG_BAR + 16, (u32)d->msix_table);
printk("IVSHMEM: bar2 is at %p\n", d->msix_table);
*/
pci_write_config(d->bdf, PCI_CFG_COMMAND,
(PCI_CMD_MEM | PCI_CMD_MASTER), 2);
return 0;
}
static u32 get_ivpos(struct ivshmem_dev_data *d)
{
return mmio_read32(d->registers + 2);
}
static void send_irq(struct ivshmem_dev_data *d)
{
//printk("IVSHMEM: LSTATE = %d, RSTATE = %d\n", mmio_read32(d->registers + 4), mmio_read32(d->registers + 5));
printk("IVSHMEM: sending IRQ - addr = %p\n", (d->registers + 3));
mmio_write32(d->registers + 3, 1);
}
static void enable_irq(struct ivshmem_dev_data *d)
{
printk("IVSHMEM: Enabling IVSHMEM_IRQs registers = %p\n", d->registers);
mmio_write32(d->registers, 0xffffffff);
}
/*static u64 ticks_per_beat;
static volatile u64 expected_ticks;
#define BEATS_PER_SEC 100
*/
static void handle_IRQ(unsigned int irqn)
{
printk("IVSHMEM: handle_irq(irqn:%d) - interrupt #%d\n", irqn, irq_counter++);
/*if(irqn == TIMER_IRQ && irq_counter % 10000 == 0) {
printk("IVSHMEM: sending interrupt.\n");
send_irq(d); //it works
expected_ticks = timer_get_ticks() + ticks_per_beat;
timer_start(ticks_per_beat);
}*/
}
void inmate_main(void)
{
unsigned int i = 0;
int bdf = 0;
unsigned int class_rev;
//struct ivshmem_dev_data *d = NULL;
volatile char *shmem;
int ndevices = 0;
printk("ivshmem-demo starting...\n");
gic_setup(handle_IRQ);
/*gic_enable_irq(TIMER_IRQ);
printk("Initializing the timer...\n");
ticks_per_beat = timer_get_frequency() / BEATS_PER_SEC;
expected_ticks = timer_get_ticks() + ticks_per_beat;
timer_start(ticks_per_beat);*/
/*gic_enable_irq(IVSHMEM_IRQ);
printk("ivshmem-demo starting...\n");
void *ptr = (unsigned int *) SHARED_MEM_ADDR;
for(int i = 0; i < 16; i += 4) {
*((volatile unsigned int *) (ptr + i)) = i + 1;
printk("Address: %p, Read value = %d\n", (void *)(ptr + i), *((unsigned int *) (ptr + i)));
}
for(int i = 0; i < 16; i += 4) {
*((volatile unsigned int *) (ptr + i)) = 100;
printk("Address: %p, Read value = %d\n", (void *)(ptr + i), *((unsigned int *) (ptr + i)));
}*/
//printk("mmio_read16 = %u\n", mmio_read16((void *)0xfc000000));
bdf = pci_find_device(VENDORID, DEVICEID, bdf);
printk("bdf value after pci_find_device = %d\n", bdf);
while ((ndevices < MAX_NDEV) && (-1 != (bdf = pci_find_device(VENDORID, DEVICEID, bdf)))) {
printk("IVSHMEM: Found %04x:%04x at %02x:%02x.%x\n",
pci_read_config(bdf, PCI_CFG_VENDOR_ID, 2),
pci_read_config(bdf, PCI_CFG_DEVICE_ID, 2),
bdf >> 8, (bdf >> 3) & 0x1f, bdf & 0x3);
class_rev = pci_read_config(bdf, 0x8, 4);
if (class_rev != (PCI_DEV_CLASS_OTHER << 24 |
JAILHOUSE_SHMEM_PROTO_UNDEFINED << 8)) {
printk("IVSHMEM: class/revision %08x, not supported "
"skipping device\n", class_rev);
bdf++;
continue;
}
ndevices++;
d = devs + ndevices - 1;
d->bdf = bdf;
if (map_shmem_and_bars(d)) {
printk("IVSHMEM: Failure mapping shmem and bars.\n");
return;
}
printk("IVSHMEM: mapped shmem and bars, got position %d - bdf = %d\n",
get_ivpos(d), bdf);
/* NULL terminating the string */
str[63] = 0;
printk("IVSHMEM: memcpy(%p, %s, %d)\n", d->shmem, str, 64);
memcpy(d->shmem, str, 64);
printk("IVSHMEM: %p:%p\n", d->shmem, d->shmem);
gic_enable_irq(IVSHMEM_IRQ + ndevices - 1);
printk("IVSHMEM: Enabled IRQ:0x%x\n", IVSHMEM_IRQ + ndevices -1);
enable_irq(d);
//pci_msix_set_vector(bdf, IVSHMEM_IRQ + ndevices - 1, 0);
//printk("IVSHMEM: Vector set for PCI MSI-X.\n");
bdf++;
}
if (!ndevices) {
printk("IVSHMEM: No PCI devices found .. nothing to do.\n");
return;
}
printk("IVSHMEM: Done setting up...\n");
{
u8 buf[64];
memcpy(buf, d->shmem, sizeof(buf)/sizeof(buf[0]));
buf[63] = 0;
printk("IVSHMEM: %s\n", buf);
memcpy(d->shmem, str, sizeof(str)/sizeof(str[0]));
}
while (1) {
for (i = 0; i < ndevices; i++) {
d = devs + i;
//delay_us(1000*1000);
shmem = d->shmem;
shmem[19]++;
printk("IVSHMEM: sending interrupt.\n");
send_irq(d);
}
printk("IVSHMEM: waiting for interrupt.\n");
asm volatile("wfi" : : : "memory");
}
}