Re: [PATCH 23/28] kvm tools: Endian-sanitise pci.h and PCI device setup

Pekka Enberg
2011-12-06T11:41:56Z

On Tue, Dec 6, 2011 at 12:28 PM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> On Tue, Dec 06, 2011 at 12:25:29PM +0200, Pekka Enberg wrote:
>> On Tue, Dec 6, 2011 at 5:42 AM, Matt Evans <matt@ozlabs.org> wrote:
>> > vesa, pci-shmem and virtio-pci devices need to set up config space with
>> > little-endian conversions (as config space is LE).  The pci_config_address
>> > bitfield also needs to be reversed when building on BE systems.
>> >
>> > Signed-off-by: Matt Evans <matt@ozlabs.org>
>>
>> Looks OK to me. Sasha, Cyrill?
>>
>
> BIOS part looks pretty good to me. LE/BE part as well. Thanks Matt!

Hmm. This seems to break "make check" for me:

./kvm run -d tests/boot/boot_test.iso -p "init=init"
# kvm run -k ../../arch/x86/boot/bzImage -m 448 -c 4 --name guest-2845
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.2.0-rc3 (penberg@tux) (gcc version
4.6.0 20110603 (Red Hat 4.6.0-10) (GCC) ) #67 SMP Thu Nov 24 11:05:24
EET 2011
[ 0.000000] Command line: noapic noacpi pci=conf1 reboot=k panic=1
i8042.direct=1 i8042.dumbkbd=1 i8042.nopnp=1 console=ttyS0
earlyprintk=serial i8042.noaux=1 init=init root=/dev/vda rw
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
[ 0.000000] BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
[ 0.000000] BIOS-e820: 00000000000f0000 - 00000000000fffff (reserved)
[ 0.000000] BIOS-e820: 0000000000100000 - 000000001c000000 (usable)
[ 0.000000] bootconsole [earlyser0] enabled
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] DMI not present or invalid.
[ 0.000000] No AGP bridge found
[ 0.000000] last_pfn = 0x1c000 max_arch_pfn = 0x400000000
[ 0.000000] x86 PAT enabled: cpu 0, old 0x70106, new 0x7010600070106
[ 0.000000] CPU MTRRs all blank - virtualized system.
[ 0.000000] found SMP MP-table at [ffff8800000f0390] f0390
[ 0.000000] init_memory_mapping: 0000000000000000-000000001c000000
[ 0.000000] ACPI Error: A valid RSDP was not found (20110623/tbxfroot-219)
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at 0000000000000000-000000001c000000
[ 0.000000] Initmem setup node 0 0000000000000000-000000001c000000
[ 0.000000] NODE_DATA [000000001bfec000 - 000000001bffffff]
[ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[ 0.000000] kvm-clock: cpu 0, msr 0:1b71301, boot clock
[ 0.000000] Zone PFN ranges:
[ 0.000000] DMA 0x00000010 -> 0x00001000
[ 0.000000] DMA32 0x00001000 -> 0x00100000
[ 0.000000] Normal empty
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[2] active PFN ranges
[ 0.000000] 0: 0x00000010 -> 0x0000009f
[ 0.000000] 0: 0x00000100 -> 0x0001c000
[ 0.000000] SFI: Simple Firmware Interface v0.81 http://simplefirmware.org
[ 0.000000] Intel MultiProcessor Specification v1.4
[ 0.000000] MPTABLE: OEM ID: KVMCPU00
[ 0.000000] MPTABLE: Product ID: 0.1
[ 0.000000] MPTABLE: APIC at: 0xFEE00000
[ 0.000000] Processor #0 (Bootup-CPU)
[ 0.000000] Processor #1
[ 0.000000] Processor #2
[ 0.000000] Processor #3
[ 0.000000] IOAPIC[0]: apic_id 5, version 17, address 0xfec00000, GSI 0-23
[ 0.000000] Processors: 4
[ 0.000000] SMP: Allowing 4 CPUs, 0 hotplug CPUs
[ 0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
[ 0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000f0000
[ 0.000000] PM: Registered nosave memory: 00000000000f0000 - 00000000000ff000
[ 0.000000] PM: Registered nosave memory: 00000000000ff000 - 0000000000100000
[ 0.000000] Allocating PCI resources starting at 1c000000 (gap:
1c000000:e4000000)
[ 0.000000] Booting paravirtualized kernel on KVM
[ 0.000000] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256
nr_cpu_ids:4 nr_node_ids:1
[ 0.000000] PERCPU: Embedded 27 pages/cpu @ffff88001bc00000 s77888
r8192 d24512 u524288
[ 0.000000] kvm-clock: cpu 0, msr 0:1bc12301, primary cpu clock
[ 0.000000] KVM setup async PF for cpu 0
[ 0.000000] kvm-stealtime: cpu 0, msr 1bc0d000
[ 0.000000] Built 1 zonelists in Node order, mobility grouping on.
Total pages: 112778
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: noapic noacpi pci=conf1 reboot=k
panic=1 i8042.direct=1 i8042.dumbkbd=1 i8042.nopnp=1 console=ttyS0
earlyprintk=serial i8042.noaux=1 init=init root=/dev/vda rw
[ 0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.000000] xsave/xrstor: enabled xstate_bv 0x7, cntxt size 0x340
[ 0.000000] Checking aperture...
[ 0.000000] No AGP bridge found
[ 0.000000] Memory: 435408k/458752k available (4752k kernel code,
452k absent, 22892k reserved, 6886k data, 908k init)
[ 0.000000] SLUB: Genslabs\x15, HWalignd, Order=0-3, MinObjects=0,
CPUs=4, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU dyntick-idle grace-period acceleration is enabled.
[ 0.000000] NR_IRQS:16640 nr_irqs:712 16
[ 0.000000] Console: colour *CGA 80x25
[ 0.000000] console [ttyS0] enabled, bootconsole disabled
[ 0.000000] console [ttyS0] enabled, bootconsole disabled
[ 0.000000] allocated 4194304 bytes of page_cgroup
[ 0.000000] please try 'cgroup_disable=memory' option if you don't
want memory cgroups
[ 0.000000] Detected 2691.682 MHz processor.
[ 0.000999] Calibrating delay loop (skipped) preset value.. 5383.36
BogoMIPS (lpj&91682)
[ 0.002009] pid_max: default: 32768 minimum: 301
[ 0.002722] Security Framework initialized
[ 0.003146] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
[ 0.005202] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
[ 0.006221] Mount-cache hash table entries: 256
[ 0.007267] Initializing cgroup subsys cpuacct
[ 0.007810] Initializing cgroup subsys memory
[ 0.008042] Initializing cgroup subsys devices
[ 0.008591] Initializing cgroup subsys freezer
[ 0.009003] Initializing cgroup subsys net_cls
[ 0.009452] Initializing cgroup subsys blkio
[ 0.010015] Initializing cgroup subsys perf_event
[ 0.010554] CPU: Physical Processor ID: 0
[ 0.011002] CPU: Processor Core ID: 0
[ 0.011390] mce: CPU supports 32 MCE banks
[ 0.013371] ftrace: allocating 24096 entries in 95 pages
[ 0.016161] CPU0: Intel 06/2a stepping 07
[ 0.118022] Performance Events: unsupported p6 CPU model 42 no PMU
driver, software events only.
[ 0.119085] NMI watchdog disabled (cpu0): hardware events not enabled
[ 0.119886] Booting Node 0, Processors #1
[ 0.132990] kvm-clock: cpu 1, msr 0:1bc92301, secondary cpu clock
[ 0.133013] NMI watchdog disabled (cpu1): hardware events not enabled
[ 0.133155] #2
[ 0.133035] KVM setup async PF for cpu 1
[ 0.133035] kvm-stealtime: cpu 1, msr 1bc8d000
[ 0.146998] kvm-clock: cpu 2, msr 0:1bd12301, secondary cpu clock
[ 0.147018] NMI watchdog disabled (cpu2): hardware events not enabled
[ 0.147158] #3 Ok.
[ 0.147042] KVM setup async PF for cpu 2
[ 0.147042] kvm-stealtime: cpu 2, msr 1bd0d000
[ 0.159987] kvm-clock: cpu 3, msr 0:1bd92301, secondary cpu clock
[ 0.160018] NMI watchdog disabled (cpu3): hardware events not enabled
[ 0.160052] Brought up 4 CPUs
[ 0.160054] Total of 4 processors activated (21533.45 BogoMIPS).
[ 0.160050] KVM setup async PF for cpu 3
[ 0.160050] kvm-stealtime: cpu 3, msr 1bd8d000
[ 0.166066] devtmpfs: initialized
[ 0.169332] atomic64 test passed for x86-64 platform with CX8 and with SSE
[ 0.170095] RTC time: 11:40:38, date: 12/06/11
[ 0.170631] NET: Registered protocol family 16
[ 0.173092] PCI: Using configuration type 1 for base access
[ 0.175422] bio: create slab <bio-0> at 0
[ 0.176087] ACPI: Interpreter disabled.
[ 0.177069] vgaarb: loaded
[ 0.177585] SCSI subsystem initialized
[ 0.178077] usbcore: registered new interface driver usbfs
[ 0.179013] usbcore: registered new interface driver hub
[ 0.180077] usbcore: registered new device driver usb
[ 0.181129] PCI: Probing PCI hardware
[ 0.182273] NetLabel: Initializing
[ 0.182984] NetLabel: domain hash size = 128
[ 0.183675] NetLabel: protocols = UNLABELED CIPSOv4
[ 0.183994] NetLabel: unlabeled traffic allowed by default
[ 0.184986] Switching to clocksource kvm-clock
[ 0.193502] pnp: PnP ACPI: disabled
[ 0.201702] NET: Registered protocol family 2
[ 0.202465] IP route cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.203701] TCP established hash table entries: 16384 (order: 6,
262144 bytes)
[ 0.204975] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[ 0.206334] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.207420] TCP reno registered
[ 0.207919] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.208865] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.209934] NET: Registered protocol family 1
[ 0.210904] kvm: no hardware support
[ 0.211689] platform rtc_cmos: registered platform RTC device (no
PNP device found)
[ 0.217236] alg: No test for __gcm-aes-aesni (__driver-gcm-aes-aesni)
[ 0.218979] audit: initializing netlink socket (disabled)
[ 0.220207] type 00 audit(1323171638.219:1): initialized
[ 0.237755] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[ 0.240695] VFS: Disk quotas dquot_6.5.2
[ 0.241409] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.242980] Installing v9fs 9p2000 file system support
[ 0.243865] msgmni has been set to 850
[ 0.245846] alg: No test for stdrng (krng)
[ 0.246747] NET: Registered protocol family 38
[ 0.247489] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 253)
[ 0.248841] io scheduler noop registered
[ 0.249551] io scheduler deadline registered
[ 0.250295] io scheduler cfq registered (default)
[ 0.251156] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 0.252108] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[ 0.253206] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[ 0.254505] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 0.276481] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 0.306891] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[ 0.333156] serial8250: ttyS2 at I/O 0x3e8 (irq = 4) is a 16550A
[ 0.334767] Non-volatile memory driver v1.3
[ 0.335276] Linux agpgart interface v0.103
[ 0.338190] brd: module loaded
[ 0.339946] loop: module loaded
[ 0.340440] Fixed MDIO Bus: probed
[ 0.340946] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.341698] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.342413] uhci_hcd: USB Universal Host Controller Interface driver
[ 0.343194] usbcore: registered new interface driver usbserial
[ 0.343840] USB Serial support registered for generic
[ 0.344436] usbcore: registered new interface driver usbserial_generic
[ 0.345170] usbserial: USB Serial Driver core
[ 0.345649] i8042: PNP detection disabled
[ 0.346277] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 0.347061] mousedev: PS/2 mouse device common for all mice
[ 0.348078] input: AT Raw Set 2 keyboard as
/devices/platform/i8042/serio0/input/input0
[ 0.349770] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
[ 0.350818] rtc_cmos rtc_cmos: only 24-hr supported
[ 0.351831] device-mapper: uevent: version 1.0.3
[ 0.352788] device-mapper: ioctl: 4.22.0-ioctl (2011-10-19)
initialised: dm-devel@redhat.com
[ 0.354096] cpuidle: using governor ladder
[ 0.354554] cpuidle: using governor menu
[ 0.354982] EFI Variables Facility v0.08 2004-May-17
[ 0.355676] usbcore: registered new interface driver usbhid
[ 0.356297] usbhid: USB HID core driver
[ 0.356748] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 0.357344] TCP cubic registered
[ 0.357705] NET: Registered protocol family 17
[ 0.358214] Installing 9P2000 support
[ 0.358627] Registering the dns_resolver key type
[ 0.359358] registered taskstats version 1
[ 0.359824] IMA: No TPM chip found, activating TPM-bypass!
[ 0.360677] Magic number: 7:784:680
[ 0.361129] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 0.361841] Initializing network drop monitor service
[ 0.362933] md: Waiting for all devices to be available before autodetect
[ 0.363691] md: If you don't use raid, use raid=noautodetect
[ 0.364537] md: Autodetecting RAID arrays.
[ 0.364997] md: Scanned 0 and added 0 devices.
[ 0.365502] md: autorun ...
[ 0.365809] md: ... autorun DONE.
[ 0.366234] VFS: Cannot open root device "vda" or unknown-block(0,0)
[ 0.367056] Please append a correct "root=" boot option; here are
the available partitions:
[ 0.368484] Kernel panic - not syncing: VFS: Unable to mount root
fs on unknown-block(0,0)
[ 0.369907] Pid: 1, comm: swapper Not tainted 3.2.0-rc3 #67
[ 0.370644] Call Trace:
[ 0.370922] [<ffffffff8148f63b>] panic+0x91/0x1a5
[ 0.371450] [<ffffffff81b73fc9>] mount_block_root+0x250/0x27b
[ 0.372107] [<ffffffff81b7417a>] mount_root+0x53/0x57
[ 0.372662] [<ffffffff81b742eb>] prepare_namespace+0x16d/0x1a6
[ 0.373312] [<ffffffff8109b4a3>] ? release_tgcred+0x2f/0x2f
[ 0.373923] [<ffffffff81b73cb5>] kernel_init+0x153/0x158
[ 0.374527] [<ffffffff81076758>] ? schedule_tail+0x27/0x6c
[ 0.375147] [<ffffffff814a0474>] kernel_thread_helper+0x4/0x10
[ 0.375785] [<ffffffff81b73b62>] ? start_kernel+0x3bd/0x3bd
[ 0.376408] [<ffffffff814a0470>] ? gs_change+0x13/0x13
[ 0.377064] Rebooting in 1 seconds..

*** Compatibility Warning ***

virtio-blk device was not detected

While you have requested a virtio-blk device, the guest kernel did not
initialize it.
Please make sure that the guest kernel was compiled with
CONFIG_VIRTIO_BLK=y enabled in its .config

# KVM session ended normally.