From patchwork Thu Aug 11 11:56:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 1056652 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7BBvvsM015231 for ; Thu, 11 Aug 2011 11:57:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755295Ab1HKL5z (ORCPT ); Thu, 11 Aug 2011 07:57:55 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:51634 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754171Ab1HKL5y (ORCPT ); Thu, 11 Aug 2011 07:57:54 -0400 Received: by bke11 with SMTP id 11so921708bke.19 for ; Thu, 11 Aug 2011 04:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=rchHa19WD4sdrsnVuDnIbYqNmB9JodA06UzebvILBvI=; b=ha3AIhuWKJxfGheIxrGtzC/xeh6PXWswzdu+hldUFh+Tep7VkxQxVQJBCJ5M0urZIT 2wRT8dsLaw3oumnkr9o0sZUqzAeGNaQw3AgcE3TjswZ4U6Dsg81zmA1s0EwEZ1EZIbc1 uNCm0kFKe7V5bZBjuPc2evnGS/HBTuWSVL+rw= Received: by 10.204.51.208 with SMTP id e16mr3185625bkg.121.1313063873324; Thu, 11 Aug 2011 04:57:53 -0700 (PDT) Received: from localhost.localdomain ([77.127.203.32]) by mx.google.com with ESMTPS id q1sm4438719faa.1.2011.08.11.04.57.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Aug 2011 04:57:52 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, Sasha Levin Subject: [PATCH resend] kvm tools: Use correct size for VESA memory bar Date: Thu, 11 Aug 2011 14:56:51 +0300 Message-Id: <1313063811-24683-1-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.6 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 11 Aug 2011 11:57:57 +0000 (UTC) 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. Signed-off-by: Sasha Levin --- tools/kvm/hw/vesa.c | 2 +- tools/kvm/pci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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])