qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Glauber de Oliveira Costa <gcosta@redhat.com>
To: kvm-devel@lists.sourceforge.net
Cc: amit.shah@qumranet.com, glommer@gmail.com, mtosatti@redhat.com,
	qemu-devel@nongnu.org, Glauber Costa <gcosta@redhat.com>,
	aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH 2/3] map regions as registered
Date: Thu, 17 Apr 2008 01:42:54 -0700	[thread overview]
Message-ID: <12084217802688-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <12084217783693-git-send-email-gcosta@redhat.com>

From: Glauber Costa <gcosta@redhat.com>

map which io registers where already sucessfuly registered

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/hw/pci.c |    5 +++--
 qemu/hw/pci.h |    3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/qemu/hw/pci.c b/qemu/hw/pci.c
index 1937408..7e4ce2d 100644
--- a/qemu/hw/pci.c
+++ b/qemu/hw/pci.c
@@ -199,7 +199,7 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev)
 
     for(i = 0; i < PCI_NUM_REGIONS; i++) {
         r = &pci_dev->io_regions[i];
-        if (!r->size)
+        if ((!r->size) || (r->status != PCI_STATUS_REGISTERED))
             continue;
         if (r->type == PCI_ADDRESS_SPACE_IO) {
             isa_unassign_ioport(r->addr, r->size);
@@ -321,7 +321,7 @@ static void pci_update_mappings(PCIDevice *d)
                         } else {
                             isa_unassign_ioport(r->addr, r->size);
                         }
-                    } else {
+                    } else if (r->status == PCI_STATUS_REGISTERED) {
                         cpu_register_physical_memory(pci_to_cpu_addr(r->addr),
                                                      r->size,
                                                      IO_MEM_UNASSIGNED);
@@ -330,6 +330,7 @@ static void pci_update_mappings(PCIDevice *d)
                 r->addr = new_addr;
                 if (r->addr != -1) {
                     r->map_func(d, i, r->addr, r->size, r->type);
+                    r->status = PCI_STATUS_REGISTERED;
                 }
             }
         }
diff --git a/qemu/hw/pci.h b/qemu/hw/pci.h
index e11fbbf..6350ad2 100644
--- a/qemu/hw/pci.h
+++ b/qemu/hw/pci.h
@@ -27,9 +27,12 @@ typedef struct PCIIORegion {
     uint32_t addr; /* current PCI mapping address. -1 means not mapped */
     uint32_t size;
     uint8_t type;
+    uint8_t status;
     PCIMapIORegionFunc *map_func;
 } PCIIORegion;
 
+#define PCI_STATUS_REGISTERED	1
+
 #define PCI_ROM_SLOT 6
 #define PCI_NUM_REGIONS 7
 
-- 
1.5.5

  reply	other threads:[~2008-04-17  0:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17  8:42 [Qemu-devel] [PATCH 0/3] Qemu crashes with pci passthrough Glauber de Oliveira Costa
2008-04-17  8:42 ` [Qemu-devel] [PATCH 1/3] don't exit on errors while registering ioports Glauber de Oliveira Costa
2008-04-17  8:42   ` Glauber de Oliveira Costa [this message]
2008-04-17  8:42     ` [Qemu-devel] [PATCH 3/3] propagate errors from ioport registering up to pci level Glauber de Oliveira Costa
2008-04-18 16:27 ` [Qemu-devel] Re: [kvm-devel] [PATCH 0/3] Qemu crashes with pci passthrough Avi Kivity
2008-04-19 21:11   ` Glauber Costa
2008-04-24 13:25     ` Glauber Costa

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=12084217802688-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=amit.shah@qumranet.com \
    --cc=aurelien@aurel32.net \
    --cc=glommer@gmail.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).