Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356796
b: refs/heads/master
c: 55c171a
h: refs/heads/master
v: v3
  • Loading branch information
Cornelia Huck authored and Gleb Natapov committed Dec 18, 2012
1 parent ef33baa commit fa884c1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4b06c2d4cce466e2d62163c0a954e1b2ce96f8b
refs/heads/master: 55c171a6d90dc0574021f9c836127cfd1a7d2e30
38 changes: 30 additions & 8 deletions trunk/drivers/s390/kvm/kvm_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,26 @@ static void kvm_extint_handler(struct ext_code ext_code,
}
}

/*
* For s390-virtio, we expect a page above main storage containing
* the virtio configuration. Try to actually load from this area
* in order to figure out if the host provides this page.
*/
static int __init test_devices_support(unsigned long addr)
{
int ret = -EIO;

asm volatile(
"0: lura 0,%1\n"
"1: xgr %0,%0\n"
"2:\n"
EX_TABLE(0b,2b)
EX_TABLE(1b,2b)
: "+d" (ret)
: "a" (addr)
: "0", "cc");
return ret;
}
/*
* Init function for virtio
* devices are in a single page above top of "normal" mem
Expand All @@ -432,21 +452,23 @@ static int __init kvm_devices_init(void)
if (!MACHINE_IS_KVM)
return -ENODEV;

if (test_devices_support(real_memory_size) < 0)
return -ENODEV;

rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
if (rc)
return rc;

kvm_devices = (void *) real_memory_size;

kvm_root = root_device_register("kvm_s390");
if (IS_ERR(kvm_root)) {
rc = PTR_ERR(kvm_root);
printk(KERN_ERR "Could not register kvm_s390 root device");
vmem_remove_mapping(real_memory_size, PAGE_SIZE);
return rc;
}

rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
if (rc) {
root_device_unregister(kvm_root);
return rc;
}

kvm_devices = (void *) real_memory_size;

INIT_WORK(&hotplug_work, hotplug_devices);

service_subclass_irq_register();
Expand Down

0 comments on commit fa884c1

Please sign in to comment.