Re: [Qemu-devel] [PATCH v6 00/26] qemu: generate acpi tables for the guest

2013-10-01 Thread Igor Mammedov
On Sun, 29 Sep 2013 13:58:21 +0300
Michael S. Tsirkin m...@redhat.com wrote:

WS2008R2x64 BSODs with ACPI error on boot when 64bit PCI hole is present,
but it boots fine with upstream QEMU [stock or acpi BIOS]

QEMU cli:

qemu-system-x86_64 -enable-kvm -monitor stdio -m 4096 test.qcow2  -device 
ivshmem,size=4G,chardev=cfoo -chardev 
socket,path=/tmp/sock,id=cfoo,server,nowait






Re: [Qemu-devel] [PATCH v6 00/26] qemu: generate acpi tables for the guest

2013-10-01 Thread Michael S. Tsirkin
On Tue, Oct 01, 2013 at 12:03:57PM +0200, Igor Mammedov wrote:
 On Sun, 29 Sep 2013 13:58:21 +0300
 Michael S. Tsirkin m...@redhat.com wrote:
 
 WS2008R2x64 BSODs with ACPI error on boot when 64bit PCI hole is present,
 but it boots fine with upstream QEMU [stock or acpi BIOS]
 
 QEMU cli:
 
 qemu-system-x86_64 -enable-kvm -monitor stdio -m 4096 test.qcow2  -device 
 ivshmem,size=4G,chardev=cfoo -chardev 
 socket,path=/tmp/sock,id=cfoo,server,nowait
 


Thanks for the report, will fix.



Re: [Qemu-devel] [PATCH v6 00/26] qemu: generate acpi tables for the guest

2013-10-01 Thread Michael S. Tsirkin
On Tue, Oct 01, 2013 at 12:03:57PM +0200, Igor Mammedov wrote:
 On Sun, 29 Sep 2013 13:58:21 +0300
 Michael S. Tsirkin m...@redhat.com wrote:
 
 WS2008R2x64 BSODs with ACPI error on boot when 64bit PCI hole is present,
 but it boots fine with upstream QEMU [stock or acpi BIOS]
 
 QEMU cli:
 
 qemu-system-x86_64 -enable-kvm -monitor stdio -m 4096 test.qcow2  -device 
 ivshmem,size=4G,chardev=cfoo -chardev 
 socket,path=/tmp/sock,id=cfoo,server,nowait
 

Thanks!
This fixes it for me (below).
I'll roll this in the next revision.

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 7d5d103..d359685 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2281,7 +2281,7 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, 
void *opaque)
 Range *range = opaque;
 PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
 uint16_t cmd = pci_get_word(dev-config + PCI_COMMAND);
-int r;
+int i;
 
 if (!(cmd  PCI_COMMAND_MEMORY)) {
 return;
@@ -2300,17 +2300,21 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, 
void *opaque)
 range_extend(range, pref_range);
 }
 }
-for (r = 0; r  PCI_NUM_REGIONS; ++r) {
-PCIIORegion *region = dev-io_regions[r];
+for (i = 0; i  PCI_NUM_REGIONS; ++i) {
+PCIIORegion *r = dev-io_regions[i];
 Range region_range;
 
-if (!region-size ||
-(region-type  PCI_BASE_ADDRESS_SPACE_IO) ||
-!(region-type  PCI_BASE_ADDRESS_MEM_TYPE_64)) {
+if (!r-size ||
+(r-type  PCI_BASE_ADDRESS_SPACE_IO) ||
+!(r-type  PCI_BASE_ADDRESS_MEM_TYPE_64)) {
+continue;
+}
+region_range.begin = pci_bar_address(dev, i, r-type, r-size);
+region_range.end = region_range.begin + r-size;
+
+if (region_range.begin == PCI_BAR_UNMAPPED) {
 continue;
 }
-region_range.begin = pci_get_quad(dev-config + pci_bar(dev, r));
-region_range.end = region_range.begin + region-size;
 
 region_range.begin = MAX(region_range.begin, 0x1ULL  32);
 



Re: [Qemu-devel] [PATCH v6 00/26] qemu: generate acpi tables for the guest

2013-09-30 Thread Gerd Hoffmann
On So, 2013-09-29 at 13:58 +0300, Michael S. Tsirkin wrote:
 This code can also be found here:
 git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git acpi

Reviewed-and-tested-by: Gerd Hoffmann kra...@redhat.com

cheers,
  Gerd






[Qemu-devel] [PATCH v6 00/26] qemu: generate acpi tables for the guest

2013-09-29 Thread Michael S. Tsirkin
This code can also be found here:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git acpi

While this patch still uses info not available in QOM, I think it's reasonable
to merge it and then refactor as QOM properties cover more ground.

In particular, merging this patchset blocks other projects so
I think its preferable to merge now and not wait
for all required QOM properties to materialize.

I added QOM properties in ich/piix where I knew how to
do this.

If you already reviewed v4 then not much changed.

Patches 1-4 are QOM patches really. They are
same as the patchset I posted previously,
included here for completeness.

Igor suggested dropping patches 1-2 and including error.h directly.
OTOH Paolo already acked 1-4.
I think I agree with Paolo so I kept 1-2 around for now.
I hope that's ok.
They are trivial one-liners so will be easy to revert later
if we want to.

If everything's in order, I intend to merge this through my tree.

Please review, and comment.

Changes from v5:
- update generated files to fix build on systems without iasl
- fix mcfg failure reported by Gerd
Changes from v4:
- address comments by Paolo:
rename loader interface
reuse macro for hpet name
better struct names
move internal headers to hw/i386/
- fix typos resulting in bugs reported by Gerd

Changes from v3:
- reworked code to use QOM properties
  some info isn't yet available in QOM,
  use old-style APIs and lookups by type
- address comments by Gerd: tables are now updated
  on guest access after pci configuration

Changes from v2 repost:
- address comment by Anthony - convert to use APIs implemented
  using QOM
- address comment by Anthony - avoid tricky pointer path,
  use GArray from glib instead
- Address lots of comments by Hu Tao and Laszlo Ersek

Changes from v2:
- added missing patches to make it actually build
Changes from v1 RFC:
- added code to address cross version compatibility
- rebased to latest bits
- updated seabios code to latest bits (added pvpanic device)

This patchset moves all generation of ACPI tables
from guest BIOS to the hypervisor.

Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.

This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.

There's a bit of code duplication where we
already declare similar acpi structures in qemu.

I think it's best to do it in this order: port
code directly, and apply cleanups and reduce duplication
that results, on top.
This way it's much easier to see that we don't introduce
regressions.

In particular, I booted a guest on qemu with and without the
change, and verified that ACPI tables are
unchanged except for trivial pointer address changes,
and the SSDT P_BLK change in the last patch.

Such binary compatibility makes it easier to be
confident that this change won't break things.

Michael S. Tsirkin (26):
  qemu: add Error to typedefs
  qom: pull in qemu/typedefs
  qom: cleanup struct Error references
  qom: add pointer to int property helpers
  fw_cfg: interface to trigger callback on read
  loader: support for unmapped ROM blobs
  pcie_host: expose UNMAPPED macro
  pcie_host: expose address format
  q35: use macro for MCFG property name
  q35: expose mmcfg size as a property
  i386: add ACPI table files from seabios
  acpi: add rules to compile ASL source
  acpi: pre-compiled ASL files
  acpi: ssdt pcihp: updat generated file
  loader: use file path size from fw_cfg.h
  i386: add bios linker/loader
  loader: allow adding ROMs in done callbacks
  i386: define pc guest info
  acpi/piix: add macros for acpi property names
  piix: APIs for pc guest info
  ich9: APIs for pc guest info
  pvpanic: add API to access io port
  hpet: add API to find it
  i386: ACPI table generation code from seabios
  ssdt: fix PBLK length
  ssdt-proc: update generated file

 configure   |9 +-
 hw/i386/acpi-build.h|9 +
 hw/i386/acpi-defs.h |  331 ++
 hw/i386/bios-linker-loader.h|   27 +
 hw/lm32/lm32_hwsetup.h  |2 +-
 include/hw/acpi/ich9.h  |2 +
 include/hw/acpi/piix4.h |8 +
 include/hw/i386/ich9.h  |2 +
 include/hw/i386/pc.h|   23 +
 include/hw/loader.h |8 +-
 include/hw/nvram/fw_cfg.h   |8 +-
 include/hw/pci-host/q35.h   |2 +
 include/hw/pci/pcie_host.h  |   27 +
 include/hw/timer/hpet.h |2 +
 include/qemu/typedefs.h |1 +
 include/qom/object.h|   73 +-
 hw/acpi/ich9.c  |   24 +
 hw/acpi/piix4.c |   50 +-
 hw/core/loader.c|   31 +-
 hw/i386/acpi-build.c| 1196 ++
 hw/i386/bios-linker-loader.c|  158 +
 hw/i386/pc.c