From: NISHIGUCHI Naoki <nisiguti@jp.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] ioemu: pass-through: pt_bar_mapping fix
Date: Wed, 09 Jul 2008 15:46:15 +0900 [thread overview]
Message-ID: <48745EB7.2080704@jp.fujitsu.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
Hi,
In pt_bar_mapping function, r->addr should not be changed by invalid
value(-1).
This value(-1) causes failure of mapping BAR when I/O Space or Memory
Space enable bit is updated repeatedly by native windows driver.
This situation occurs in Windows Vista guest.
Attached patch fixes this problem.
Signed-off-by: Naoki Nishiguchi <nisiguti@jp.fujitsu.com>
Regards,
Naoki Nishiguchi
[-- Attachment #2: fix_pt_bar_mapping.patch --]
[-- Type: text/x-patch, Size: 2134 bytes --]
diff -r bd97e45e073a tools/ioemu/hw/pass-through.c
--- a/tools/ioemu/hw/pass-through.c Tue Jul 08 09:28:50 2008 +0100
+++ b/tools/ioemu/hw/pass-through.c Wed Jul 09 15:36:14 2008 +0900
@@ -1519,7 +1519,7 @@ static void pt_bar_mapping(struct pt_dev
PCIDevice *dev = (PCIDevice *)&ptdev->dev;
PCIIORegion *r;
struct pt_region *base = NULL;
- uint32_t r_size = 0;
+ uint32_t r_size = 0, r_addr = -1;
int ret = 0;
int i;
@@ -1537,30 +1537,33 @@ static void pt_bar_mapping(struct pt_dev
(base->bar_flag == PT_BAR_FLAG_UPPER))
continue;
+ /* copy region address to temporary */
+ r_addr = r->addr;
+
/* clear region address in case I/O Space or Memory Space disable */
if (((base->bar_flag == PT_BAR_FLAG_IO) && !io_enable ) ||
((base->bar_flag == PT_BAR_FLAG_MEM) && !mem_enable ))
- r->addr = -1;
+ r_addr = -1;
/* prevent guest software mapping memory resource to 00000000h */
- if ((base->bar_flag == PT_BAR_FLAG_MEM) && (r->addr == 0))
- r->addr = -1;
+ if ((base->bar_flag == PT_BAR_FLAG_MEM) && (r_addr == 0))
+ r_addr = -1;
/* align resource size (memory type only) */
r_size = r->size;
PT_GET_EMUL_SIZE(base->bar_flag, r_size);
/* check overlapped address */
- ret = pt_chk_bar_overlap(dev->bus, dev->devfn, r->addr, r_size);
+ ret = pt_chk_bar_overlap(dev->bus, dev->devfn, r_addr, r_size);
if (ret > 0)
PT_LOG("Base Address[%d] is overlapped. "
- "[Address:%08xh][Size:%04xh]\n", i, r->addr, r_size);
+ "[Address:%08xh][Size:%04xh]\n", i, r_addr, r_size);
/* check whether we need to update the mapping or not */
- if (r->addr != ptdev->bases[i].e_physbase)
+ if (r_addr != ptdev->bases[i].e_physbase)
{
/* mapping BAR */
- r->map_func((PCIDevice *)ptdev, i, r->addr,
+ r->map_func((PCIDevice *)ptdev, i, r_addr,
r_size, r->type);
}
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2008-07-09 6:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=48745EB7.2080704@jp.fujitsu.com \
--to=nisiguti@jp.fujitsu.com \
--cc=xen-devel@lists.xensource.com \
/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.