@@ -56,6 +56,7 @@
#define MSR_KVM_WALL_CLOCK 0x11
#define MSR_KVM_SYSTEM_TIME 0x12
+#define MSR_KVM_LOAD_XENNER_FIRMWARE 0x40000000
#define KVM_MAX_MMU_OP_BATCH 32
@@ -192,6 +192,7 @@
unsigned long mmu_notifier_seq;
long mmu_notifier_count;
#endif
+ struct device *kvm_dev;
};
/* The guest did something we don't support. */
@@ -816,6 +816,8 @@
};
#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */
+static struct miscdevice kvm_dev;
+
static struct kvm *kvm_create_vm(void)
{
struct kvm *kvm = kvm_arch_create_vm();
@@ -869,6 +871,7 @@
#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
kvm_coalesced_mmio_init(kvm);
#endif
+ kvm->kvm_dev = kvm_dev.this_device;
out:
return kvm;
}
@@ -77,6 +77,7 @@
#include <linux/iommu.h>
#include <linux/intel-iommu.h>
#include <linux/cpufreq.h>
+#include <linux/firmware.h>
#include <asm/uaccess.h>
#include <asm/msr.h>
@@ -846,6 +847,22 @@
kvm_request_guest_time_update(vcpu);
break;
}
+ case MSR_KVM_LOAD_XENNER_FIRMWARE: {
+ const char *fw_name = (vcpu->arch.shadow_efer & EFER_LME
+ ? "xenner/hvm64.bin"
+ : "xenner/hvm32.bin");
+ const struct firmware *firmware;
+ uint32_t page = data & ~PAGE_MASK;
+ uint64_t paddr = data & PAGE_MASK;
+ if (request_firmware(&firmware, fw_name, vcpu->kvm->kvm_dev))
+ return 1;
+ printk(KERN_INFO "kvm: loading %s page %d to %llx\n",
+ fw_name, page, paddr);
+ kvm_write_guest(vcpu->kvm, paddr,
+ firmware->data + page * PAGE_SIZE, PAGE_SIZE);
+ release_firmware(firmware);
+ break;
+ }
default:
pr_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n", msr, data);
return 1;