From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH 7/7] KVM: assigned dev: Big endian support for MSI-X MMIO
Date: Thu, 11 Nov 2010 18:12:21 +0200 [thread overview]
Message-ID: <20101111161221.GK25692@redhat.com> (raw)
In-Reply-To: <1289461620-7055-8-git-send-email-sheng@linux.intel.com>
On Thu, Nov 11, 2010 at 03:47:00PM +0800, Sheng Yang wrote:
> Add marco for big-endian machine.(Untested!)
>
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
I presume this is tested at the same level as the previous patch?
So you want to fold this into the previous patch.
Also, please build with sparse (C=1) to find some endian-ness issues.
> ---
> 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(
This should be cpu_to_le32. And val cast to __le32.
> test_bit(idx, adev->msix_mask_bitmap) ?
> - PCI_MSIX_ENTRY_CTRL_MASKBIT : 0;
> + PCI_MSIX_ENTRY_CTRL_MASKBIT : 0);
> else
> r = -EOPNOTSUPP;
> goto out;
In this function,
entry must be __le32 too, and fix up endian-ness where you fill it in.
> @@ -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);
__le32
>
> mutex_lock(&adev->kvm->lock);
> if (!msix_mmio_in_range(adev, addr, len)) {
> --
> 1.7.0.1
next prev parent reply other threads:[~2010-11-11 16:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 7:46 [PATCH 0/7 v4] MSI-X mask support for assigned device Sheng Yang
2010-11-11 7:46 ` [PATCH 1/7] PCI: MSI: Move MSI-X entry definition to pci_regs.h Sheng Yang
2010-11-11 7:46 ` [PATCH 2/7] PCI: Add mask bit definition for MSI-X table Sheng Yang
2010-11-11 17:29 ` Jesse Barnes
2010-11-15 8:02 ` Sheng Yang
2010-11-11 7:46 ` [PATCH 3/7] KVM: Move struct kvm_io_device to kvm_host.h Sheng Yang
2010-11-11 7:46 ` [PATCH 4/7] KVM: Add kvm_get_irq_routing_entry() func Sheng Yang
2010-11-11 7:46 ` [PATCH 5/7] KVM: assigned dev: Clean up assigned_device's flag Sheng Yang
2010-11-11 7:46 ` [PATCH 6/7] KVM: assigned dev: MSI-X mask support Sheng Yang
2010-11-12 9:53 ` Michael S. Tsirkin
2010-11-12 10:13 ` Sheng Yang
2010-11-12 10:47 ` Michael S. Tsirkin
2010-11-12 10:54 ` Sheng Yang
2010-11-12 11:25 ` Michael S. Tsirkin
2010-11-15 7:37 ` Sheng Yang
2010-11-15 7:42 ` Michael S. Tsirkin
2010-11-15 7:48 ` Sheng Yang
2010-11-15 8:03 ` Michael S. Tsirkin
2010-11-15 8:22 ` Sheng Yang
2010-11-11 7:47 ` [PATCH 7/7] KVM: assigned dev: Big endian support for MSI-X MMIO Sheng Yang
2010-11-11 16:12 ` Michael S. Tsirkin [this message]
2010-11-12 2:47 ` Sheng Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101111161221.GK25692@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=sheng@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox