public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: penberg@kernel.org
Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com,
	gorcunov@gmail.com, Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH] kvm tools: Use correct size for VESA memory bar
Date: Thu, 11 Aug 2011 12:04:08 +0300	[thread overview]
Message-ID: <1313053448-13315-2-git-send-email-levinsasha928@gmail.com> (raw)
In-Reply-To: <1313053448-13315-1-git-send-email-levinsasha928@gmail.com>

This patch makes BAR 1 16k, instead of BAR0 - which is the PIO bar.

This fixes wrong output on lspci command and ioremap warnings during boot.

Reported-by: David Evensky <evensky@dancer.ca.sandia.gov>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/hw/serial.c |    2 +-
 tools/kvm/hw/vesa.c   |    2 +-
 tools/kvm/pci.c       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
index 1199264..0393d3d 100644
--- a/tools/kvm/hw/serial.c
+++ b/tools/kvm/hw/serial.c
@@ -213,7 +213,7 @@ static bool serial8250_out(struct ioport *ioport, struct kvm *kvm, u16 port, voi
 		case UART_TX: {
 			char *addr = data;
 
-			if (!(dev->mcr & UART_MCR_LOOP))
+			if (!(dev->mcr & (UART_MCR_LOOP | UART_MCR_OUT2)))
 				term_putc(CONSOLE_8250, addr, size * count);
 
 			dev->iir		= UART_IIR_NO_INT;
diff --git a/tools/kvm/hw/vesa.c b/tools/kvm/hw/vesa.c
index 2af08df..9caa6c4 100644
--- a/tools/kvm/hw/vesa.c
+++ b/tools/kvm/hw/vesa.c
@@ -39,6 +39,7 @@ static struct pci_device_header vesa_pci_device = {
 	.subsys_vendor_id	= PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET,
 	.subsys_id		= PCI_SUBSYSTEM_ID_VESA,
 	.bar[1]			= VESA_MEM_ADDR | PCI_BASE_ADDRESS_SPACE_MEMORY,
+	.bar_size[1]		= VESA_MEM_SIZE,
 };
 
 static struct framebuffer vesafb;
@@ -56,7 +57,6 @@ struct framebuffer *vesa__init(struct kvm *kvm)
 	vesa_pci_device.irq_line	= line;
 	vesa_base_addr			= ioport__register(IOPORT_EMPTY, &vesa_io_ops, IOPORT_SIZE, NULL);
 	vesa_pci_device.bar[0]		= vesa_base_addr | PCI_BASE_ADDRESS_SPACE_IO;
-	vesa_pci_device.bar_size[0]	= VESA_MEM_SIZE;
 	pci__register(&vesa_pci_device, dev);
 
 	mem = mmap(NULL, VESA_MEM_SIZE, PROT_RW, MAP_ANON_NORESERVE, -1, 0);
diff --git a/tools/kvm/pci.c b/tools/kvm/pci.c
index fd19b73..0449aca 100644
--- a/tools/kvm/pci.c
+++ b/tools/kvm/pci.c
@@ -95,7 +95,7 @@ static bool pci_config_data_out(struct ioport *ioport, struct kvm *kvm, u16 port
 		offset = start + (pci_config_address.register_number << 2);
 		if (offset < sizeof(struct pci_device_header)) {
 			void *p = pci_devices[dev_num];
-			u8 bar = offset - PCI_BAR_OFFSET(0);
+			u8 bar = offset - PCI_BAR_OFFSET(0) / (sizeof(u32));
 			u32 sz = PCI_IO_SIZE;
 
 			if (bar < 6 && pci_devices[dev_num]->bar_size[bar])
-- 
1.7.6


  reply	other threads:[~2011-08-11  9:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11  9:04 [PATCH] kvm tools: Fix IRQ mapping Sasha Levin
2011-08-11  9:04 ` Sasha Levin [this message]
2011-08-11  9:49   ` [PATCH] kvm tools: Use correct size for VESA memory bar walimis
2011-08-11 11:55     ` Sasha Levin
2011-08-11  9:17 ` [PATCH] kvm tools: Fix IRQ mapping Pekka Enberg
2011-08-11 13:54   ` Asias He
2011-08-11 13:42     ` walimis
  -- strict thread matches above, loose matches on Subject: below --
2011-08-09 15:21 [PATCH] kvm tools: Use correct size for VESA memory BAR Sasha Levin
2011-08-09 15:39 ` Ingo Molnar
2011-08-09 16:46   ` Avi Kivity
2011-08-10  6:13     ` Pekka Enberg
2011-08-10 17:46       ` David Evensky

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=1313053448-13315-2-git-send-email-levinsasha928@gmail.com \
    --to=levinsasha928@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.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