diff mbox

[uq/master] kvmvapic: add ioport read accessor

Message ID 20130505205149.GA2032@amt.cnet (mailing list archive)
State New, archived
Headers show

Commit Message

Marcelo Tosatti May 5, 2013, 8:51 p.m. UTC
Necessary since memory region accessor assumes read and write
methods are registered. Otherwise reading I/O port 0x7e segfaults.

https://bugzilla.redhat.com/show_bug.cgi?id=954306

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jan Kiszka May 6, 2013, 6:29 a.m. UTC | #1
On 2013-05-05 22:51, Marcelo Tosatti wrote:
> 
> Necessary since memory region accessor assumes read and write
> methods are registered. Otherwise reading I/O port 0x7e segfaults.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=954306
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
> index 5b558aa..655483b 100644
> --- a/hw/i386/kvmvapic.c
> +++ b/hw/i386/kvmvapic.c
> @@ -687,8 +687,14 @@ static void vapic_write(void *opaque, hwaddr addr, uint64_t data,
>      }
>  }
>  
> +static uint64_t vapic_read(void *opaque, hwaddr addr, unsigned size)
> +{
> +    return 0xffffffff;
> +}
> +
>  static const MemoryRegionOps vapic_ops = {
>      .write = vapic_write,
> +    .read = vapic_read,
>      .endianness = DEVICE_NATIVE_ENDIAN,
>  };
>  
> 

Right. I'm just wondering why the guest reads from that port.

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Gleb Natapov May 6, 2013, 11:52 a.m. UTC | #2
On Sun, May 05, 2013 at 05:51:49PM -0300, Marcelo Tosatti wrote:
> 
> Necessary since memory region accessor assumes read and write
> methods are registered. Otherwise reading I/O port 0x7e segfaults.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=954306
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
Applied, thanks.

> diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
> index 5b558aa..655483b 100644
> --- a/hw/i386/kvmvapic.c
> +++ b/hw/i386/kvmvapic.c
> @@ -687,8 +687,14 @@ static void vapic_write(void *opaque, hwaddr addr, uint64_t data,
>      }
>  }
>  
> +static uint64_t vapic_read(void *opaque, hwaddr addr, unsigned size)
> +{
> +    return 0xffffffff;
> +}
> +
>  static const MemoryRegionOps vapic_ops = {
>      .write = vapic_write,
> +    .read = vapic_read,
>      .endianness = DEVICE_NATIVE_ENDIAN,
>  };
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index 5b558aa..655483b 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -687,8 +687,14 @@  static void vapic_write(void *opaque, hwaddr addr, uint64_t data,
     }
 }
 
+static uint64_t vapic_read(void *opaque, hwaddr addr, unsigned size)
+{
+    return 0xffffffff;
+}
+
 static const MemoryRegionOps vapic_ops = {
     .write = vapic_write,
+    .read = vapic_read,
     .endianness = DEVICE_NATIVE_ENDIAN,
 };