qemu.git
9 years agoMerge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
Peter Maydell [Mon, 11 Jan 2016 12:30:02 +0000 (12:30 +0000)]
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Mon 11 Jan 2016 05:22:16 GMT using RSA key ID 398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request: (24 commits)
  ether/slirp: Avoid redefinition of the same constants
  l2tpv3: fix cookie decoding
  net: ne2000: fix bounds check in ioport operations
  net: rocker: fix an incorrect array bounds check
  vmxnet3: Introduce 'x-disable-pcie' back-compat property
  vmxnet3: Report the Device Serial Number capability
  vmxnet3: The vmxnet3 device is a PCIE endpoint
  vmxnet3: coding: Introduce VMXNET3Class
  vmxnet3: Introduce 'x-old-msi-offsets' back-compat property
  vmxnet3: Change the offset of the MSIX PBA table
  vmxnet3: Change offsets of msi/msix pci capabilities
  net/filter: fix nf->netdev_id leak
  net/dump: fix nfds->filename leak
  net/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISION
  net/vmxnet3: return 0 on unknown command
  net/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO
  net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command
  net/vmxnet3: return 1 on device activation failure
  MAINTAINERS: Add an entry for the net/slirp.c file
  net: vmxnet3: avoid memory leakage in activate_device
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160111' into staging
Peter Maydell [Mon, 11 Jan 2016 11:57:53 +0000 (11:57 +0000)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160111' into staging

ppc patch queue 2016-01-11

Biggest content is a thorough cleanups of spapr machine type handling.
Also contains several other minor cleanups, bugfixes and extensions.

# gpg: Signature made Mon 11 Jan 2016 04:34:38 GMT using RSA key ID 20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.6-20160111:
  hw/ppc/spapr: fix spapr->kvm_type leak
  spapr vio: fix to incomplete QOMify
  hw/ppc/spapr: Use XHCI as host controller for new spapr machines
  pseries: Add pseries-2.6 machine type
  pseries: Improve setting of default machine version
  pseries: Restructure class_options functions
  pseries: DEFINE_SPAPR_MACHINE
  pseries: Use SET_MACHINE_COMPAT
  Move SET_MACHINE_COMPAT macro to boards.h
  pseries: Remove versions from mc->desc
  pseries: Remove redundant calls to spapr_machine_initfn()
  pseries: Rearrange versioned machine type code
  pseries: Remove redundant setting of mc->name for pseries-2.5 machine
  spapr: Add /system-id
  target-ppc: Define kvmppc_read_int_dt()
  hw/ppc/spapr_rtc: Remove bad class_size value

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Mon, 11 Jan 2016 11:19:05 +0000 (11:19 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

acpi dsdt rework, misc fixes

This completes the dsdt rewrite, and includes misc fixes all over the place.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sat 09 Jan 2016 21:20:34 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (59 commits)
  virtio: fix error message for number of queues
  ivshmem: Store file descriptor for vhost-user negotiation
  migration/virtio: Remove simple .get/.put use
  Add VMSTATE_STRUCT_VARRAY_KNOWN
  i386/pc: expose identifying the floppy controller
  pc: acpi: remove unused ASL templates and related blobs/utils
  pc: acpi: switch to AML API composed DSDT
  pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
  pc: acpi: q35: move PCI0 device definition into SSDT
  pc: acpi: q35: move PCI0._OSC() method into SSDT
  pc: acpi: q35: move _PIC() method into SSDT
  pc: acpi: q35: move PRTP routing table into SSDT
  pc: acpi: q35: move PRTA routing table into SSDT
  pc: acpi: q35: move _PRT() into SSDT
  pc: acpi: q35: move ISA bridge into SSDT
  pc: acpi: q35: move IQST() into SSDT
  pc: acpi: q35: move IQCR() into SSDT
  pc: acpi: q35: move link devices to SSDT
  pc: acpi: q35: move GSI links to SSDT
  pc: acpi: piix4: acpi move PCI0 device to SSDT
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/ppc/spapr: fix spapr->kvm_type leak
David Gibson [Mon, 28 Dec 2015 06:38:26 +0000 (17:38 +1100)]
hw/ppc/spapr: fix spapr->kvm_type leak

Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
[fixed return type of spapr_machine_finalizefn()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agospapr vio: fix to incomplete QOMify
Cao jin [Wed, 23 Dec 2015 11:30:12 +0000 (19:30 +0800)]
spapr vio: fix to incomplete QOMify

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agohw/ppc/spapr: Use XHCI as host controller for new spapr machines
Thomas Huth [Wed, 9 Dec 2015 12:34:13 +0000 (13:34 +0100)]
hw/ppc/spapr: Use XHCI as host controller for new spapr machines

The OHCI has some bugs and performance issues, so for
newer machines it's preferable to use XHCI instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agopseries: Add pseries-2.6 machine type
David Gibson [Mon, 7 Dec 2015 03:28:15 +0000 (14:28 +1100)]
pseries: Add pseries-2.6 machine type

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: Improve setting of default machine version
David Gibson [Mon, 7 Dec 2015 03:25:50 +0000 (14:25 +1100)]
pseries: Improve setting of default machine version

This tweaks the way the default machine version is controlled, so that
there will be a bit less churn when each new version is introduced.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: Restructure class_options functions
David Gibson [Mon, 7 Dec 2015 03:27:21 +0000 (14:27 +1100)]
pseries: Restructure class_options functions

Currently each of the *_class_options() functions for the pseries-2.1 ..
pseries-2.5 machine types are standalone.  This will become harder to
maintain as new versions are added.

This patch restructures them similarly to x86 where each function calls
the one from the next version, then overrides anything necessary for
compatibility with the specific version and older.

The default behaviour - that for the most recent machine are set up in
the base class initializer spapr_machine_class_init().  Previously it had
some things set up to default to older behaviour with the more recent
machines overriding it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: DEFINE_SPAPR_MACHINE
David Gibson [Mon, 7 Dec 2015 03:23:20 +0000 (14:23 +1100)]
pseries: DEFINE_SPAPR_MACHINE

At the moment all the class_init functions and TypeInfo structures for the
various versioned pseries machine types are open-coded.  As more versions
are created this is getting increasingly clumsy.

This patch borrows the approach used in PC, using a DEFINE_SPAPR_MACHINE()
macro to construct most of the boilerplate from simpler 'class_options' and
'instance_options' functions.

This patch makes a small semantic change - the versioned machine types are
now registered through machine_init() instead of type_init().  Since the
new way is how PC already did it, I'm assuming that's correct.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: Use SET_MACHINE_COMPAT
David Gibson [Thu, 3 Dec 2015 06:47:22 +0000 (17:47 +1100)]
pseries: Use SET_MACHINE_COMPAT

To make the spapr_machine_*_class_init() functions a little less bulky.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agoMove SET_MACHINE_COMPAT macro to boards.h
David Gibson [Thu, 3 Dec 2015 06:34:38 +0000 (17:34 +1100)]
Move SET_MACHINE_COMPAT macro to boards.h

pc.h defines a SET_MACHINE_COMPAT macro to make setting up compat_props
for the various PC machine versions less verbose.  There's nothing
inherently PC specific about it, though, so move it to boards.h where other
versioned machine types (like pseries-*) can use it.

While we're doing that, change it's indentation to be a bit more regular.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: Remove versions from mc->desc
David Gibson [Mon, 7 Dec 2015 03:29:35 +0000 (14:29 +1100)]
pseries: Remove versions from mc->desc

Currently, the versioned spapr machine types put the machine type version
into the description string.  PC does not do this, using just the name
itself to distinguish.  Doing the same lets us move setting the description
into the common base class, simplifying the code slightly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: Remove redundant calls to spapr_machine_initfn()
David Gibson [Thu, 3 Dec 2015 06:34:20 +0000 (17:34 +1100)]
pseries: Remove redundant calls to spapr_machine_initfn()

The instance_init() functions for several of the pseries-x.y versioned
machine types explicitly call spapr_machine_initfn().  But that's the
instance_init function for the common parent of all those machine types,
so will already have been called beforehand by the QOM infrastructure.

Remove the redundant calls.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: Rearrange versioned machine type code
David Gibson [Thu, 3 Dec 2015 06:34:10 +0000 (17:34 +1100)]
pseries: Rearrange versioned machine type code

hw/ppc/spapr.c has a number of definitions related to the various versioned
machine types ("pseries-2.1" .. "pseries-2.5") it defines.  These are
mostly arranged by type of function first, then machine version second, and
it's not consistent about whether it goes in increasing or decreasing
version order.

This rearranges the code to keep all the definitions for a particular
machine version together, and arrange then consistently in order most
recent to least recent.

This brings us closer to matching the way PC does things, and makes later
cleanups easier to follow.

Apart from adding some comments marking each section, this is a pure
mechanical rearrangement with no semantic changes.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agopseries: Remove redundant setting of mc->name for pseries-2.5 machine
David Gibson [Mon, 30 Nov 2015 05:36:49 +0000 (16:36 +1100)]
pseries: Remove redundant setting of mc->name for pseries-2.5 machine

98cec76 "machine: Set MachineClass::name automatically" removed the setting
of mc->name for the pseries machine types, since it can be derived
automatically from the type names constructed with MACHINE_TYPE_NAME().

Unfortunately fb0fc8f "spapr: Create pseries-2.5 machine" went in later and
brought one of them back.

This removes it again.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
9 years agospapr: Add /system-id
Alexey Kardashevskiy [Mon, 9 Nov 2015 06:47:17 +0000 (17:47 +1100)]
spapr: Add /system-id

Section B.6.2.1 Root Node Properties of PAPR specification defines
a set of properties which shall be present in the device tree root,
one of these properties is "system-id" which "should be unique across
all systems and all manufacturers". Since UUID is meant to be unique,
it makes sense to use it as "system-id".

This adds "system-id" property to the device tree root when not empty.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agotarget-ppc: Define kvmppc_read_int_dt()
Sukadev Bhattiprolu [Sat, 14 Nov 2015 02:13:07 +0000 (18:13 -0800)]
target-ppc: Define kvmppc_read_int_dt()

Extract code from the function kvmppc_read_int_cpu_dt() that actually
reads the file into a separate function, so it can be called from
other places.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agoether/slirp: Avoid redefinition of the same constants
Dr. David Alan Gilbert [Fri, 8 Jan 2016 14:41:28 +0000 (14:41 +0000)]
ether/slirp: Avoid redefinition of the same constants

eth.h and slirp.h both define ETH_ALEN and ETH_P_IP
rtl8139.c and eth.h both define ETH_HLEN

Move the related constant (ETH_P_ARP) from slirp.h to eth.h, and
remove the duplicates; make slirp.h include eth.h

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agol2tpv3: fix cookie decoding
Alexis Dambricourt [Mon, 4 Jan 2016 23:26:07 +0000 (00:26 +0100)]
l2tpv3: fix cookie decoding

If a 32 bits l2tpv3 frame cookie MSB if set to 1, the cast to uint64_t
cookie will spread 1 to the four most significant bytes.
Then the condition (cookie != s->rx_cookie) becomes false.

Signed-off-by: Alexis Dambricourt <alexis.dambricourt@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet: ne2000: fix bounds check in ioport operations
Prasad J Pandit [Thu, 31 Dec 2015 11:35:27 +0000 (17:05 +0530)]
net: ne2000: fix bounds check in ioport operations

While doing ioport r/w operations, ne2000 device emulation suffers
from OOB r/w errors. Update respective array bounds check to avoid
OOB access.

Reported-by: Ling Liu <liuling-it@360.cn>
Cc: qemu-stable@nongnu.org
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet: rocker: fix an incorrect array bounds check
Prasad J Pandit [Mon, 28 Dec 2015 10:54:08 +0000 (16:24 +0530)]
net: rocker: fix an incorrect array bounds check

While processing transmit(tx) descriptors in 'tx_consume' routine
the switch emulator suffers from an off-by-one error, if a
descriptor was to have more than allowed(ROCKER_TX_FRAGS_MAX=16)
fragments. Fix an incorrect bounds check to avoid it.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agovmxnet3: Introduce 'x-disable-pcie' back-compat property
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:40 +0000 (09:17 +0200)]
vmxnet3: Introduce 'x-disable-pcie' back-compat property

Following the previous patch which changed vmxnet3 to be a pci express
device, this patch introduces a boolean property 'x-disable-pcie' whose
default is false.

Setting 'x-disable-pcie' to 'on' preserves the old 'pci device' (non
express) behavior. This allows migration to older versions.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agovmxnet3: Report the Device Serial Number capability
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:41 +0000 (09:17 +0200)]
vmxnet3: Report the Device Serial Number capability

Report the DSN extended PCI capability at 0x100.
DSN value is a transformation of device MAC address, as calculated
by VMware virtual hardware.

DSN is reported only if device is pcie.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agovmxnet3: The vmxnet3 device is a PCIE endpoint
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:39 +0000 (09:17 +0200)]
vmxnet3: The vmxnet3 device is a PCIE endpoint

Report the 'express endpoint' capability if on a PCIE bus.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agovmxnet3: coding: Introduce VMXNET3Class
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:38 +0000 (09:17 +0200)]
vmxnet3: coding: Introduce VMXNET3Class

Introduce a class type for vmxnet3, and the usual
DEVICE_CLASS/DEVICE_GET_CLASS macros.

No semantic change.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agovmxnet3: Introduce 'x-old-msi-offsets' back-compat property
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:37 +0000 (09:17 +0200)]
vmxnet3: Introduce 'x-old-msi-offsets' back-compat property

Following the previous patches, where vmxnet3's pci's msi/msix
capability offsets and msix's PBA table offsets have been changed, this
patch introduces a boolean property 'x-old-msi-offsets' to vmxnet3,
whose default is false.

Setting 'x-old-msi-offsets' to 'on' preserves the old offsets behavior,
which allows migration to older versions.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agovmxnet3: Change the offset of the MSIX PBA table
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:36 +0000 (09:17 +0200)]
vmxnet3: Change the offset of the MSIX PBA table

Place the PBA table at 0x1000, as placed by VMware virtual hardware.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agovmxnet3: Change offsets of msi/msix pci capabilities
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:35 +0000 (09:17 +0200)]
vmxnet3: Change offsets of msi/msix pci capabilities

Place device reported PCI capabilities at the same offsets as placed by
the VMware virtual hardware: MSI at [84], MSI-X at [9c].

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/filter: fix nf->netdev_id leak
Li Zhijian [Wed, 23 Dec 2015 07:43:18 +0000 (15:43 +0800)]
net/filter: fix nf->netdev_id leak

Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/dump: fix nfds->filename leak
Li Zhijian [Wed, 23 Dec 2015 07:43:19 +0000 (15:43 +0800)]
net/dump: fix nfds->filename leak

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISION
Miao Yan [Wed, 23 Dec 2015 06:06:11 +0000 (22:06 -0800)]
net/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISION

VMXNET3_DEVICE_VERSION is used as return value for accessing
UPT Revision Report and Selection register. So rename it
to VMXNET3_UPT_REVISION.

Signed-off-by: Miao Yan <yanmiaoebest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: return 0 on unknown command
Miao Yan [Wed, 23 Dec 2015 06:06:10 +0000 (22:06 -0800)]
net/vmxnet3: return 0 on unknown command

Return 0 on unknown command, this is what esxi (5.x+) behaves.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO
Miao Yan [Wed, 23 Dec 2015 06:06:09 +0000 (22:06 -0800)]
net/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO

VMXNET3_CMD_GET_DEV_EXTRA_INFO should return 0 for emulation
mode

This behavior can be observed by the following steps:

1) run a Linux distro on esxi server (5.x+)
2) modify vmxnet3 Linux driver to read the register:

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DEV_EXTRA_INFO);
  ret =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
  pr_info("vmxnet3 dev_info: 0x%x\n", ret);

The kernel log will have some like the following message:

  [ 7005.111170] vmxnet3 dev_info: 0x0

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command
Miao Yan [Wed, 23 Dec 2015 06:06:08 +0000 (22:06 -0800)]
net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command

VMXNET3_CMD_GET_DID_LO should return PCI ID of the device
and VMXNET3_CMD_GET_DID_HI should return vmxnet3 revision ID.

This behavior can be observed by the following steps:

1) run a Linux distro on esxi server (5.x+)
2) modify vmxnet3 Linux driver to read DID_HI and DID_LO:

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_LO);
  lo =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_HI);
  high =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
  pr_info("vmxnet3 DID lo: 0x%x, high: 0x%x\n", lo, high);

The kernel log will have something like the following message:

  [ 7005.111170] vmxnet3 DID lo: 0x7b0, high: 0x1

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: return 1 on device activation failure
Miao Yan [Wed, 23 Dec 2015 06:06:07 +0000 (22:06 -0800)]
net/vmxnet3: return 1 on device activation failure

When reading device status, 0 means device is successfully
activated and 1 means error.

This behavior can be observed by the following steps:

1) run a Linux distro on esxi server (5.5+)
2) modify vmxnet3 Linux driver to give it an invalid
   address to 'adapter->shared_pa' which is the
   shared memory for guest/host communication

This will trigger device activation failure and kernel
log will have the following message:

   [ 7138.403256] vmxnet3 0000:03:00.0 eth1: Failed to activate dev: error 1

So return 1 on device activation failure instead of -1;

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agoMAINTAINERS: Add an entry for the net/slirp.c file
Thomas Huth [Tue, 15 Dec 2015 08:48:15 +0000 (09:48 +0100)]
MAINTAINERS: Add an entry for the net/slirp.c file

The file net/slirp.c should be listed in the SLIRP section, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet: vmxnet3: avoid memory leakage in activate_device
P J P [Tue, 15 Dec 2015 06:57:54 +0000 (12:27 +0530)]
net: vmxnet3: avoid memory leakage in activate_device

Vmxnet3 device emulator does not check if the device is active
before activating it, also it did not free the transmit & receive
buffers while deactivating the device, thus resulting in memory
leakage on the host. This patch fixes both these issues to avoid
host memory leakage.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: remove redundant VMW_SHPRN(...) definition
Miao Yan [Tue, 8 Dec 2015 05:28:33 +0000 (21:28 -0800)]
net/vmxnet3: remove redundant VMW_SHPRN(...) definition

Macro VMW_SHPRN(...) is already defined vmxnet3_debug.h,
so remove the duplication

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: fix debug macro pattern for vmxnet3
Miao Yan [Tue, 8 Dec 2015 05:28:32 +0000 (21:28 -0800)]
net/vmxnet3: fix debug macro pattern for vmxnet3

Vmxnet3 uses the following debug macro style:

 #ifdef SOME_DEBUG
 #  define debug(...) do{ printf(...); } while (0)
 # else
 #  define debug(...) do{ } while (0)
 #endif

If SOME_DEBUG is undefined, then format string inside the
debug macro will never be checked by compiler. Code is
likely to break in the future when SOME_DEBUG is enabled
 because of lack of testing. This patch changes this
to the following:

 #define debug(...) \
  do { if (SOME_DEBUG_ENABLED) printf(...); } while (0)

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: use %zu for size_t in printf
Miao Yan [Tue, 8 Dec 2015 05:28:31 +0000 (21:28 -0800)]
net/vmxnet3: use %zu for size_t in printf

Use %zu specifier for size_t in printf, otherwise build would fail
on platforms where size_t is not unsigned long

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agonet/vmxnet3: fix a build error when enabling debug output
Miao Yan [Tue, 8 Dec 2015 05:28:30 +0000 (21:28 -0800)]
net/vmxnet3: fix a build error when enabling debug output

Macro MAC_FMT and MAC_ARG are not defined, but used in vmxnet3_net_init().
This will cause build error when debug level is raised in
vmxnet3_debug.h (enable all VMXNET3_DEBUG_xxx).

Use VMXNET_MF and VXMNET_MA instead.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
9 years agohw/ppc/spapr_rtc: Remove bad class_size value
Thomas Huth [Fri, 18 Dec 2015 09:06:14 +0000 (10:06 +0100)]
hw/ppc/spapr_rtc: Remove bad class_size value

class_size = sizeof(XICSStateClass) does not make much sense
in the RTC code and likely was just a copy-n-paste error.
Let's simply remove it.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agovirtio: fix error message for number of queues
Cornelia Huck [Fri, 8 Jan 2016 10:00:00 +0000 (11:00 +0100)]
virtio: fix error message for number of queues

There's no such thing as "PCI queues" in the virtio core.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoivshmem: Store file descriptor for vhost-user negotiation
Tetsuya Mukawa [Mon, 21 Dec 2015 03:47:34 +0000 (12:47 +0900)]
ivshmem: Store file descriptor for vhost-user negotiation

If virtio-net driver allocates memory in ivshmem shared memory,
vhost-net will work correctly, but vhost-user will not work because
a fd of shared memory will not be sent to vhost-user backend.
This patch fixes ivshmem to store file descriptor of shared memory.
It will be used when vhost-user negotiates vhost-user backend.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agomigration/virtio: Remove simple .get/.put use
Dr. David Alan Gilbert [Wed, 6 Jan 2016 12:23:39 +0000 (12:23 +0000)]
migration/virtio: Remove simple .get/.put use

The 'virtqueue_state' and 'ringsize' can be saved using VMSTATE
macros rather than hand coded .get/.put

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
9 years agoAdd VMSTATE_STRUCT_VARRAY_KNOWN
Dr. David Alan Gilbert [Wed, 6 Jan 2016 12:23:38 +0000 (12:23 +0000)]
Add VMSTATE_STRUCT_VARRAY_KNOWN

At the moment we have VMSTATE_STRUCT_ARRAY that requires
the field is declared as an array of fixed size.
We also have VMSTATE_STRUCT_VARRAY_UINT* that allows
a field declared as a pointer, but requires that the length
is a field member in the structure being loaded/saved.

VMSTATE_STRUCT_VARRAY_KNOWN is for arrays defined as pointers
yet we somehow know the length of.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
9 years agoi386/pc: expose identifying the floppy controller
Roman Kagan [Wed, 30 Dec 2015 20:11:51 +0000 (23:11 +0300)]
i386/pc: expose identifying the floppy controller

Factor out and expose the function to locate the floppy controller in
the system.
It will allow to dynamically populate the relevant objects in the ACPI
tables.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: qemu-block@nongnu.org
Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: remove unused ASL templates and related blobs/utils
Igor Mammedov [Mon, 28 Dec 2015 17:02:58 +0000 (18:02 +0100)]
pc: acpi: remove unused ASL templates and related blobs/utils

QEMU now uses internally composed DSDT so drop now
empty *.dsl templates and related *.generated
binary blobs.

Also since templates are not used anymore/obolete
remove utility scripts used for extracting/patching
AML blobs compiled by IASL and for updating them
in git tree.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: switch to AML API composed DSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:57 +0000 (18:02 +0100)]
pc: acpi: switch to AML API composed DSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:56 +0000 (18:02 +0100)]
pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move PCI0 device definition into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:55 +0000 (18:02 +0100)]
pc: acpi: q35: move PCI0 device definition into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move PCI0._OSC() method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:54 +0000 (18:02 +0100)]
pc: acpi: q35: move PCI0._OSC() method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move _PIC() method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:53 +0000 (18:02 +0100)]
pc: acpi: q35: move _PIC() method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move PRTP routing table into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:52 +0000 (18:02 +0100)]
pc: acpi: q35: move PRTP routing table into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move PRTA routing table into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:51 +0000 (18:02 +0100)]
pc: acpi: q35: move PRTA routing table into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move _PRT() into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:50 +0000 (18:02 +0100)]
pc: acpi: q35: move _PRT() into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move ISA bridge into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:49 +0000 (18:02 +0100)]
pc: acpi: q35: move ISA bridge into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move IQST() into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:48 +0000 (18:02 +0100)]
pc: acpi: q35: move IQST() into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move IQCR() into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:47 +0000 (18:02 +0100)]
pc: acpi: q35: move IQCR() into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move link devices to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:46 +0000 (18:02 +0100)]
pc: acpi: q35: move link devices to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: q35: move GSI links to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:45 +0000 (18:02 +0100)]
pc: acpi: q35: move GSI links to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: piix4: acpi move PCI0 device to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:44 +0000 (18:02 +0100)]
pc: acpi: piix4: acpi move PCI0 device to SSDT

leave Scope(\_SB) definition in DSDT so that iasl
would be able to compile DSDT since we are still
need definition block for table.
After Q35 ASL is converted, DSDT templates will
be completly replaced by AML API generated tables.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: piix4: move remaining PCI hotplug bits into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:43 +0000 (18:02 +0100)]
pc: acpi: piix4: move remaining PCI hotplug bits into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: piix4: move PCI0._PRT() into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:42 +0000 (18:02 +0100)]
pc: acpi: piix4: move PCI0._PRT() into SSDT

PCI routing table for expander buses is build with help
of build_prt() using AML API. And it's almost the same
as PRT for PCI0 bus except of power-management device.
So make existing build_prt() build PRT table for PCI0
bus as well.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: piix4: move IQST() into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:41 +0000 (18:02 +0100)]
pc: acpi: piix4: move IQST() into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: piix4: move IQCR() into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:40 +0000 (18:02 +0100)]
pc: acpi: piix4: move IQCR() into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: pci: move link devices into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:39 +0000 (18:02 +0100)]
pc: acpi: pci: move link devices into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move remaining GPE handlers into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:38 +0000 (18:02 +0100)]
pc: acpi: move remaining GPE handlers into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:37 +0000 (18:02 +0100)]
pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT

and also move PRQx fields declaration as it can't be
split out into separate patch since fields use
PCI0.ISA.P40C operation region and OperationRegion
must be declared in the same table as a Field that
uses it. If this condition is not statisfied Windows
will BSOD ans IASL (make check) will error out as well.

For the same reason pm is moved together with isa-bridge
as the later refernces P13C OperationRegion from pm device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move COM devices from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:36 +0000 (18:02 +0100)]
pc: acpi: move COM devices from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move LPT device from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:35 +0000 (18:02 +0100)]
pc: acpi: move LPT device from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move FDC0 device from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:34 +0000 (18:02 +0100)]
pc: acpi: move FDC0 device from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move MOU device from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:33 +0000 (18:02 +0100)]
pc: acpi: move MOU device from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move KBD device from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:32 +0000 (18:02 +0100)]
pc: acpi: move KBD device from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move RTC device from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:31 +0000 (18:02 +0100)]
pc: acpi: move RTC device from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move DBUG() from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:30 +0000 (18:02 +0100)]
pc: acpi: move DBUG() from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: move HPET from DSDT to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:29 +0000 (18:02 +0100)]
pc: acpi: move HPET from DSDT to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: factor out cpu hotplug code from build_ssdt() into separate function
Igor Mammedov [Mon, 28 Dec 2015 17:02:28 +0000 (18:02 +0100)]
pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: cpuhp: move \_GPE._E02() into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:27 +0000 (18:02 +0100)]
pc: acpi: cpuhp: move \_GPE._E02() into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: cpuhp: move PRSC() method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:26 +0000 (18:02 +0100)]
pc: acpi: cpuhp: move PRSC() method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: cpuhp: move CPST() method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:25 +0000 (18:02 +0100)]
pc: acpi: cpuhp: move CPST() method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: cpuhp: move CPMA() method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:24 +0000 (18:02 +0100)]
pc: acpi: cpuhp: move CPMA() method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: cpuhp: move CPEJ() method to SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:23 +0000 (18:02 +0100)]
pc: acpi: cpuhp: move CPEJ() method to SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: drop unused CPU_STATUS_LEN from DSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:22 +0000 (18:02 +0100)]
pc: acpi: drop unused CPU_STATUS_LEN from DSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
Igor Mammedov [Mon, 28 Dec 2015 17:02:21 +0000 (18:02 +0100)]
pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage

most of MEMORY_foo defines are not shared
with ASL anymore and are used only inside of
memory_hotplug_acpi_table.c, so move them
there and make them strings. As result we
can replace stringify(MEMORY_foo) with just
MEMORY_foo, which makes code a bit cleaner.

No AML change introduced by this patch.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move \_GPE._E03 into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:20 +0000 (18:02 +0100)]
pc: acpi: memhp: move \_GPE._E03 into SSDT

in addition remove no longer needed acpi-dsdt-mem-hotplug.dsl.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: factor out memhp code from build_ssdt() into separate function
Igor Mammedov [Mon, 28 Dec 2015 17:02:19 +0000 (18:02 +0100)]
pc: acpi: factor out memhp code from build_ssdt() into separate function

before consolidating memhp code in memory_hotplug_acpi_table.c
and for simplifying review, first factor out memhp code into
new function build_memory_devices() in i386/acpi-build.c

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
PS:
   no functional change, only code movement.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD Device into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:18 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD Device into SSDT

move remnants of MHPD device from DSDT into SSDT.
 i.e. Device(MHPD), _UID, _HID

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD.MCRS method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:17 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD.MCRS method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD.MEJ0 method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:16 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD.MEJ0 method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD.MOST method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:15 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD.MOST method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD.MPXM method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:14 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD.MPXM method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD.MRST method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:13 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD.MRST method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD.MSCN method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:12 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD.MSCN method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD.MLCK mutex into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:11 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD.MLCK mutex into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: move MHPD._STA method into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:10 +0000 (18:02 +0100)]
pc: acpi: memhp: move MHPD._STA method into SSDT

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
Igor Mammedov [Mon, 28 Dec 2015 17:02:09 +0000 (18:02 +0100)]
pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotests: acpi: print ASL diff in verbose mode
Igor Mammedov [Mon, 28 Dec 2015 17:02:08 +0000 (18:02 +0100)]
tests: acpi: print ASL diff in verbose mode

print ASL difference if there is any when
executing 'make V=1 check'.
Use 'DIFF' environment variable to determine
which diff utility to use and if it's not set
notify user by printing warning that DIFF is
not set if run in verbose mode and there is
difference in ASL.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/i386: fill in the CENTURY field of the FADT (FACP) ACPI table
Laszlo Ersek [Thu, 10 Dec 2015 17:25:34 +0000 (18:25 +0100)]
hw/i386: fill in the CENTURY field of the FADT (FACP) ACPI table

The ACPI specification (minimally versions 1.0b through 6.0) define the
FADT.CENTURY field as:

  The RTC CMOS RAM index to the century of data value (hundred and
  thousand year decimals). If this field contains a zero, then the RTC
  centenary feature is not supported. If this field has a non-zero value,
  then this field contains an index into RTC RAM space that OSPM can use
  to program the centenary field.

The x86 targets generate ACPI payload, emulate an RTC
(CONFIG_MC146818RTC), and that RTC supports the "centenary feature" (see
occurrences of RTC_CENTURY in cmos_ioport_write() and cmos_ioport_read()
in "hw/timer/mc146818rtc.c".)

However, FADT.CENTURY is left at zero currently:

  [06Ch 0108   1]            RTC Century Index : 00

which -- according to analysis done by Ruiyu Ni at Intel -- should cause
Linux and Windows 8+ to think the RTC centenary feature is unavailable,
and cause Windows 7 to (incorrectly) assume that the offset to use is
constant 0x32. (0x32 happens to be the right value on QEMU, but Windows 7
is wrong to assume anything at all).

Exposing the right nonzero offset in FADT.CENTURY informs Linux and
Windows 8+ about the right capabilities of the hardware, plus it retrofits
our FADT to Windows 7's behavior.

Regression tested with the following guests (all UEFI installs):
- i386 Q35: Fedora 21 ("Fedlet" edition)
- x86_64:
  - i440fx:
    - Fedora 21
    - RHEL 6 and 7
    - Windows 7 and 10
    - Windows Server 2008 R2 and 2012 R2
  - Q35:
    - Fedora 22
    - Windows 8.1

Cc: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
Cc: Igor Mammedov <imammedo@redhat.com> (supporter:ACPI/SMBIOS)
Cc: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
Cc: Richard Henderson <rth@twiddle.net> (maintainer:X86)
Cc: Eduardo Habkost <ehabkost@redhat.com> (maintainer:X86)
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>