All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH 22/38] memory: Provide separate handling of unassigned io ports accesses
Date: Wed, 25 Sep 2013 07:57:50 -0500	[thread overview]
Message-ID: <1380113886-16845-23-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1380113886-16845-1-git-send-email-mdroth@linux.vnet.ibm.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Accesses to unassigned io ports shall return -1 on read and be ignored
on write. Ensure these properties via dedicated ops, decoupling us from
the memory core's handling of unassigned accesses.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 3bb28b7208b349e7a1b326e3c6ef9efac1d462bf)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 exec.c                |    3 ++-
 include/exec/ioport.h |    4 ++++
 ioport.c              |   16 ++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 2ea8f04..08eecb3 100644
--- a/exec.c
+++ b/exec.c
@@ -1821,7 +1821,8 @@ static void memory_map_init(void)
     address_space_init(&address_space_memory, system_memory, "memory");
 
     system_io = g_malloc(sizeof(*system_io));
-    memory_region_init(system_io, NULL, "io", 65536);
+    memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io",
+                          65536);
     address_space_init(&address_space_io, system_io, "I/O");
 
     memory_listener_register(&core_memory_listener, &address_space_memory);
diff --git a/include/exec/ioport.h b/include/exec/ioport.h
index bdd4e96..b3848be 100644
--- a/include/exec/ioport.h
+++ b/include/exec/ioport.h
@@ -45,6 +45,10 @@ typedef struct MemoryRegionPortio {
 
 #define PORTIO_END_OF_LIST() { }
 
+#ifndef CONFIG_USER_ONLY
+extern const MemoryRegionOps unassigned_io_ops;
+#endif
+
 void cpu_outb(pio_addr_t addr, uint8_t val);
 void cpu_outw(pio_addr_t addr, uint16_t val);
 void cpu_outl(pio_addr_t addr, uint32_t val);
diff --git a/ioport.c b/ioport.c
index 79b7f1a..707cce8 100644
--- a/ioport.c
+++ b/ioport.c
@@ -44,6 +44,22 @@ typedef struct MemoryRegionPortioList {
     MemoryRegionPortio ports[];
 } MemoryRegionPortioList;
 
+static uint64_t unassigned_io_read(void *opaque, hwaddr addr, unsigned size)
+{
+    return -1ULL;
+}
+
+static void unassigned_io_write(void *opaque, hwaddr addr, uint64_t val,
+                                unsigned size)
+{
+}
+
+const MemoryRegionOps unassigned_io_ops = {
+    .read = unassigned_io_read,
+    .write = unassigned_io_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
+};
+
 void cpu_outb(pio_addr_t addr, uint8_t val)
 {
     LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", addr, val);
-- 
1.7.9.5

  parent reply	other threads:[~2013-09-25 12:59 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25 12:57 [Qemu-devel] Patch Round-up for stable 1.6.1, freeze on 2013-09-30 Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 01/38] block: ensure bdrv_drain_all() works during bdrv_delete() Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 02/38] gdbstub: Fix gdb_register_coprocessor() register counting Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 03/38] target-ppc: fix bit extraction for FPBF and FPL Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 04/38] rdma: silly ipv6 bugfix Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 05/38] scripts/qapi.py: Avoid syntax not supported by Python 2.4 Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 06/38] usb/dev-hid: Modified usb-tablet category from Misc to Input Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 07/38] scsi: Fix scsi_bus_legacy_add_drive() scsi-generic with serial Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 08/38] pc: fix regression for 64 bit PCI memory Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 09/38] pseries: Fix stalls on hypervisor virtual console Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 10/38] virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 11/38] xhci: fix endpoint interval calculation Michael Roth
2013-09-25 13:41   ` Gerd Hoffmann
2013-09-25 12:57 ` [Qemu-devel] [PATCH 12/38] Revert "usb-hub: report status changes only once" Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 13/38] block: expect errors from bdrv_co_is_allocated Michael Roth
2013-09-25 21:27   ` [Qemu-devel] [Qemu-stable] " Doug Goldstein
2013-09-26 20:51     ` Paolo Bonzini
2013-09-25 12:57 ` [Qemu-devel] [PATCH 14/38] target-i386: fix disassembly with PAE=1, PG=0 Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 15/38] adlib: sort offsets in portio registration Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 16/38] exec: fix writing to MMIO area with non-power-of-two length Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 17/38] virtio_pci: fix level interrupts with irqfd Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 18/38] exec: always use MADV_DONTFORK Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 19/38] xhci: reset port when disabling slot Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 20/38] usb: parallelize usb3 streams Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 21/38] w32: Fix access to host devices (regression) Michael Roth
2013-09-25 12:57 ` Michael Roth [this message]
2013-09-25 12:57 ` [Qemu-devel] [PATCH 23/38] Revert "memory: Return -1 again on reads from unsigned regions" Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 24/38] exec: check offset_within_address_space for register subpage Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 25/38] ne2000: mark I/O as LITTLE_ENDIAN Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 26/38] ehci: save device pointer in EHCIState Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 27/38] qxl: fix local renderer Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 28/38] pc: Initializing ram_memory under Xen Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 29/38] pc_q35: Initialize Xen Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 30/38] qapi-types.py: Fix enum struct sizes on i686 Michael Roth
2013-09-25 12:57 ` [Qemu-devel] [PATCH 31/38] pcnet-pci: mark I/O and MMIO as LITTLE_ENDIAN Michael Roth
2013-09-25 12:58 ` [Qemu-devel] [PATCH 32/38] chardev: fix pty_chr_timer Michael Roth
2013-09-25 12:58 ` [Qemu-devel] [PATCH 33/38] kvmvapic: Catch invalid ROM size Michael Roth
2013-09-25 12:58 ` [Qemu-devel] [PATCH 34/38] kvmvapic: Enter inactive state on hardware reset Michael Roth
2013-09-25 12:58 ` [Qemu-devel] [PATCH 35/38] kvmvapic: Clear also physical ROM address when entering INACTIVE state Michael Roth
2013-09-25 12:58 ` [Qemu-devel] [PATCH 36/38] tci: Fix qemu-alpha on 32 bit hosts (wrong assertions) Michael Roth
2013-09-25 12:58 ` [Qemu-devel] [PATCH 37/38] blockdev: do not default cache.no-flush to true Michael Roth
2013-09-25 12:58 ` [Qemu-devel] [PATCH 38/38] virtio-blk: do not relay a previous driver's WCE configuration to the current Michael Roth
2013-09-25 13:54 ` [Qemu-devel] [Qemu-stable] Patch Round-up for stable 1.6.1, freeze on 2013-09-30 Cole Robinson
2013-09-25 21:43   ` Doug Goldstein
2013-09-26 20:53   ` Paolo Bonzini
2013-09-26  4:53 ` [Qemu-devel] " Stefan Weil
2013-09-26  5:22 ` Fam Zheng
2013-09-26 19:38 ` Stefan Weil
2013-09-27  7:30   ` Michael Tokarev
2013-09-27  8:07 ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
2013-09-27  8:11   ` Michael Tokarev

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=1380113886-16845-23-git-send-email-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.