s390x: Dispatch interrupts to KVM or the real CPU
The KVM interrupt injection path is non-generic for now. So we need to push knowledge of how to inject a device interrupt using KVM into the actual device code. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
		
							parent
							
								
									3110e29254
								
							
						
					
					
						commit
						8103b4d161
					
				@ -43,6 +43,8 @@
 | 
				
			|||||||
    do { } while (0)
 | 
					    do { } while (0)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define VIRTIO_EXT_CODE   0x2603
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct BusInfo s390_virtio_bus_info = {
 | 
					struct BusInfo s390_virtio_bus_info = {
 | 
				
			||||||
    .name       = "s390-virtio",
 | 
					    .name       = "s390-virtio",
 | 
				
			||||||
    .size       = sizeof(VirtIOS390Bus),
 | 
					    .size       = sizeof(VirtIOS390Bus),
 | 
				
			||||||
@ -305,9 +307,13 @@ static void virtio_s390_notify(void *opaque, uint16_t vector)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
 | 
					    VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
 | 
				
			||||||
    uint64_t token = s390_virtio_device_vq_token(dev, vector);
 | 
					    uint64_t token = s390_virtio_device_vq_token(dev, vector);
 | 
				
			||||||
 | 
					    CPUState *env = s390_cpu_addr2state(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* XXX kvm dependency! */
 | 
					    if (kvm_enabled()) {
 | 
				
			||||||
    kvm_s390_virtio_irq(s390_cpu_addr2state(0), 0, token);
 | 
					        kvm_s390_virtio_irq(env, 0, token);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        cpu_inject_ext(env, VIRTIO_EXT_CODE, 0, token);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static unsigned virtio_s390_get_features(void *opaque)
 | 
					static unsigned virtio_s390_get_features(void *opaque)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user