qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RESENT] msix: allow byte and word reading from m


From: Bernhard Kohl
Subject: Re: [Qemu-devel] [PATCH RESENT] msix: allow byte and word reading from mmio
Date: Mon, 15 Nov 2010 10:43:33 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Mnenhy/0.8.3 Thunderbird/3.0.10

Am 22.08.2010 23:34, schrieb ext Anthony Liguori:
On 08/19/2010 07:56 AM, Bernhard Kohl wrote:
It's legal that the guest reads a single byte or word from mmio.
I have an OS which reads single bytes and it works fine on real
hardware. Maybe this happens due to casting.

Signed-off-by: Bernhard Kohl<address@hidden>

Hi Michael,

I'm looking for this to come through your tree unless you disagree.

Regards,

Anthony Liguori

Hi,

could you please look at this again?

Thanks
Bernhard

---
   hw/msix.c |   20 ++++++++++++++++----
   1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/hw/msix.c b/hw/msix.c
index d99403a..7dac7f7 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -100,10 +100,22 @@ static uint32_t msix_mmio_readl(void *opaque, 
target_phys_addr_t addr)
       return pci_get_long(page + offset);
   }

-static uint32_t msix_mmio_read_unallowed(void *opaque, target_phys_addr_t addr)
+static uint32_t msix_mmio_readw(void *opaque, target_phys_addr_t addr)
   {
-    fprintf(stderr, "MSI-X: only dword read is allowed!\n");
-    return 0;
+    PCIDevice *dev = opaque;
+    unsigned int offset = addr&   (MSIX_PAGE_SIZE - 1)&   ~0x1;
+    void *page = dev->msix_table_page;
+
+    return pci_get_word(page + offset);
+}
+
+static uint32_t msix_mmio_readb(void *opaque, target_phys_addr_t addr)
+{
+    PCIDevice *dev = opaque;
+    unsigned int offset = addr&   (MSIX_PAGE_SIZE - 1);
+    void *page = dev->msix_table_page;
+
+    return pci_get_byte(page + offset);
   }

   static uint8_t msix_pending_mask(int vector)
@@ -198,7 +210,7 @@ static CPUWriteMemoryFunc * const msix_mmio_write[] = {
   };

   static CPUReadMemoryFunc * const msix_mmio_read[] = {
-    msix_mmio_read_unallowed, msix_mmio_read_unallowed, msix_mmio_readl
+    msix_mmio_readb, msix_mmio_readw, msix_mmio_readl
   };

   /* Should be called from device's map method. */






reply via email to

[Prev in Thread] Current Thread [Next in Thread]