aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a1093700f3a4..664d67a099f6 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2997,7 +2997,7 @@ static int kvm_io_bus_get_first_dev(struct kvm_io_bus *bus,
2997 return off; 2997 return off;
2998} 2998}
2999 2999
3000static int __kvm_io_bus_write(struct kvm_io_bus *bus, 3000static int __kvm_io_bus_write(struct kvm_vcpu *vcpu, struct kvm_io_bus *bus,
3001 struct kvm_io_range *range, const void *val) 3001 struct kvm_io_range *range, const void *val)
3002{ 3002{
3003 int idx; 3003 int idx;
@@ -3008,7 +3008,7 @@ static int __kvm_io_bus_write(struct kvm_io_bus *bus,
3008 3008
3009 while (idx < bus->dev_count && 3009 while (idx < bus->dev_count &&
3010 kvm_io_bus_cmp(range, &bus->range[idx]) == 0) { 3010 kvm_io_bus_cmp(range, &bus->range[idx]) == 0) {
3011 if (!kvm_iodevice_write(bus->range[idx].dev, range->addr, 3011 if (!kvm_iodevice_write(vcpu, bus->range[idx].dev, range->addr,
3012 range->len, val)) 3012 range->len, val))
3013 return idx; 3013 return idx;
3014 idx++; 3014 idx++;
@@ -3018,7 +3018,7 @@ static int __kvm_io_bus_write(struct kvm_io_bus *bus,
3018} 3018}
3019 3019
3020/* kvm_io_bus_write - called under kvm->slots_lock */ 3020/* kvm_io_bus_write - called under kvm->slots_lock */
3021int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 3021int kvm_io_bus_write(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
3022 int len, const void *val) 3022 int len, const void *val)
3023{ 3023{
3024 struct kvm_io_bus *bus; 3024 struct kvm_io_bus *bus;
@@ -3030,14 +3030,14 @@ int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
3030 .len = len, 3030 .len = len,
3031 }; 3031 };
3032 3032
3033 bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu); 3033 bus = srcu_dereference(vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu);
3034 r = __kvm_io_bus_write(bus, &range, val); 3034 r = __kvm_io_bus_write(vcpu, bus, &range, val);
3035 return r < 0 ? r : 0; 3035 return r < 0 ? r : 0;
3036} 3036}
3037 3037
3038/* kvm_io_bus_write_cookie - called under kvm->slots_lock */ 3038/* kvm_io_bus_write_cookie - called under kvm->slots_lock */
3039int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 3039int kvm_io_bus_write_cookie(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx,
3040 int len, const void *val, long cookie) 3040 gpa_t addr, int len, const void *val, long cookie)
3041{ 3041{
3042 struct kvm_io_bus *bus; 3042 struct kvm_io_bus *bus;
3043 struct kvm_io_range range; 3043 struct kvm_io_range range;
@@ -3047,12 +3047,12 @@ int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
3047 .len = len, 3047 .len = len,
3048 }; 3048 };
3049 3049
3050 bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu); 3050 bus = srcu_dereference(vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu);
3051 3051
3052 /* First try the device referenced by cookie. */ 3052 /* First try the device referenced by cookie. */
3053 if ((cookie >= 0) && (cookie < bus->dev_count) && 3053 if ((cookie >= 0) && (cookie < bus->dev_count) &&
3054 (kvm_io_bus_cmp(&range, &bus->range[cookie]) == 0)) 3054 (kvm_io_bus_cmp(&range, &bus->range[cookie]) == 0))
3055 if (!kvm_iodevice_write(bus->range[cookie].dev, addr, len, 3055 if (!kvm_iodevice_write(vcpu, bus->range[cookie].dev, addr, len,
3056 val)) 3056 val))
3057 return cookie; 3057 return cookie;
3058 3058
@@ -3060,11 +3060,11 @@ int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
3060 * cookie contained garbage; fall back to search and return the 3060 * cookie contained garbage; fall back to search and return the
3061 * correct cookie value. 3061 * correct cookie value.
3062 */ 3062 */
3063 return __kvm_io_bus_write(bus, &range, val); 3063 return __kvm_io_bus_write(vcpu, bus, &range, val);
3064} 3064}
3065 3065
3066static int __kvm_io_bus_read(struct kvm_io_bus *bus, struct kvm_io_range *range, 3066static int __kvm_io_bus_read(struct kvm_vcpu *vcpu, struct kvm_io_bus *bus,
3067 void *val) 3067 struct kvm_io_range *range, void *val)
3068{ 3068{
3069 int idx; 3069 int idx;
3070 3070
@@ -3074,7 +3074,7 @@ static int __kvm_io_bus_read(struct kvm_io_bus *bus, struct kvm_io_range *range,
3074 3074
3075 while (idx < bus->dev_count && 3075 while (idx < bus->dev_count &&
3076 kvm_io_bus_cmp(range, &bus->range[idx]) == 0) { 3076 kvm_io_bus_cmp(range, &bus->range[idx]) == 0) {
3077 if (!kvm_iodevice_read(bus->range[idx].dev, range->addr, 3077 if (!kvm_iodevice_read(vcpu, bus->range[idx].dev, range->addr,
3078 range->len, val)) 3078 range->len, val))
3079 return idx; 3079 return idx;
3080 idx++; 3080 idx++;
@@ -3085,7 +3085,7 @@ static int __kvm_io_bus_read(struct kvm_io_bus *bus, struct kvm_io_range *range,
3085EXPORT_SYMBOL_GPL(kvm_io_bus_write); 3085EXPORT_SYMBOL_GPL(kvm_io_bus_write);
3086 3086
3087/* kvm_io_bus_read - called under kvm->slots_lock */ 3087/* kvm_io_bus_read - called under kvm->slots_lock */
3088int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 3088int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
3089 int len, void *val) 3089 int len, void *val)
3090{ 3090{
3091 struct kvm_io_bus *bus; 3091 struct kvm_io_bus *bus;
@@ -3097,8 +3097,8 @@ int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
3097 .len = len, 3097 .len = len,
3098 }; 3098 };
3099 3099
3100 bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu); 3100 bus = srcu_dereference(vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu);
3101 r = __kvm_io_bus_read(bus, &range, val); 3101 r = __kvm_io_bus_read(vcpu, bus, &range, val);
3102 return r < 0 ? r : 0; 3102 return r < 0 ? r : 0;
3103} 3103}
3104 3104