Skip to contentSkip to conversation

KVM: fix addr type for KVM_IOEVENTFD

PATCH Applied Alexey Kardashevskiy 3 participants 3 messages Jan 10, 2014 – Jan 15, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: fix addr type for KVM_IOEVENTFD

The @addr here is a guest physical address and can easily be bigger than 4G.

This changes uint32_t to hwaddr.

---

This was found during investigation why vhost is not always working on PPC64-spapr. It turned out that KVM_IOEVENTFD was called with a 32bit address while the actual guest physycal address for that PCI host bus was 0x100.0000.0000 and __kvm_io_bus_write() in the host kernel would never succeed.

---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +1 -1
index 3937754..dcd7cdd 100644
@@ -519,7 +519,7 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
     return ret;
 }
 
-static int kvm_set_ioeventfd_mmio(int fd, uint32_t addr, uint32_t val,
+static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val,
                                   bool assign, uint32_t size, bool datamatch)
 {
     int ret;
Signature · 1 line
1.8.4.rc4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Alexey Kardashevskiy

The @addr here is a guest physical address and can easily be bigger than 4G.

This changes uint32_t to hwaddr.

Quoted 27 lines

---

This was found during investigation why vhost is not always working on PPC64-spapr. It turned out that KVM_IOEVENTFD was called with a 32bit address while the actual guest physycal address for that PCI host bus was 0x100.0000.0000 and __kvm_io_bus_write() in the host kernel would never succeed.

---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +1 -1
index 3937754..dcd7cdd 100644
@@ -519,7 +519,7 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
     return ret;
 }
 
-static int kvm_set_ioeventfd_mmio(int fd, uint32_t addr, uint32_t val,
+static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val,
                                   bool assign, uint32_t size, bool datamatch)
 {
     int ret;
Signature · 1 line
1.8.4.rc4
#2 lore raw
In reply to Alexey Kardashevskiy

Il 10/01/2014 08:20, Alexey Kardashevskiy ha scritto:

Quoted 24 lines

The @addr here is a guest physical address and can easily be bigger than 4G.

This changes uint32_t to hwaddr.

---

This was found during investigation why vhost is not always working on PPC64-spapr. It turned out that KVM_IOEVENTFD was called with a 32bit address while the actual guest physycal address for that PCI host bus was 0x100.0000.0000 and __kvm_io_bus_write() in the host kernel would never succeed.

---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +0 -0
index 3937754..dcd7cdd 100644

kvm-all.c int kvm_check_extension(KVMState *s, unsigned int extension) · line 525

Quoted 8 lines
kvm-all.c +1 -1
@@ -519,7 +519,7 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
     return ret;
 }
 
-static int kvm_set_ioeventfd_mmio(int fd, uint32_t addr, uint32_t val,
+static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val,
                                   bool assign, uint32_t size, bool datamatch)
 {
     int ret;

Applied to uq/master, thanks.

Paolo