Add marco for big-endian machine.(Untested!) Signed-off-by: Sheng Yang <sheng@xxxxxxxxxxxxxxx> --- virt/kvm/assigned-dev.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 3010d7d..15b5f74 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -848,9 +848,9 @@ static int msix_mmio_read(struct kvm_io_device *this, gpa_t addr, int len, idx = (addr - adev->msix_mmio_base) / PCI_MSIX_ENTRY_SIZE; if ((addr % PCI_MSIX_ENTRY_SIZE) == PCI_MSIX_ENTRY_VECTOR_CTRL) - *(unsigned long *)val = + *(unsigned long *)val = le32_to_cpu( test_bit(idx, adev->msix_mask_bitmap) ? - PCI_MSIX_ENTRY_CTRL_MASKBIT : 0; + PCI_MSIX_ENTRY_CTRL_MASKBIT : 0); else r = -EOPNOTSUPP; goto out; @@ -869,6 +869,7 @@ static int msix_mmio_read(struct kvm_io_device *this, gpa_t addr, int len, adev->msix_mask_bitmap); memcpy(val, &entry[addr % PCI_MSIX_ENTRY_SIZE / sizeof *entry], len); + *(unsigned long *)val = le32_to_cpu(*(unsigned long *)val); out: mutex_unlock(&adev->kvm->lock); return r; @@ -881,7 +882,7 @@ static int msix_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, container_of(this, struct kvm_assigned_dev_kernel, msix_mmio_dev); int idx, r = 0; - unsigned long new_val = *(unsigned long *)val; + unsigned long new_val = cpu_to_le32(*(unsigned long *)val); mutex_lock(&adev->kvm->lock); if (!msix_mmio_in_range(adev, addr, len)) { -- 1.7.0.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html