Skip to content

Instantly share code, notes, and snippets.

Ubuntu Cloud (xenial & bionic)

Works with NEMU and virt machine type. However boot hangs unless "console=hvc0" appended to kernel command line:

 sudo guestmount -i -a ~/workloads/xenial-server-cloudimg-amd64-uefi1.img /mnt
 sudo sed -i "s/console=tty1 console=ttyS0/console=tty1 console=ttyS0 console=hvc0/" /mnt/boot/grub/grub.cfg
 sudo umount /mnt
@rbradford
rbradford / gist:2587f1634000edbd7448294a387177d2
Created December 4, 2018 18:14
Patch to disable peer bridge fixup
diff -ur kata-linux-4.14.67-18/arch/x86/pci/legacy.c kata-linux-4.14.67-18.modified/arch/x86/pci/legacy.c
--- kata-linux-4.14.67-18/arch/x86/pci/legacy.c 2018-08-24 12:09:23.000000000 +0100
+++ kata-linux-4.14.67-18.modified/arch/x86/pci/legacy.c 2018-12-04 17:46:28.309874849 +0000
@@ -65,7 +65,7 @@
}
}
- pcibios_fixup_peer_bridges();
+ //pcibios_fixup_peer_bridges();
x86_init.pci.init_irq();
apic.dat dsdt.dat dump.out facp.dsl mcfg.dsl srat.dsl
apic.dsl dsdt.dsl facp.dat mcfg.dat srat.dat
cloud@cloud:~$ cat *.dsl
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20160108-64
* Copyright (c) 2000 - 2016 Intel Corporation
*
* Disassembly of apic.dat, Fri Aug 9 12:18:33 2019
@rbradford
rbradford / gist:27fad78a728da3897505b6a6a40f6eb8
Created August 21, 2019 11:11
IRQ differences with ACPI patches
# ttyS0 interrupt present
root@cloud-hypervisor ~ # cat /proc/cmdline
console=ttyS0 console=hvc0 root=/dev/vda3 quiet acpi=off
root@cloud-hypervisor ~ # cat /proc/interrupts
CPU0
4: 5 IO-APIC 4-edge ttyS0
24: 1 PCI-MSI 16384-edge virtio0-config
25: 50 PCI-MSI 16385-edge virtio0-virtqueues
@rbradford
rbradford / gist:5650a389afce2289e7a6e0527a1cb57b
Created August 22, 2019 15:49
Cloud Hypervisor DSDT ASL
DefinitionBlock ("", "DSDT", 6, "CLOUDH", "CHDSDT ", 0x00000001)
{
Device (_SB.PCI0)
{
Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
Name (_ADR, Zero) // _ADR: Address
Name (_SEG, Zero) // _SEG: PCI Segment
Name (_UID, Zero) // _UID: Unique ID
Name (SUPP, Zero)
diff --git a/devices/src/acpi.rs b/devices/src/acpi.rs
index 3165b504..e092e27d 100644
--- a/devices/src/acpi.rs
+++ b/devices/src/acpi.rs
@@ -37,6 +37,8 @@ impl BusDevice for AcpiShutdownDevice {
if let Err(e) = self.reset_evt.write(1) {
error!("Error triggering ACPI reset event: {}", e);
}
+
+ self.reset_evt.write(std::u64::MAX - 1).unwrap();
cloud-hypervisor: 554.735766ms: ERROR:vmm/src/cpu.rs:333 -- regs Ok(
kvm_regs {
rax: 0x1,
rbx: 0x7cc400,
rcx: 0x0,
rdx: 0x80,
rsi: 0x1029db,
rdi: 0x1fc338,
rsp: 0x1fac80,
rbp: 0x0,
RAX=0000000000000001 RBX=00000000007cc400 RCX=0000000000000000 RDX=0000000000000080
RSI=00000000001029db RDI=00000000001fc338 RBP=0000000000000000 RSP=00000000001fac80
R8 =00000000001029db R9 =0000000000102f72 R10=000000000004b7ff R11=2f2f2f2f2f2f2f2f
R12=00000000005d02a0 R13=00000000005d02a0 R14=00000000000000f0 R15=000000000004b000
RIP=000000000010eefe RFL=00000046 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
CS =0008 0000000000000000 00000000 00209f00 DPL=0 CS64 [CRA]
SS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
DS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
FS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
rob@artemis:~/src/linux (virtio-fs-virtio-iommu)$ diff -u config-working-hotplug-reboot .config
--- config-working-hotplug-reboot 2019-12-04 17:06:33.665919837 +0000
+++ .config 2019-12-05 08:32:12.602680837 +0000
@@ -61,6 +61,7 @@
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
+CONFIG_IRQ_MSI_IOMMU=y
CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y
CONFIG_GENERIC_IRQ_RESERVATION_MODE=y
DefinitionBlock ("", "DSDT", 6, "CLOUDH", "CHDSDT ", 0x00000001)
{
Device (_SB.PCI0)
{
Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
Name (_ADR, Zero) // _ADR: Address
Name (_SEG, Zero) // _SEG: PCI Segment
Name (_UID, Zero) // _UID: Unique ID
Name (SUPP, Zero)