qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 2f2951: q35/mch: implement extended TSEG size


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 2f2951: q35/mch: implement extended TSEG sizes
Date: Tue, 20 Jun 2017 09:59:07 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 2f295167e0c429cec233aef7dc8e9fd6f90376df
      
https://github.com/qemu/qemu/commit/2f295167e0c429cec233aef7dc8e9fd6f90376df
  Author: Laszlo Ersek <address@hidden>
  Date:   2017-06-16 (Fri, 16 Jun 2017)

  Changed paths:
    M hw/pci-host/q35.c
    M include/hw/i386/pc.h
    M include/hw/pci-host/q35.h

  Log Message:
  -----------
  q35/mch: implement extended TSEG sizes

The q35 machine type currently lets the guest firmware select a 1MB, 2MB
or 8MB TSEG (basically, SMRAM) size. In edk2/OVMF, we use 8MB, but even
that is not enough when a lot of VCPUs (more than approx. 224) are
configured -- SMRAM footprint scales largely proportionally with VCPU
count.

Introduce a new property for "mch" called "extended-tseg-mbytes", which
expresses (in megabytes) the user's choice of TSEG (SMRAM) size.

Invent a new, QEMU-specific register in the config space of the DRAM
Controller, at offset 0x50, in order to allow guest firmware to query the
TSEG (SMRAM) size.

According to Intel Document Number 316966-002, Table 5-1 "DRAM Controller
Register Address Map (D0:F0)":

    Warning: Address locations that are not listed are considered Intel
       Reserved registers locations. Reads to Reserved registers may
       return non-zero values. Writes to reserved locations may
       cause system failures.
        All registers that are defined in the PCI 2.3 specification,
       but are not necessary or implemented in this component are
       simply not included in this document. The
       reserved/unimplemented space in the PCI configuration header
       space is not documented as such in this summary.

Offsets 0x50 and 0x51 are not listed in Table 5-1. They are also not part
of the standard PCI config space header. And they precede the capability
list as well, which starts at 0xe0 for this device.

When the guest writes value 0xffff to this register, the value that can be
read back is that of "mch.extended-tseg-mbytes" -- unless it remains
0xffff. The guest is required to write 0xffff first (as opposed to a
read-only register) because PCI config space is generally not cleared on
QEMU reset, and after S3 resume or reboot, new guest firmware running on
old QEMU could read a guest OS-injected value from this register.

After reading the available "extended" TSEG size, the guest firmware may
actually request that TSEG size by writing pattern 11b to the ESMRAMC
register's TSEG_SZ bit-field. (The Intel spec referenced above defines
only patterns 00b (1MB), 01b (2MB) and 10b (8MB); 11b is reserved.)

On the QEMU command line, the value can be set with

  -global mch.extended-tseg-mbytes=N

The default value for 2.10+ q35 machine types is 16. The value is limited
to 0xfff (4095) at the moment, purely so that the product (4095 MB) can be
stored to the uint32_t variable "tseg_size" in mch_update_smram(). Users
are responsible for choosing sensible TSEG sizes.

On 2.9 and earlier q35 machine types, the default value is 0. This lets
the 11b bit pattern in ESMRAMC.TSEG_SZ, and the register at offset 0x50,
keep their original behavior.

When "extended-tseg-mbytes" is nonzero, the new register at offset 0x50 is
set to that value on reset, for completeness.

PCI config space is migrated automatically, so no VMSD changes are
necessary.

Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1447027
Ref: https://lists.01.org/pipermail/edk2-devel/2017-May/010456.html
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 8bbf4aa96efb6007b82199fbc19b3173504bfd48
      
https://github.com/qemu/qemu/commit/8bbf4aa96efb6007b82199fbc19b3173504bfd48
  Author: Laszlo Ersek <address@hidden>
  Date:   2017-06-16 (Fri, 16 Jun 2017)

  Changed paths:
    M tests/q35-test.c

  Log Message:
  -----------
  tests/q35-test: push down qtest_start / qtest_end to test case(s)

A test program can start up QEMU several times, with different command
lines. For such cases, qtest_start() and qtest_end() are called from
within the individual test functions. Examples: "virtio-console-test.c",
"numa-test.c", and many others.

Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: e691ef69911a08bf007c3ef1412f9232b0102fb1
      
https://github.com/qemu/qemu/commit/e691ef69911a08bf007c3ef1412f9232b0102fb1
  Author: Laszlo Ersek <address@hidden>
  Date:   2017-06-16 (Fri, 16 Jun 2017)

  Changed paths:
    M tests/q35-test.c

  Log Message:
  -----------
  tests/q35-test: add TSEG size checks

These checks verify that the guest RAM turns from read-write to
"blackhole" when crossing the low boundary of the TSEG. Both the standard
1MB/2MB/8MB TSEG sizes and an extended (16MB) TSEG size are tested.

Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 7feb51b7093145e3ee16b0194099d77e00a18ddb
      
https://github.com/qemu/qemu/commit/7feb51b7093145e3ee16b0194099d77e00a18ddb
  Author: Peter Xu <address@hidden>
  Date:   2017-06-16 (Fri, 16 Jun 2017)

  Changed paths:
    M hw/i386/intel_iommu.c
    M hw/i386/trace-events

  Log Message:
  -----------
  intel_iommu: switching the rest DPRINTF to trace

We have converted many of the DPRINTF() into traces. This patch does the
last 100+ ones.

To debug VT-d when error happens, let's try enable:

  -trace enable="vtd_err*"

This should works just like the old GENERAL but of course better, since
we don't need to recompile.

Similar rules apply to the other modules. I was trying to make the
prefix good enough for sub-module debugging.

Signed-off-by: Peter Xu <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: b9313021f3115e4052966f1975022e4db2df665b
      
https://github.com/qemu/qemu/commit/b9313021f3115e4052966f1975022e4db2df665b
  Author: Peter Xu <address@hidden>
  Date:   2017-06-16 (Fri, 16 Jun 2017)

  Changed paths:
    M hw/i386/intel_iommu.c
    M hw/i386/intel_iommu_internal.h
    M hw/i386/trace-events

  Log Message:
  -----------
  intel_iommu: cleanup vtd_{do_}iommu_translate()

First, let vtd_do_iommu_translate() return a status, so that we
explicitly knows whether error occured. Meanwhile, we make sure that
IOMMUTLBEntry is filled in in that.

Then, cleanup vtd_iommu_translate a bit. So even with PT we'll get a log
now. Also, remove useless assignments.

Signed-off-by: Peter Xu <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: e7a3b91fdfa84c9028003b315ca959ea4de30363
      
https://github.com/qemu/qemu/commit/e7a3b91fdfa84c9028003b315ca959ea4de30363
  Author: Peter Xu <address@hidden>
  Date:   2017-06-16 (Fri, 16 Jun 2017)

  Changed paths:
    M hw/i386/intel_iommu.c

  Log Message:
  -----------
  intel_iommu: cleanup vtd_interrupt_remap_msi()

Move the memcpy upper into where needed, then share the trace so that we
trace every correct remapping.

Signed-off-by: Peter Xu <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 7f3cf2d6e7d1231d854902c9016823961e59d1f4
      
https://github.com/qemu/qemu/commit/7f3cf2d6e7d1231d854902c9016823961e59d1f4
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-06-16 (Fri, 16 Jun 2017)

  Changed paths:
    M hw/i386/pc.c

  Log Message:
  -----------
  hw/i386: fix nvdimm check error path

Commit e987c37aee1752177906847630d32477da57e705 ("hw/i386: check if
nvdimm is enabled before plugging") introduced a check to reject nvdimm
hotplug if -machine pc,nvdimm=on was not given.

This check executes after pc_dimm_memory_plug() has already completed
and does not reverse the effect of this function in the case of failure.

Perform the check before calling pc_dimm_memory_plug().  This fixes the
following abort:

  $ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
   -object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
  (qemu) device_add nvdimm,memdev=mem1
  nvdimm is not enabled: missing 'nvdimm' in '-M'
  (qemu) device_add nvdimm,memdev=mem1
  Core dumped

The backtrace is:

  #0  0x00007fffdb5b191f in raise () at /lib64/libc.so.6
  #1  0x00007fffdb5b351a in abort () at /lib64/libc.so.6
  #2  0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
  #3  0x00007fffdb5a9e52 in  () at /lib64/libc.so.6
  #4  0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, 
name=<optimized out>, address@hidden) at qemu/exec.c:1709
  #5  0x0000555555a0fe86 in vmstate_register_ram (address@hidden, 
address@hidden) at migration/savevm.c:2293
  #6  0x0000555555965088 in pc_dimm_memory_plug (address@hidden, 
address@hidden, address@hidden, align=<optimized out>, address@hidden)
      at hw/mem/pc-dimm.c:110
  #7  0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, 
dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
  #8  0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized 
out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
  #9  0x0000555555914da6 in device_set_realized (obj=<optimized out>, 
value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926

Cc: Haozhong Zhang <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Reviewed-by: Haozhong Zhang <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: e85c0d14014514a2f0faeae5b4c23fab5b234de4
      
https://github.com/qemu/qemu/commit/e85c0d14014514a2f0faeae5b4c23fab5b234de4
  Author: Peter Maydell <address@hidden>
  Date:   2017-06-20 (Tue, 20 Jun 2017)

  Changed paths:
    M hw/i386/intel_iommu.c
    M hw/i386/intel_iommu_internal.h
    M hw/i386/pc.c
    M hw/i386/trace-events
    M hw/pci-host/q35.c
    M include/hw/i386/pc.h
    M include/hw/pci-host/q35.h
    M tests/q35-test.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc: fixes, cleanups, features

Some fixes and cleanups. Extended TSEG sizes.

Signed-off-by: Michael S. Tsirkin <address@hidden>

# gpg: Signature made Fri 16 Jun 2017 16:45:07 BST
# gpg:                using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <address@hidden>"
# gpg:                 aka "Michael S. Tsirkin <address@hidden>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  hw/i386: fix nvdimm check error path
  intel_iommu: cleanup vtd_interrupt_remap_msi()
  intel_iommu: cleanup vtd_{do_}iommu_translate()
  intel_iommu: switching the rest DPRINTF to trace
  tests/q35-test: add TSEG size checks
  tests/q35-test: push down qtest_start / qtest_end to test case(s)
  q35/mch: implement extended TSEG sizes

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/65a0e3e842df...e85c0d140145

reply via email to

[Prev in Thread] Current Thread [Next in Thread]