From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: joro@8bytes.org
Cc: paul@codesourcery.com, blauwirbel@gmail.com,
anthony@codemonkey.ws, avi@redhat.com, kvm@vger.kernel.org,
qemu-devel@nongnu.org, seabios@seabios.org,
Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Subject: [PATCH 1/2] Split region allocation code from pci_bios_init_device()
Date: Sun, 15 Aug 2010 22:57:26 +0300 [thread overview]
Message-ID: <1281902247-5151-1-git-send-email-eduard.munteanu@linux360.ro> (raw)
pci_bios_alloc() can be used to allocate space in the PCI region for
other purposes. This is needed by the AMD IOMMU support code.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
---
src/pciinit.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/pciinit.c b/src/pciinit.c
index 0556ee2..bfc669f 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -75,6 +75,16 @@ static void pci_bios_init_bridges(u16 bdf)
}
}
+static inline u32 pci_bios_alloc(u32 *region, u32 size)
+{
+ u32 ret;
+
+ ret = ALIGN(*region, size);
+ *region = ret + size;
+
+ return ret;
+}
+
static void pci_bios_init_device(u16 bdf)
{
int class;
@@ -146,14 +156,13 @@ static void pci_bios_init_device(u16 bdf)
pci_config_writel(bdf, ofs, old);
if (val != 0) {
- u32 size = (~(val & mask)) + 1;
+ u32 base, size = (~(val & mask)) + 1;
if (val & PCI_BASE_ADDRESS_SPACE_IO)
paddr = &pci_bios_io_addr;
else
paddr = &pci_bios_mem_addr;
- *paddr = ALIGN(*paddr, size);
- pci_set_io_region_addr(bdf, i, *paddr);
- *paddr += size;
+ base = pci_bios_alloc(paddr, size);
+ pci_set_io_region_addr(bdf, i, base);
}
}
break;
--
1.7.1
WARNING: multiple messages have this Message-ID (diff)
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: joro@8bytes.org
Cc: kvm@vger.kernel.org, seabios@seabios.org, qemu-devel@nongnu.org,
blauwirbel@gmail.com, paul@codesourcery.com,
Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>,
avi@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] Split region allocation code from pci_bios_init_device()
Date: Sun, 15 Aug 2010 22:57:26 +0300 [thread overview]
Message-ID: <1281902247-5151-1-git-send-email-eduard.munteanu@linux360.ro> (raw)
pci_bios_alloc() can be used to allocate space in the PCI region for
other purposes. This is needed by the AMD IOMMU support code.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
---
src/pciinit.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/pciinit.c b/src/pciinit.c
index 0556ee2..bfc669f 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -75,6 +75,16 @@ static void pci_bios_init_bridges(u16 bdf)
}
}
+static inline u32 pci_bios_alloc(u32 *region, u32 size)
+{
+ u32 ret;
+
+ ret = ALIGN(*region, size);
+ *region = ret + size;
+
+ return ret;
+}
+
static void pci_bios_init_device(u16 bdf)
{
int class;
@@ -146,14 +156,13 @@ static void pci_bios_init_device(u16 bdf)
pci_config_writel(bdf, ofs, old);
if (val != 0) {
- u32 size = (~(val & mask)) + 1;
+ u32 base, size = (~(val & mask)) + 1;
if (val & PCI_BASE_ADDRESS_SPACE_IO)
paddr = &pci_bios_io_addr;
else
paddr = &pci_bios_mem_addr;
- *paddr = ALIGN(*paddr, size);
- pci_set_io_region_addr(bdf, i, *paddr);
- *paddr += size;
+ base = pci_bios_alloc(paddr, size);
+ pci_set_io_region_addr(bdf, i, base);
}
}
break;
--
1.7.1
next reply other threads:[~2010-08-15 20:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-15 19:57 Eduard - Gabriel Munteanu [this message]
2010-08-15 19:57 ` [Qemu-devel] [PATCH 1/2] Split region allocation code from pci_bios_init_device() Eduard - Gabriel Munteanu
2010-08-15 19:57 ` [PATCH 2/2] AMD IOMMU support Eduard - Gabriel Munteanu
2010-08-15 19:57 ` [Qemu-devel] " Eduard - Gabriel Munteanu
2010-08-18 0:05 ` Kevin O'Connor
2010-08-18 0:05 ` [Qemu-devel] " Kevin O'Connor
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=1281902247-5151-1-git-send-email-eduard.munteanu@linux360.ro \
--to=eduard.munteanu@linux360.ro \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.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.