From cd20d61634092a9fa19c8c6f0a749526e9958374 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Tue, 17 Mar 2015 13:42:03 +0100 Subject: virtio-ccw: sort into categories Sort the various virtio-ccw devices into the same categories as their virtio-pci counterparts. Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'hw') diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index ed75c63..c1d8288 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1453,6 +1453,7 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_net_properties; + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); } static const TypeInfo virtio_ccw_net = { @@ -1479,6 +1480,7 @@ static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_blk_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo virtio_ccw_blk = { @@ -1505,6 +1507,7 @@ static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_serial_properties; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo virtio_ccw_serial = { @@ -1531,6 +1534,7 @@ static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_balloon_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo virtio_ccw_balloon = { @@ -1558,6 +1562,7 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo virtio_ccw_scsi = { @@ -1583,6 +1588,7 @@ static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = vhost_ccw_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo vhost_ccw_scsi = { @@ -1620,6 +1626,7 @@ static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data) k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_rng_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo virtio_ccw_rng = { @@ -1706,9 +1713,11 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); k->init = virtual_css_bridge_init; hc->unplug = virtio_ccw_busdev_unplug; + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); } static const TypeInfo virtual_css_bridge_info = { -- cgit v1.1 From 4d1866de9422c4b359f61819ee01efc9b988187b Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Tue, 17 Mar 2015 13:43:26 +0100 Subject: s390-virtio: sort into categories Sort the various s390-virtio devices into the same categories as their virtio-pci counterparts. Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-bus.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'hw') diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 0f93a64..c27f8a5 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -542,6 +542,7 @@ static void s390_virtio_net_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_net_realize; dc->props = s390_virtio_net_properties; + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); } static const TypeInfo s390_virtio_net = { @@ -555,8 +556,10 @@ static const TypeInfo s390_virtio_net = { static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) { VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); k->realize = s390_virtio_blk_realize; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo s390_virtio_blk = { @@ -578,6 +581,7 @@ static void s390_virtio_serial_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_serial_realize; dc->props = s390_virtio_serial_properties; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo s390_virtio_serial = { @@ -600,6 +604,7 @@ static void s390_virtio_rng_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_rng_realize; dc->props = s390_virtio_rng_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo s390_virtio_rng = { @@ -658,6 +663,7 @@ static void s390_virtio_scsi_class_init(ObjectClass *klass, void *data) k->realize = s390_virtio_scsi_realize; dc->props = s390_virtio_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo s390_virtio_scsi = { @@ -681,6 +687,7 @@ static void s390_vhost_scsi_class_init(ObjectClass *klass, void *data) k->realize = s390_vhost_scsi_realize; dc->props = s390_vhost_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } static const TypeInfo s390_vhost_scsi = { @@ -704,8 +711,10 @@ static int s390_virtio_bridge_init(SysBusDevice *dev) static void s390_virtio_bridge_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); k->init = s390_virtio_bridge_init; + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); } static const TypeInfo s390_virtio_bridge_info = { -- cgit v1.1 From 183f6b8d7e7adf6b892523644e38b534c5954be1 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Tue, 17 Mar 2015 13:44:39 +0100 Subject: sclp: sort into categories Sort the sclp consoles into the input category, just as virtio-serial. Various other sclp devices don't have an obvious category, sort them into misc. Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/char/sclpconsole-lm.c | 1 + hw/char/sclpconsole.c | 1 + hw/s390x/event-facility.c | 1 + hw/s390x/sclp.c | 9 +++++++++ hw/s390x/sclpcpu.c | 2 ++ hw/s390x/sclpquiesce.c | 1 + 6 files changed, 15 insertions(+) (limited to 'hw') diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index a9f5e62..02ac80b 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -364,6 +364,7 @@ static void console_class_init(ObjectClass *klass, void *data) ec->can_handle_event = can_handle_event; ec->read_event_data = read_event_data; ec->write_event_data = write_event_data; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo sclp_console_info = { diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 79891df..b014c7f 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -266,6 +266,7 @@ static void console_class_init(ObjectClass *klass, void *data) ec->can_handle_event = can_handle_event; ec->read_event_data = read_event_data; ec->write_event_data = write_event_data; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static const TypeInfo sclp_console_info = { diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 78da718..1cb116a 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -362,6 +362,7 @@ static void init_event_facility_class(ObjectClass *klass, void *data) dc->reset = reset_event_facility; dc->vmsd = &vmstate_event_facility; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); k->init = init_event_facility; k->command_handler = command_handler; k->event_pending = event_pending; diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index a969975..b3a6c5e 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -457,10 +457,19 @@ sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void) TYPE_SCLP_MEMORY_HOTPLUG_DEV, NULL)); } +static void sclp_memory_hotplug_dev_class_init(ObjectClass *klass, + void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + static TypeInfo sclp_memory_hotplug_dev_info = { .name = TYPE_SCLP_MEMORY_HOTPLUG_DEV, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(sclpMemoryHotplugDev), + .class_init = sclp_memory_hotplug_dev_class_init, }; static void register_types(void) diff --git a/hw/s390x/sclpcpu.c b/hw/s390x/sclpcpu.c index 3600fe2..2fe8b5a 100644 --- a/hw/s390x/sclpcpu.c +++ b/hw/s390x/sclpcpu.c @@ -88,12 +88,14 @@ static int irq_cpu_hotplug_init(SCLPEvent *event) static void cpu_class_init(ObjectClass *oc, void *data) { SCLPEventClass *k = SCLP_EVENT_CLASS(oc); + DeviceClass *dc = DEVICE_CLASS(oc); k->init = irq_cpu_hotplug_init; k->get_send_mask = send_mask; k->get_receive_mask = receive_mask; k->read_event_data = read_event_data; k->write_event_data = NULL; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo sclp_cpu_info = { diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c index 1a399bd..ffa5553 100644 --- a/hw/s390x/sclpquiesce.c +++ b/hw/s390x/sclpquiesce.c @@ -116,6 +116,7 @@ static void quiesce_class_init(ObjectClass *klass, void *data) dc->reset = quiesce_reset; dc->vmsd = &vmstate_sclpquiesce; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); k->init = quiesce_init; k->get_send_mask = send_mask; -- cgit v1.1 From b4ab4572b319f2c26435b2ed18cfd3fb602c7439 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Fri, 20 Mar 2015 10:17:08 +0100 Subject: s390x/ipl: sort into categories The s390 ipl device has no real home (it's not really a storage device), so let's sort it into the misc category. Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/s390x/ipl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw') diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 2e26d2a..132004a 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -315,6 +315,7 @@ static void s390_ipl_class_init(ObjectClass *klass, void *data) dc->props = s390_ipl_properties; dc->reset = s390_ipl_reset; dc->vmsd = &vmstate_ipl; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } static const TypeInfo s390_ipl_info = { -- cgit v1.1 From 6cb1e49de58cab8f243b05a971a9a1f80ab3223d Mon Sep 17 00:00:00 2001 From: Alexander Yarygin Date: Thu, 5 Mar 2015 12:36:48 +0300 Subject: s390x/kvm: Support access register mode for KVM_S390_MEM_OP ioctl Access register mode is one of the modes that control dynamic address translation. In this mode the address space is specified by values of the access registers. The effective address-space-control element is obtained from the result of the access register translation. See the "Access-Register Introduction" section of the chapter 5 "Program Execution" in "Principles of Operations" for more details. When the CPU is in AR mode, the s390_cpu_virt_mem_rw() function must know which access register number to use for address translation. This patch does several things: - add new parameter 'uint8_t ar' to that function - decode ar number from intercepted instructions - pass the ar number to s390_cpu_virt_mem_rw(), which in turn passes it to the KVM_S390_MEM_OP ioctl. Signed-off-by: Alexander Yarygin Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/s390-pci-inst.c | 21 +++++++++++---------- hw/s390x/s390-pci-inst.h | 7 ++++--- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'hw') diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 8f7288f..f9151a9 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -155,7 +155,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, sizeof(*reqh))) { + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, sizeof(*reqh))) { return 0; } reqh = (ClpReqHdr *)buffer; @@ -165,7 +165,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, req_len + sizeof(*resh))) { return 0; } @@ -180,7 +180,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) return 0; } - if (s390_cpu_virt_mem_read(cpu, env->regs[r2], buffer, + if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, req_len + res_len)) { return 0; } @@ -277,7 +277,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) } out: - if (s390_cpu_virt_mem_write(cpu, env->regs[r2], buffer, + if (s390_cpu_virt_mem_write(cpu, env->regs[r2], r2, buffer, req_len + res_len)) { return 0; } @@ -546,7 +546,8 @@ out: return 0; } -int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr) +int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, + uint8_t ar) { CPUS390XState *env = &cpu->env; S390PCIBusDevice *pbdev; @@ -603,7 +604,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr) return 0; } - if (s390_cpu_virt_mem_read(cpu, gaddr, buffer, len)) { + if (s390_cpu_virt_mem_read(cpu, gaddr, ar, buffer, len)) { return 0; } @@ -698,7 +699,7 @@ static void dereg_ioat(S390PCIBusDevice *pbdev) pbdev->g_iota = 0; } -int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) +int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar) { CPUS390XState *env = &cpu->env; uint8_t oc; @@ -727,7 +728,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) return 0; } - if (s390_cpu_virt_mem_read(cpu, fiba, (uint8_t *)&fib, sizeof(fib))) { + if (s390_cpu_virt_mem_read(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) { return 0; } @@ -773,7 +774,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) return 0; } -int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) +int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar) { CPUS390XState *env = &cpu->env; uint32_t fh; @@ -829,7 +830,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) fib.fc |= 0x10; } - if (s390_cpu_virt_mem_write(cpu, fiba, (uint8_t *)&fib, sizeof(fib))) { + if (s390_cpu_virt_mem_write(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) { return 0; } diff --git a/hw/s390x/s390-pci-inst.h b/hw/s390x/s390-pci-inst.h index 7e6c804..70fa713 100644 --- a/hw/s390x/s390-pci-inst.h +++ b/hw/s390x/s390-pci-inst.h @@ -281,8 +281,9 @@ int clp_service_call(S390CPU *cpu, uint8_t r2); int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); -int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr); -int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba); -int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba); +int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, + uint8_t ar); +int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar); +int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar); #endif -- cgit v1.1