qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: joro@8bytes.org
Cc: kvm@vger.kernel.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/7] pci: add range_covers_range()
Date: Sun, 15 Aug 2010 22:27:16 +0300	[thread overview]
Message-ID: <1281900442-29971-2-git-send-email-eduard.munteanu@linux360.ro> (raw)
In-Reply-To: <1281900442-29971-1-git-send-email-eduard.munteanu@linux360.ro>

This helper function allows map invalidation code to determine which
maps must be invalidated.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
---
 hw/pci.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/hw/pci.h b/hw/pci.h
index 4bd8a1a..5a6cdb5 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -419,6 +419,16 @@ static inline int range_covers_byte(uint64_t offset, uint64_t len,
     return offset <= byte && byte <= range_get_last(offset, len);
 }
 
+/* Check whether a given range completely covers another. */
+static inline int range_covers_range(uint64_t first_big, uint64_t len_big,
+                                     uint64_t first_small, uint64_t len_small)
+{
+    uint64_t last_big = range_get_last(first_big, len_big);
+    uint64_t last_small = range_get_last(first_small, len_small);
+
+    return first_big <= first_small && last_small <= last_big;
+}
+
 /* Check whether 2 given ranges overlap.
  * Undefined if ranges that wrap around 0. */
 static inline int ranges_overlap(uint64_t first1, uint64_t len1,
-- 
1.7.1

  reply	other threads:[~2010-08-15 20:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-15 19:27 [Qemu-devel] [PATCH 0/7] AMD IOMMU emulation patches v3 Eduard - Gabriel Munteanu
2010-08-15 19:27 ` Eduard - Gabriel Munteanu [this message]
2010-08-18  4:39   ` [Qemu-devel] [PATCH 1/7] pci: add range_covers_range() Isaku Yamahata
2010-08-15 19:27 ` [Qemu-devel] [PATCH 2/7] pci: memory access API and IOMMU support Eduard - Gabriel Munteanu
2010-08-18  5:02   ` Isaku Yamahata
2010-08-15 19:27 ` [Qemu-devel] [PATCH 3/7] AMD IOMMU emulation Eduard - Gabriel Munteanu
2010-08-16 17:57   ` [Qemu-devel] " Blue Swirl
2010-08-15 19:27 ` [Qemu-devel] [PATCH 4/7] ide: use the PCI memory access interface Eduard - Gabriel Munteanu
2010-08-15 19:27 ` [Qemu-devel] [PATCH 5/7] rtl8139: " Eduard - Gabriel Munteanu
2010-08-15 19:27 ` [Qemu-devel] [PATCH 6/7] eepro100: " Eduard - Gabriel Munteanu
2010-08-15 19:27 ` [Qemu-devel] [PATCH 7/7] ac97: " Eduard - Gabriel Munteanu
2010-08-15 20:42   ` malc
2010-08-16  1:47 ` [Qemu-devel] Re: [PATCH 0/7] AMD IOMMU emulation patches v3 Anthony Liguori

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=1281900442-29971-2-git-send-email-eduard.munteanu@linux360.ro \
    --to=eduard.munteanu@linux360.ro \
    --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 \
    /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).