qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 14c9fd: cryptodev: Introduce cryptodev.json


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 14c9fd: cryptodev: Introduce cryptodev.json
Date: Fri, 10 Mar 2023 09:32:45 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 14c9fd1673ac8c6855a93c882870da8403b5a5d6
      
https://github.com/qemu/qemu/commit/14c9fd1673ac8c6855a93c882870da8403b5a5d6
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M MAINTAINERS
    M backends/cryptodev-builtin.c
    M backends/cryptodev-lkcf.c
    M backends/cryptodev-vhost-user.c
    M backends/cryptodev-vhost.c
    M include/sysemu/cryptodev.h
    A qapi/cryptodev.json
    M qapi/meson.build
    M qapi/qapi-schema.json

  Log Message:
  -----------
  cryptodev: Introduce cryptodev.json

Introduce QCryptodevBackendType in cryptodev.json, also apply this to
related codes. Then we can drop 'enum CryptoDevBackendOptionsType'.

Note that `CRYPTODEV_BACKEND_TYPE_NONE` is *NOT* used by anywhere, so
drop it(no 'none' enum in QCryptodevBackendType).

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-2-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 3f478371fde24778ac09b4f7ffa82b00e87a97ec
      
https://github.com/qemu/qemu/commit/3f478371fde24778ac09b4f7ffa82b00e87a97ec
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev-builtin.c
    M backends/cryptodev-lkcf.c
    M backends/cryptodev-vhost-user.c
    M backends/cryptodev.c
    M include/sysemu/cryptodev.h

  Log Message:
  -----------
  cryptodev: Remove 'name' & 'model' fields

We have already used qapi to generate crypto device types, this allows
to convert type to a string 'model', so the 'model' field is not
needed.

And the 'name' field is not used by any backend driver, drop it.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-3-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 999c789f0018151906484c25faff495b89b549dc
      
https://github.com/qemu/qemu/commit/999c789f0018151906484c25faff495b89b549dc
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev-builtin.c
    M backends/cryptodev-lkcf.c
    M backends/cryptodev.c
    M hw/virtio/virtio-crypto.c
    M include/sysemu/cryptodev.h
    M qapi/cryptodev.json

  Log Message:
  -----------
  cryptodev: Introduce cryptodev alg type in QAPI

Introduce cryptodev alg type in cryptodev.json, then apply this to
related codes, and drop 'enum CryptoDevBackendAlgType'.

There are two options:
1, { 'enum': 'QCryptodevBackendAlgType',
  'prefix': 'CRYPTODEV_BACKEND_ALG',
  'data': ['sym', 'asym']}
Then we can keep 'CRYPTODEV_BACKEND_ALG_SYM' and avoid lots of
changes.
2, changes in this patch(with prefix 'QCRYPTODEV_BACKEND_ALG').

To avoid breaking the rule of QAPI, use 2 here.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-4-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: bc304a6442e9abc3a7b56bb0b268dedb70ad3448
      
https://github.com/qemu/qemu/commit/bc304a6442e9abc3a7b56bb0b268dedb70ad3448
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev-builtin.c
    M backends/cryptodev-lkcf.c
    M backends/cryptodev-vhost-user.c
    M hw/virtio/virtio-crypto.c
    M qapi/cryptodev.json

  Log Message:
  -----------
  cryptodev: Introduce server type in QAPI

Introduce cryptodev service type in cryptodev.json, then apply this
to related codes. Now we can remove VIRTIO_CRYPTO_SERVICE_xxx
dependence from QEMU cryptodev.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-5-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 5dcb0198109429c9f54adce939ad825eabe857b4
      
https://github.com/qemu/qemu/commit/5dcb0198109429c9f54adce939ad825eabe857b4
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev.c
    M qapi/cryptodev.json

  Log Message:
  -----------
  cryptodev: Introduce 'query-cryptodev' QMP command

Now we have a QMP command to query crypto devices:
virsh qemu-monitor-command vm '{"execute": "query-cryptodev"}' | jq
{
  "return": [
    {
      "service": [
        "akcipher",
        "mac",
        "hash",
        "cipher"
      ],
      "id": "cryptodev1",
      "client": [
        {
          "queue": 0,
          "type": "builtin"
        }
      ]
    },
    {
      "service": [
        "akcipher"
      ],
      "id": "cryptodev0",
      "client": [
        {
          "queue": 0,
          "type": "lkcf"
        }
      ]
    }
  ],
  "id": "libvirt-417"
}

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-6-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: abca0fc329a89c1a497974db50f284a37c32f2f5
      
https://github.com/qemu/qemu/commit/abca0fc329a89c1a497974db50f284a37c32f2f5
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev-builtin.c

  Log Message:
  -----------
  cryptodev-builtin: Detect akcipher capability

Rather than exposing akcipher service/RSA algorithm to virtio crypto
device unconditionally, detect akcipher capability from akcipher
crypto framework. This avoids unsuccessful requests.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-7-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: ef52091aebb9860d9a454a792a9fbd66acdc63c8
      
https://github.com/qemu/qemu/commit/ef52091aebb9860d9a454a792a9fbd66acdc63c8
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    A backends/cryptodev-hmp-cmds.c
    M backends/meson.build
    M hmp-commands-info.hx
    M include/monitor/hmp.h

  Log Message:
  -----------
  hmp: add cryptodev info command

Example of this command:
 # virsh qemu-monitor-command vm --hmp info cryptodev
cryptodev1: service=[akcipher|mac|hash|cipher]
    queue 0: type=builtin
cryptodev0: service=[akcipher]
    queue 0: type=lkcf

Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-8-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 2cb0692768c2d29333a6ad89fd081c97562bd899
      
https://github.com/qemu/qemu/commit/2cb0692768c2d29333a6ad89fd081c97562bd899
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev-builtin.c
    M backends/cryptodev-lkcf.c
    M backends/cryptodev.c
    M hw/virtio/virtio-crypto.c
    M include/sysemu/cryptodev.h

  Log Message:
  -----------
  cryptodev: Use CryptoDevBackendOpInfo for operation

Move queue_index, CryptoDevCompletionFunc and opaque into struct
CryptoDevBackendOpInfo, then cryptodev_backend_crypto_operation()
needs an argument CryptoDevBackendOpInfo *op_info only. And remove
VirtIOCryptoReq from cryptodev. It's also possible to hide
VirtIOCryptoReq into virtio-crypto.c in the next step. (In theory,
VirtIOCryptoReq is a private structure used by virtio-crypto only)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-9-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: e7a775fd9fc08550c4525bc331b1cda342b459dd
      
https://github.com/qemu/qemu/commit/e7a775fd9fc08550c4525bc331b1cda342b459dd
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev.c
    M include/sysemu/cryptodev.h

  Log Message:
  -----------
  cryptodev: Account statistics

Account OPS/BPS for crypto device, this will be used for 'query-stats'
QEMU monitor command and QoS in the next step.

Note that a crypto device may support symmetric mode, asymmetric mode,
both symmetric and asymmetric mode. So we use two structure to
describe the statistics of a crypto device.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-10-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


  Commit: 2580b452ffccfb2bcba97dbfcb0d6067d06bc453
      
https://github.com/qemu/qemu/commit/2580b452ffccfb2bcba97dbfcb0d6067d06bc453
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev.c
    M include/sysemu/cryptodev.h
    M qapi/qom.json

  Log Message:
  -----------
  cryptodev: support QoS

Add 'throttle-bps' and 'throttle-ops' limitation to set QoS. The
two arguments work with both QEMU command line and QMP command.

Example of QEMU command line:
-object cryptodev-backend-builtin,id=cryptodev1,throttle-bps=1600,\
throttle-ops=100

Example of QMP command:
virsh qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \
throttle-ops 100

or cancel limitation:
virsh qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \
throttle-ops 0

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-11-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: f2b901098e14ad1aaffab82464917b8679499cc5
      
https://github.com/qemu/qemu/commit/f2b901098e14ad1aaffab82464917b8679499cc5
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M backends/cryptodev.c
    M qapi/stats.json
    M stats/stats-hmp-cmds.c
    M stats/stats-qmp-cmds.c

  Log Message:
  -----------
  cryptodev: Support query-stats QMP command

Now we can use "query-stats" QMP command to query statistics of
crypto devices. (Originally this was designed to show statistics
by '{"execute": "query-cryptodev"}'. Daniel Berrangé suggested that
querying configuration info by "query-cryptodev", and querying
runtime performance info by "query-stats". This makes sense!)

Example:
~# virsh qemu-monitor-command vm '{"execute": "query-stats", \
   "arguments": {"target": "cryptodev"} }' | jq
{
  "return": [
    {
      "provider": "cryptodev",
      "stats": [
        {
          "name": "asym-verify-bytes",
          "value": 7680
        },
        ...
        {
          "name": "asym-decrypt-ops",
          "value": 32
        },
        {
          "name": "asym-encrypt-ops",
          "value": 48
        }
      ],
      "qom-path": "/objects/cryptodev0" # support asym only
    },
    {
      "provider": "cryptodev",
      "stats": [
        {
          "name": "asym-verify-bytes",
          "value": 0
        },
        ...
        {
          "name": "sym-decrypt-bytes",
          "value": 5376
        },
        ...
      ],
      "qom-path": "/objects/cryptodev1" # support asym/sym
    }
  ],
  "id": "libvirt-422"
}

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-12-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 2133e07c4ca1d0befa382e557d2f6b38c77ed689
      
https://github.com/qemu/qemu/commit/2133e07c4ca1d0befa382e557d2f6b38c77ed689
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M MAINTAINERS

  Log Message:
  -----------
  MAINTAINERS: add myself as the maintainer for cryptodev

I developed the akcipher service, QoS setting, QMP/HMP commands and
statistics accounting for crypto device. Making myself as the
maintainer for QEMU's cryptodev.

Cc: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230301105847.253084-13-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 00ef422e9fbfef1fb40447b08826db0951d788dd
      
https://github.com/qemu/qemu/commit/00ef422e9fbfef1fb40447b08826db0951d788dd
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M net/vhost-vdpa.c

  Log Message:
  -----------
  vdpa net: move iova tree creation from init to start

Only create iova_tree if and when it is needed.

The cleanup keeps being responsible for the last VQ but this change
allows it to merge both cleanup functions.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230303172445.1089785-2-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: b2765243863cf93d2bab1a1c2e14d6dc61981a6b
      
https://github.com/qemu/qemu/commit/b2765243863cf93d2bab1a1c2e14d6dc61981a6b
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: Remember last call fd set

As SVQ can be enabled dynamically at any time, it needs to store call fd
always.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-3-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: d83b4945805d68f47742f70bba2ea4d5c9880dc8
      
https://github.com/qemu/qemu/commit/d83b4945805d68f47742f70bba2ea4d5c9880dc8
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: Negotiate _F_SUSPEND feature

This is needed for qemu to know it can suspend the device to retrieve
its status and enable SVQ with it, so all the process is transparent to
the guest.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230303172445.1089785-4-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 4241e8bd728f1014ac977eb6756e41f549d93efd
      
https://github.com/qemu/qemu/commit/4241e8bd728f1014ac977eb6756e41f549d93efd
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-shadow-virtqueue.c
    M hw/virtio/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: rewind at get_base, not set_base

At this moment it is only possible to migrate to a vdpa device running
with x-svq=on. As a protective measure, the rewind of the inflight
descriptors was done at the destination. That way if the source sent a
virtqueue with inuse descriptors they are always discarded.

Since this series allows to migrate also to passthrough devices with no
SVQ, the right thing to do is to rewind at the source so the base of
vrings are correct.

Support for inflight descriptors may be added in the future.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230303172445.1089785-5-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: b6662cb7e5376659c7abb56efe27dcf3898d4fe6
      
https://github.com/qemu/qemu/commit/b6662cb7e5376659c7abb56efe27dcf3898d4fe6
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c
    M include/hw/virtio/vhost-vdpa.h

  Log Message:
  -----------
  vdpa: add vhost_vdpa->suspended parameter

This allows vhost_vdpa to track if it is safe to get the vring base from
the device or not.  If it is not, vhost can fall back to fetch idx from
the guest buffer again.

No functional change intended in this patch, later patches will use this
field.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-6-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 0bb302a9960a186fc488068d268dc373e6b70876
      
https://github.com/qemu/qemu/commit/0bb302a9960a186fc488068d268dc373e6b70876
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/trace-events
    M hw/virtio/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: add vhost_vdpa_suspend

The function vhost.c:vhost_dev_stop fetches the vring base so the vq
state can be migrated to other devices.  However, this is unreliable in
vdpa, since we didn't signal the device to suspend the queues, making
the value fetched useless.

Suspend the device if possible before fetching first and subsequent
vring bases.

Moreover, vdpa totally reset and wipes the device at the last device
before fetch its vrings base, making that operation useless in the last
device. This will be fixed in later patches of this series.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-7-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: c3716f260bff1bd3586a0dc3477e1febdd3a3f35
      
https://github.com/qemu/qemu/commit/c3716f260bff1bd3586a0dc3477e1febdd3a3f35
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c
    M hw/virtio/vhost.c
    M include/hw/virtio/vhost-backend.h

  Log Message:
  -----------
  vdpa: move vhost reset after get vring base

The function vhost.c:vhost_dev_stop calls vhost operation
vhost_dev_start(false). In the case of vdpa it totally reset and wipes
the device, making the fetching of the vring base (virtqueue state) totally
useless.

The kernel backend does not use vhost_dev_start vhost op callback, but
vhost-user do. A patch to make vhost_user_dev_start more similar to vdpa
is desirable, but it can be added on top.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-8-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 6949843046b6f9c4c6cd28922d5427a17414dfc9
      
https://github.com/qemu/qemu/commit/6949843046b6f9c4c6cd28922d5427a17414dfc9
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M net/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: add vdpa net migration state notifier

This allows net to restart the device backend to configure SVQ on it.

Ideally, these changes should not be net specific and they could be done
in:
* vhost_vdpa_set_features (with VHOST_F_LOG_ALL)
* vhost_vdpa_set_vring_addr (with .enable_log)
* vhost_vdpa_set_log_base.

However, the vdpa net backend is the one with enough knowledge to
configure everything because of some reasons:
* Queues might need to be shadowed or not depending on its kind (control
  vs data).
* Queues need to share the same map translations (iova tree).

Also, there are other problems that may have solutions but complicates
the implementation at this stage:
* We're basically duplicating vhost_dev_start and vhost_dev_stop, and
  they could go out of sync.  If we want to reuse them, we need a way to
  skip some function calls to avoid recursiveness (either vhost_ops ->
  vhost_set_features, vhost_set_vring_addr, ...).
* We need to traverse all vhost_dev of a given net device twice: one to
  stop and get the vq state and another one after the reset to
  configure properties like address, fd, etc.

Because of that it is cleaner to restart the whole net backend and
configure again as expected, similar to how vhost-kernel moves between
userspace and passthrough.

If more kinds of devices need dynamic switching to SVQ we can:
* Create a callback struct like VhostOps and move most of the code
  there.  VhostOps cannot be reused since all vdpa backend share them,
  and to personalize just for networking would be too heavy.
* Add a parent struct or link all the vhost_vdpa or vhost_dev structs so
  we can traverse them.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-9-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: a230c4712b9d4af202883b789e80780265b00de7
      
https://github.com/qemu/qemu/commit/a230c4712b9d4af202883b789e80780265b00de7
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: disable RAM block discard only for the first device

Although it does not make a big difference, its more correct and
simplifies the cleanup path in subsequent patches.

Move ram_block_discard_disable(false) call to the top of
vhost_vdpa_cleanup because:
* We cannot use vhost_vdpa_first_dev after dev->opaque = NULL
  assignment.
* Improve the stack order in cleanup: since it is the last action taken
  in init, it should be the first at cleanup.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-10-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 9c363cf6d5982c568431531a8da26ccb0fcb3038
      
https://github.com/qemu/qemu/commit/9c363cf6d5982c568431531a8da26ccb0fcb3038
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c
    M include/hw/virtio/vhost-vdpa.h
    M net/vhost-vdpa.c

  Log Message:
  -----------
  vdpa net: block migration if the device has CVQ

Devices with CVQ need to migrate state beyond vq state.  Leaving this to
future series.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-11-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 5c1ebd4c432eda629aeb7a4ecab45220d0272616
      
https://github.com/qemu/qemu/commit/5c1ebd4c432eda629aeb7a4ecab45220d0272616
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M net/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: block migration if device has unsupported features

A vdpa net device must initialize with SVQ in order to be migratable at
this moment, and initialization code verifies some conditions.  If the
device is not initialized with the x-svq parameter, it will not expose
_F_LOG so the vhost subsystem will block VM migration from its
initialization.

Next patches change this, so we need to verify migration conditions
differently.

QEMU only supports a subset of net features in SVQ, and it cannot
migrate state that cannot track or restore in the destination.  Add a
migration blocker if the device offers an unsupported feature.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-12-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 57ac831865e370012496fb581a38d261cb72c5d0
      
https://github.com/qemu/qemu/commit/57ac831865e370012496fb581a38d261cb72c5d0
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: block migration if SVQ does not admit a feature

Next patches enable devices to be migrated even if vdpa netdev has not
been started with x-svq. However, not all devices are migratable, so we
need to block migration if we detect that.

Block migration if we detect the device expose a feature SVQ does not
know how to work with.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-13-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 609ab4c3ed8d6b6a4d94930fb9185412b2ba0d0c
      
https://github.com/qemu/qemu/commit/609ab4c3ed8d6b6a4d94930fb9185412b2ba0d0c
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M net/vhost-vdpa.c

  Log Message:
  -----------
  vdpa net: allow VHOST_F_LOG_ALL

Since some actions move to the start function instead of init, the
device features may not be the parent vdpa device's, but the one
returned by vhost backend.  If transition to SVQ is supported, the vhost
backend will return _F_LOG_ALL to signal the device is migratable.

Add VHOST_F_LOG_ALL.  HW dirty page tracking can be added on top of this
change if the device supports it in the future.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230303172445.1089785-14-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: ab7337e3b2378a1cc28806eaf31bb72ba9e046d6
      
https://github.com/qemu/qemu/commit/ab7337e3b2378a1cc28806eaf31bb72ba9e046d6
  Author: Eugenio Pérez <eperezma@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-vdpa.c

  Log Message:
  -----------
  vdpa: return VHOST_F_LOG_ALL in vhost-vdpa devices

vhost-vdpa devices can return this feature now that blockers have been
set in case some features are not met.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230303172445.1089785-15-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 7cb230788eb73aaadfa9336839bf5527bb4f0f4c
      
https://github.com/qemu/qemu/commit/7cb230788eb73aaadfa9336839bf5527bb4f0f4c
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test.c

  Log Message:
  -----------
  Revert "tests/qtest: Check for devices in bios-tables-test"

This reverts commit c471eb4f40445908c1be7bb11a37ac676a0edae7.

which broke acpi tables test and rebuild due to skipping some tests
even thought none of devices tests depend on weren't disabled.

As result it leads to some expected tables not being updated,
merge conflicts and tests failure.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-2-imammedo@redhat.com>
Acked-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: d3860a57c7b8f36ff262a3482d544a9cff592bfd
      
https://github.com/qemu/qemu/commit/d3860a57c7b8f36ff262a3482d544a9cff592bfd
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    A tests/data/acpi/q35/DSDT.noacpihp
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist new q35.noacpihp test and pc.hpbrroot

for q35.noacpihp use plain default Q35 DSDT table as a starting point.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: b0b3b99e5fbf38c29fb00fb4e17199c20b7e6266
      
https://github.com/qemu/qemu/commit/b0b3b99e5fbf38c29fb00fb4e17199c20b7e6266
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test.c

  Log Message:
  -----------
  tests: acpi: add test_acpi_q35_tcg_no_acpi_hotplug test and extend 
test_acpi_piix4_no_acpi_pci_hotplug

test bridge AML generator with ACPI PCI hotplug disabled
(i.e. with native hotplug enabled/disabled per bridge/root port)

PS:
while at make sure that devices on pci-bridge are starting
from addr=1.0 as slot 0 is not available there and test
passes only because of a bug in ACPI hotplug that will be
fixed by follow up patch

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-4-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 6bf2d446d470dfbd8ba45da27d10ade4616586b1
      
https://github.com/qemu/qemu/commit/6bf2d446d470dfbd8ba45da27d10ade4616586b1
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/data/acpi/pc/DSDT.hpbrroot
    M tests/data/acpi/q35/DSDT.noacpihp
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: update expected blobs

expected changes:
Basically adds devices present on root bus in form:
  Device (SXX)
  {
     Name (_ADR, 0xYYYYYYYY)  // _ADR: Address
  }

On top of that For q35.noacpihp, all ACPI PCI hotplug
AML is removed and _OSC get native hotplug enabled:

                       CreateDWordField (Arg3, 0x04, CDW2)
                       CreateDWordField (Arg3, 0x08, CDW3)
                       Local0 = CDW3 /* \_SB_.PCI0._OSC.CDW3 */
  -                    Local0 &= 0x1E
  +                    Local0 &= 0x1F
                       If ((Arg1 != One))
                       {
                           CDW1 |= 0x08
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-5-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 0ece4e3bc339a0dcbd0eb575b8ede2fab7844271
      
https://github.com/qemu/qemu/commit/0ece4e3bc339a0dcbd0eb575b8ede2fab7844271
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist q35/DSDT.multi-bridge before extending testcase

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-6-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 0c3bf7c4314f1512dcc6070994eeba3c6f526f41
      
https://github.com/qemu/qemu/commit/0c3bf7c4314f1512dcc6070994eeba3c6f526f41
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test.c

  Log Message:
  -----------
  tests: acpi: extend multi-bridge case with case 
'root-port,id=HOHP,hotplug=off root-port,bus=NOHP'

Following corner case wasn't covered:

  -device pcie-root-port,id=NO_HOTPLUG,hotplug=off
  -device pcie-root-port,bus=NO_HOTPLUG

when intermediate root-port has explicitly disabled hotplug,
all hierarchy below it is not described anymore (used to be
described in 7.2)

So as result we see only NO_HOTPLUG root-port described

  +            Device (S50)
  +            {
  +                Name (_ADR, 0x000A0000)  // _ADR: Address
  +            }

and no children nor notification chain for them are being composed.
Follow up patches will fix missing leaf root-port descriptor
and notification chain that should accompany it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-7-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 11215a349e39353f272256a72ed0fd4affe5fc78
      
https://github.com/qemu/qemu/commit/11215a349e39353f272256a72ed0fd4affe5fc78
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  x86: pcihp: fix missing PCNT callchain when intermediate root-port has 
'hotplug=off' set

Beside BSEL numbers change (due to 2 extra root-ports in q35/miltibridge test),
following change is expected:

       Scope (\_SB.PCI0)
       {
  ...
  +        Scope (S50)
  +        {
  +            Scope (S00)
  +            {
  +                Method (PCNT, 0, NotSerialized)
  +                {
  +                    BNUM = Zero
  +                    DVNT (PCIU, One)
  +                    DVNT (PCID, 0x03)
  +                }
  +            }
  +
  +            Method (PCNT, 0, NotSerialized)
  +            {
  +                ^S00.PCNT
  +            }
  +        }
  ...
           Method (PCNT, 0, NotSerialized)
           {
  +            ^S50.PCNT ()
               ^S13.PCNT ()
               ^S12.PCNT ()
               ^S11.PCNT ()

I practice [1] hasn't broke anything since on hardware side we unset
hotplug_handler on such intermediate port => hotplug behind it has
not been properly wired and as result not worked.

1)
Fixes: ddab4d3fae4e8 ("pcihp: compose PCNT callchain right before its user 
_GPE._E01")
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-8-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 1c103f35d19601d6ded430d4303be8d3b9ff44bd
      
https://github.com/qemu/qemu/commit/1c103f35d19601d6ded430d4303be8d3b9ff44bd
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist pc/DSDT.hpbrroot and pc/DSDT.hpbridge tests

follow up fix for missing root-port AML will affect these tests
by adding non-hotpluggable Device descriptors of colplugged
bridges when bridge hotplug is disabled.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-9-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 0e84fd3b98feb2bdbfea75b9f7ff7993b2d5300f
      
https://github.com/qemu/qemu/commit/0e84fd3b98feb2bdbfea75b9f7ff7993b2d5300f
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/acpi/pci-bridge.c

  Log Message:
  -----------
  x86: pcihp: fix missing bridge AML when intermediate root-port has 
'hotplug=off' set

(I practice [1] hasn't broke anything since on hardware side we unset
hotplug_handler on such intermediate port => hotplug behind it has
never worked)

When deciding if bridge should be described, the original
condition was

  cold_plugged_bridge && pcihp_bridge_en

which was replaced [1] by

  bridge has ACPI_PCIHP_PROP_BSEL

the later however is not the same thing as the original
and flips to false if intermediate bridge has hotplug
turned off (root-port with 'hotplug=off' option).

Since we already in build_pci_bridge_aml(), the question
if it's bridge is answered. Use DeviceState::hotplugged
to make decision if bridge should describe its slots.

What's left out is pcihp_bridge_en, which tells us if
ACPI bridge hotplug is enabled.

With hotplug and non hotplug part now being mostly
separated, omitting this check will only lead to
colplugged bridges describe occupied slots in case
when ACPI bridge hotplug is disabled.
Which makes behavior consistent with occupied slots
on hostbridge.

Ex (pc/DSDT.hpbrroot diff):
  ...
               Device (S20)
               {
                   Name (_ADR, 0x00040000)  // _ADR: Address
  +                Device (S08)
  +                {
  +                    Name (_ADR, 0x00010000)  // _ADR: Address
  +                }
  +
  +                Device (S10)
  +                {
  +                    Name (_ADR, 0x00020000)  // _ADR: Address
  +                }
               }
  ...

PS:
testing shows that above doesn't affect adversely guest OS
behavior: i.e. if ACPI bridge hotplug is enabled it's
expected behaviour, and with ACPI bridge hotplug is disabled
(a.k. native hotplug), it doesn't break slot enumeration
nor native hotplug. (tested with RHEL9.0 and WS2022).

1)
Fixes: 6c36ec46b0d ("pcihp: make bridge describe itself using 
AcpiDevAmlIfClass:build_dev_aml")
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-10-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 30216b3eaf3b5c3c36d90a5c7402a67ed6a5fcb9
      
https://github.com/qemu/qemu/commit/30216b3eaf3b5c3c36d90a5c7402a67ed6a5fcb9
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/data/acpi/pc/DSDT.hpbridge
    M tests/data/acpi/pc/DSDT.hpbrroot
    M tests/data/acpi/q35/DSDT.multi-bridge
    M tests/data/acpi/q35/DSDT.noacpihp
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: update expected blobs

BNUM numbering changes across DSDT due to addition of new bridges.

Fixed missing PCI tree brunch (q35/DSDT.multi-bridge case):

  //  -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off
  +            Device (S50)
  +            {
  +                Name (_ADR, 0x000A0000)  // _ADR: Address
  //  -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp
  +                Device (S00)
  +                {
  +                    Name (_ADR, Zero)  // _ADR: Address
  +                    Name (BSEL, Zero)
  +                    Device (S00)
  +                    {
  +                        Name (_ADR, Zero)  // _ADR: Address
  +                        Name (ASUN, Zero)
  +                        Method (_DSM, 4, Serialized)  // _DSM: 
Device-Specific Method
  +                        {
  +                            Local0 = Package (0x02)
  +                                {
  +                                    BSEL,
  +                                    ASUN
  +                                }
  +                            Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
  +                        }
  +
  +                        Name (_SUN, Zero)  // _SUN: Slot User Number
  +                        Method (_EJ0, 1, NotSerialized)  // _EJx: Eject 
Device
  +                        {
  +                            PCEJ (BSEL, _SUN)
  +                        }
  +                    }
  +
  +                    Method (DVNT, 2, NotSerialized)
  +                    {
  +                        If ((Arg0 & One))
  +                        {
  +                            Notify (S00, Arg1)
  +                        }
  +                    }
  +                }
  +            }

Fixed hotplug notification for leaf root port (hotplug=on) attached to
intermediate root port (hotplug=off) (q35/DSDT.multi-bridge case)

  //  -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off
  +        Scope (S50)
  +        {
  //  -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp
  +            Scope (S00)
  +            {
  +                Method (PCNT, 0, NotSerialized)
  +                {
  +                    BNUM = Zero
  +                    DVNT (PCIU, One)
  +                    DVNT (PCID, 0x03)
  +                }
  +            }
  +
  +            Method (PCNT, 0, NotSerialized)
  +            {
  +                ^S00.PCNT ()
  +            }
  +        }
  ...
           Method (PCNT, 0, NotSerialized)
           {
  +            ^S50.PCNT ()
               ^S13.PCNT ()

Populated slots being described on coldplugged bridges even if
ACPI bridge hotplug is disabled.
(pc/DSDT.hpbridge and pc/DSDT.hpbrroot)
  ...
               Device (S18)
               {
                   Name (_ADR, 0x00030000)  // _ADR: Address
  +                Device (S08)
  +                {
  +                    Name (_ADR, 0x00010000)  // _ADR: Address
  +                }
  +
  +                Device (S10)
  +                {
  +                    Name (_ADR, 0x00020000)  // _ADR: Address
  +                }
               }
  ...
               Device (S18)
               {
                   Name (_ADR, 0x00030000)  // _ADR: Address
  +                Device (S00)
  +                {
  +                    Name (_ADR, Zero)  // _ADR: Address
  +                }
               }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-11-imammedo@redhat.com>


  Commit: f40e6a4cc10cdb7901c172edaf34eaab7fe212b2
      
https://github.com/qemu/qemu/commit/f40e6a4cc10cdb7901c172edaf34eaab7fe212b2
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/acpi/piix4.c

  Log Message:
  -----------
  pcihp: piix4: do not redirect hotplug controller to piix4 when ACPI hotplug 
is disabled

commit [1] added ability to disable ACPI PCI hotplug
on hostbridge but forgot to take into account that it
should disable all ACPI hotplug machinery in case both
hostbridge and bridge hotplug are disabled.

Commit [2] tried to fix that, however it forgot to
remove hotplug_handler override which hands hotplug
control over to piix4 hotplug controller
(uninitialized after [2]).

As result at the time bridge is plugged in, its default
(SHPC) hotplug handler is replaced by piix4 one in
  acpi_pcihp_device_plug_cb()
    ...
    if (!s->legacy_piix &&
       ...
       qbus_set_hotplug_handler(BUS(sec), OBJECT(hotplug_dev));

which is acting on uninitialized s->legacy_piix value
(0 by default) that was supposed to be initialized by
acpi_pcihp_init(), that is no longer called due to
following condition being false:

  piix4_acpi_system_hot_add_init()
    if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) {

and the bridge ends up with piix4 as hotplug handler
instead of shpc one.

Followup hotplug on that bridge as result yields
piix4 specific error:

  Error: Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set

1) 3d7e78aa777 (Introduce a new flag for i440fx to disable PCI hotplug on the 
root bus)
2) df4008c9c59 (piix4: don't reserve hw resources when hotplug is off globally)

Fixes: df4008c9c59 (piix4: don't reserve hw resources when hotplug is off 
globally)
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-12-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: ceefa0b74674f32aeedb1e93bcb6ec9cb12842b1
      
https://github.com/qemu/qemu/commit/ceefa0b74674f32aeedb1e93bcb6ec9cb12842b1
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/pci/pcie_port.c
    M include/hw/hotplug.h
    M include/hw/qdev-core.h

  Log Message:
  -----------
  pci: fix 'hotplugglable' property behavior

Currently the property may flip its state
during VM bring up or just doesn't work as
the name implies.

In particular with PCIE root port that has
'hotplug={on|off}' property, and when it's
turned off, one would expect
  'hotpluggable' == false
for any devices attached to it.
Which is not the case since qbus_is_hotpluggable()
used by the property just checks for presence
of any hotplug_handler set on bus.

The problem is that name BusState::hotplug_handler
from its inception is misnomer, as it handles
not only hotplug but also in many cases coldplug
as well (i.e. generic wiring interface), and
it's fine to have hotplug_handler set on bus
while it doesn't support hotplug (ex. pcie-slot
with hotplug=off).

Another case of root port flipping 'hotpluggable'
state when ACPI PCI hotplug is enabled in this
case root port with 'hotplug=off' starts as
hotpluggable and then later on, pcihp
hotplug_handler clears hotplug_handler
explicitly after checking root port's 'hotplug'
property.

So root-port hotpluggablity check sort of works
if pcihp is enabled but is broken if pcihp is
disabled.

One way to deal with the issue is to ask
hotplug_handler if bus it controls is hotpluggable
or not. To do that add is_hotpluggable_bus()
hook to HotplugHandler interface and use it in
'hotpluggable' property + teach pcie-slot to
actually look into 'hotplug' property state
before deciding if bus is hotpluggable.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-13-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: bd95cd5323293091d2edb168a8571f06aae40a4a
      
https://github.com/qemu/qemu/commit/bd95cd5323293091d2edb168a8571f06aae40a4a
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist DSDT blobs before isolating PCI _DSM func 0 prolog

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-14-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 0a4584fca3b255fb75437d8b95491533512ed515
      
https://github.com/qemu/qemu/commit/0a4584fca3b255fb75437d8b95491533512ed515
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  pcihp: move PCI _DSM function 0 prolog into separate function

it will be reused by follow up patches that will implement
static _DSM for non-hotpluggable devices.

no functional AML change, only context one, where 'cap' (Local1)
initialization is moved after UUID/revision checks.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-15-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: e9ea452237c27417cc8d2d8515a5fb5a70a1a6ff
      
https://github.com/qemu/qemu/commit/e9ea452237c27417cc8d2d8515a5fb5a70a1a6ff
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/data/acpi/pc/DSDT
    M tests/data/acpi/pc/DSDT.acpierst
    M tests/data/acpi/pc/DSDT.acpihmat
    M tests/data/acpi/pc/DSDT.bridge
    M tests/data/acpi/pc/DSDT.cphp
    M tests/data/acpi/pc/DSDT.dimmpxm
    M tests/data/acpi/pc/DSDT.hpbridge
    M tests/data/acpi/pc/DSDT.ipmikcs
    M tests/data/acpi/pc/DSDT.memhp
    M tests/data/acpi/pc/DSDT.nohpet
    M tests/data/acpi/pc/DSDT.numamem
    M tests/data/acpi/pc/DSDT.roothp
    M tests/data/acpi/q35/DSDT
    M tests/data/acpi/q35/DSDT.acpierst
    M tests/data/acpi/q35/DSDT.acpihmat
    M tests/data/acpi/q35/DSDT.acpihmat-noinitiator
    M tests/data/acpi/q35/DSDT.applesmc
    M tests/data/acpi/q35/DSDT.bridge
    M tests/data/acpi/q35/DSDT.core-count2
    M tests/data/acpi/q35/DSDT.cphp
    M tests/data/acpi/q35/DSDT.cxl
    M tests/data/acpi/q35/DSDT.dimmpxm
    M tests/data/acpi/q35/DSDT.ipmibt
    M tests/data/acpi/q35/DSDT.ipmismbus
    M tests/data/acpi/q35/DSDT.ivrs
    M tests/data/acpi/q35/DSDT.memhp
    M tests/data/acpi/q35/DSDT.mmio64
    M tests/data/acpi/q35/DSDT.multi-bridge
    M tests/data/acpi/q35/DSDT.nohpet
    M tests/data/acpi/q35/DSDT.numamem
    M tests/data/acpi/q35/DSDT.pvpanic-isa
    M tests/data/acpi/q35/DSDT.tis.tpm12
    M tests/data/acpi/q35/DSDT.tis.tpm2
    M tests/data/acpi/q35/DSDT.viot
    M tests/data/acpi/q35/DSDT.xapic
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: update expected blobs

only following context change:
 -  Local1 = Zero
    If ((Arg0 != ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d") /* Device 
Labeling Interface */))
    {
        Return (Local0)
 ...
        Return (Local0)
    }

 +  Local1 = Zero
    Local2 = AIDX (DerefOf (Arg4 [Zero]), DerefOf (Arg4 [One]

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-16-imammedo@redhat.com>


  Commit: d6cfe1d834ec219df6b0034112a33f0dd202d2ec
      
https://github.com/qemu/qemu/commit/d6cfe1d834ec219df6b0034112a33f0dd202d2ec
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist DSDT before adding EDSM method

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-17-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: fe0d5f5319bbf4c7c772bb6579cdb17496dcb946
      
https://github.com/qemu/qemu/commit/fe0d5f5319bbf4c7c772bb6579cdb17496dcb946
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  acpi: pci: add EDSM method to DSDT

it's a helper method for acpi-index support on PCI buses
that do no support or have disabled ACPI PCI hotplug
or for non-hotpluggble endpoint devices.
(like non-hotpluggble NICs, integrated endpoints and
later for machines that do not support ACPI PCI hotplug)

no functional change, commit adds only EDSM method in DSDT
without any users. (the follow up patches will use it)

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-18-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: bda649537c385ab8aa33c1b8eb9caf4ccf734680
      
https://github.com/qemu/qemu/commit/bda649537c385ab8aa33c1b8eb9caf4ccf734680
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/data/acpi/pc/DSDT
    M tests/data/acpi/pc/DSDT.acpierst
    M tests/data/acpi/pc/DSDT.acpihmat
    M tests/data/acpi/pc/DSDT.bridge
    M tests/data/acpi/pc/DSDT.cphp
    M tests/data/acpi/pc/DSDT.dimmpxm
    M tests/data/acpi/pc/DSDT.hpbridge
    M tests/data/acpi/pc/DSDT.hpbrroot
    M tests/data/acpi/pc/DSDT.ipmikcs
    M tests/data/acpi/pc/DSDT.memhp
    M tests/data/acpi/pc/DSDT.nohpet
    M tests/data/acpi/pc/DSDT.numamem
    M tests/data/acpi/pc/DSDT.roothp
    M tests/data/acpi/q35/DSDT
    M tests/data/acpi/q35/DSDT.acpierst
    M tests/data/acpi/q35/DSDT.acpihmat
    M tests/data/acpi/q35/DSDT.acpihmat-noinitiator
    M tests/data/acpi/q35/DSDT.applesmc
    M tests/data/acpi/q35/DSDT.bridge
    M tests/data/acpi/q35/DSDT.core-count2
    M tests/data/acpi/q35/DSDT.cphp
    M tests/data/acpi/q35/DSDT.cxl
    M tests/data/acpi/q35/DSDT.dimmpxm
    M tests/data/acpi/q35/DSDT.ipmibt
    M tests/data/acpi/q35/DSDT.ipmismbus
    M tests/data/acpi/q35/DSDT.ivrs
    M tests/data/acpi/q35/DSDT.memhp
    M tests/data/acpi/q35/DSDT.mmio64
    M tests/data/acpi/q35/DSDT.multi-bridge
    M tests/data/acpi/q35/DSDT.noacpihp
    M tests/data/acpi/q35/DSDT.nohpet
    M tests/data/acpi/q35/DSDT.numamem
    M tests/data/acpi/q35/DSDT.pvpanic-isa
    M tests/data/acpi/q35/DSDT.tis.tpm12
    M tests/data/acpi/q35/DSDT.tis.tpm2
    M tests/data/acpi/q35/DSDT.viot
    M tests/data/acpi/q35/DSDT.xapic
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: update expected blobs

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-19-imammedo@redhat.com>


  Commit: 52ad9eb2372245ba5829742fc176f3c8af36f592
      
https://github.com/qemu/qemu/commit/52ad9eb2372245ba5829742fc176f3c8af36f592
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist DSDT before adding device with acpi-index to testcases

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-20-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 22c8dd000fe4e7ce74531c22a427af58c4042d9a
      
https://github.com/qemu/qemu/commit/22c8dd000fe4e7ce74531c22a427af58c4042d9a
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test.c

  Log Message:
  -----------
  tests: acpi: add device with acpi-index on non-hotpluggble bus

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-21-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 7fb1d7388b10f5d0738aee94110344ce4132fafe
      
https://github.com/qemu/qemu/commit/7fb1d7388b10f5d0738aee94110344ce4132fafe
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  acpi: pci: support acpi-index for non-hotpluggable devices

Inject static _DSM (EDSM) if non-hotpluggable device has
acpi-index configured on it.
It lets use acpi-index non-hotpluggable devices / devices
attached to non-hotpluggable bus.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-22-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: f8e49d067f86c8d04bbb1a6cfed55e6390e3f47b
      
https://github.com/qemu/qemu/commit/f8e49d067f86c8d04bbb1a6cfed55e6390e3f47b
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/data/acpi/pc/DSDT.hpbrroot
    M tests/data/acpi/q35/DSDT.multi-bridge
    M tests/data/acpi/q35/DSDT.noacpihp
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: update expected blobs

the only chenge is addition of _DSM- > EDSM method
on non-hotpluggable devices with configured acpi-index.
Something like:

  +                Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
  +                {
  +                    Local0 = Package (0x01)
  +                        {
  +                            0x65
  +                        }
  +                    Return (EDSM (Arg0, Arg1, Arg2, Arg3, Local0))
  +                }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-23-imammedo@redhat.com>


  Commit: a0facf38de479fc2d40d51dc4ad08ed5d160d21e
      
https://github.com/qemu/qemu/commit/a0facf38de479fc2d40d51dc4ad08ed5d160d21e
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist DSDT before exposing non zero functions

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-24-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 05a49b9c2fbe79661ac185aa4389ab250e2d689a
      
https://github.com/qemu/qemu/commit/05a49b9c2fbe79661ac185aa4389ab250e2d689a
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  acpi: pci: describe all functions on populated slots

describing all present devices on functions other than
0 was complicated when non hotplug and hotplug code
was intermixed. So QEMU has been excluding non zero
functions since they are not supported by hotplug code,
then a condition to whitelist coldplugged bridges was
added and later whitelisting of devices that advertise
presence of their own AML description.

With non hotplug and hotplug code separated, it is
possible to relax rules and allow describing all
non-hotpluggble functions and hence simplify
conditions whether PCI device should be enumerated by
generic (non-hotplug) code.

Price of that simplification is an extra few Device()
descriptors in DSDT exposing built-in chipset functions,
which has no functional effect on guest side.

Apart from that, the enumeration of non zero functions,
allows to attach more NICs with acpi-index enabled
directly on hostbridge (if hotplug is not required).

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-25-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 05041d20d7fd264c71b63de5aa176da156805be8
      
https://github.com/qemu/qemu/commit/05041d20d7fd264c71b63de5aa176da156805be8
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/data/acpi/pc/DSDT
    M tests/data/acpi/pc/DSDT.acpierst
    M tests/data/acpi/pc/DSDT.acpihmat
    M tests/data/acpi/pc/DSDT.bridge
    M tests/data/acpi/pc/DSDT.cphp
    M tests/data/acpi/pc/DSDT.dimmpxm
    M tests/data/acpi/pc/DSDT.hpbridge
    M tests/data/acpi/pc/DSDT.hpbrroot
    M tests/data/acpi/pc/DSDT.ipmikcs
    M tests/data/acpi/pc/DSDT.memhp
    M tests/data/acpi/pc/DSDT.nohpet
    M tests/data/acpi/pc/DSDT.numamem
    M tests/data/acpi/pc/DSDT.roothp
    M tests/data/acpi/q35/DSDT
    M tests/data/acpi/q35/DSDT.acpierst
    M tests/data/acpi/q35/DSDT.acpihmat
    M tests/data/acpi/q35/DSDT.acpihmat-noinitiator
    M tests/data/acpi/q35/DSDT.applesmc
    M tests/data/acpi/q35/DSDT.bridge
    M tests/data/acpi/q35/DSDT.core-count2
    M tests/data/acpi/q35/DSDT.cphp
    M tests/data/acpi/q35/DSDT.cxl
    M tests/data/acpi/q35/DSDT.dimmpxm
    M tests/data/acpi/q35/DSDT.ipmibt
    M tests/data/acpi/q35/DSDT.ipmismbus
    M tests/data/acpi/q35/DSDT.ivrs
    M tests/data/acpi/q35/DSDT.memhp
    M tests/data/acpi/q35/DSDT.mmio64
    M tests/data/acpi/q35/DSDT.multi-bridge
    M tests/data/acpi/q35/DSDT.noacpihp
    M tests/data/acpi/q35/DSDT.nohpet
    M tests/data/acpi/q35/DSDT.numamem
    M tests/data/acpi/q35/DSDT.pvpanic-isa
    M tests/data/acpi/q35/DSDT.tis.tpm12
    M tests/data/acpi/q35/DSDT.tis.tpm2
    M tests/data/acpi/q35/DSDT.viot
    M tests/data/acpi/q35/DSDT.xapic
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: update expected blobs

in PC machine case piix3-ide and PIIX4_PM get exposed

  +            Device (S09)
  +            {
  +                Name (_ADR, 0x00010001)  // _ADR: Address
  +            }
  +
  +            Device (S0B)
  +            {
  +                Name (_ADR, 0x00010003)  // _ADR: Address
  +            }

in q35 machine case ich9-ahci gets exposed
  +            Device (SFA)
  +            {
  +                Name (_ADR, 0x001F0002)  // _ADR: Address
  +            }

and addtional pci-testdev, virtio-balloon exposed in q35 multi-bridge test case
  +            Device (S14)
  +            {
  +                Name (_ADR, 0x00020004)  // _ADR: Address
  +            }
  +
  ...
  +            Device (S22)
  +            {
  +                Name (_ADR, 0x00040002)  // _ADR: Address
  +            }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-26-imammedo@redhat.com>


  Commit: a0cc02e7b6b42a64dbb4ad7285bf4568e0a1b8b8
      
https://github.com/qemu/qemu/commit/a0cc02e7b6b42a64dbb4ad7285bf4568e0a1b8b8
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: whitelist DSDT before adding non-0 function device with 
acpi-index to testcases

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-27-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: bf5fde7964e616d3ccfd7d9cb19521e1af11a9a0
      
https://github.com/qemu/qemu/commit/bf5fde7964e616d3ccfd7d9cb19521e1af11a9a0
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/qtest/bios-tables-test.c

  Log Message:
  -----------
  tests: acpi: add non zero function device with acpi-index on non-hotpluggble 
bus

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-28-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 0a7044eb643d035e6c235ca94760a1e61d165cd6
      
https://github.com/qemu/qemu/commit/0a7044eb643d035e6c235ca94760a1e61d165cd6
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M tests/data/acpi/q35/DSDT.multi-bridge
    M tests/data/acpi/q35/DSDT.noacpihp
    M tests/qtest/bios-tables-test-allowed-diff.h

  Log Message:
  -----------
  tests: acpi: update expected blobs

an extra devices at non-zero function address with static
_DSM method get exposed, ex:

  +            Device (S15)
  +            {
  +                Name (_ADR, 0x00020005)  // _ADR: Address
  +                Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
  +                {
  +                    Local0 = Package (0x01)
  +                        {
  +                            0x66
  +                        }
  +                    Return (EDSM (Arg0, Arg1, Arg2, Arg3, Local0))
  +                }
  +            }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-29-imammedo@redhat.com>


  Commit: 041b1c40f38a63baff7c375d1e3df6f365aa5882
      
https://github.com/qemu/qemu/commit/041b1c40f38a63baff7c375d1e3df6f365aa5882
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/acpi/pcihp.c
    M hw/pci/pci.c

  Log Message:
  -----------
  pci: move acpi-index uniqueness check to generic PCI device code

acpi-index is now working with non-hotpluggable buses
(pci/q35 machine hostbridge), it can be used even if
ACPI PCI hotplug is disabled and as result acpi-index
uniqueness check will be omitted (since the check is
done by ACPI PCI hotplug handler, which isn't wired
when ACPI PCI hotplug is disabled).
Move check and related code to generic PCIDevice so it
would be independent of ACPI PCI hotplug.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-30-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 419233b2b417eec65211b4a5160d94978546467b
      
https://github.com/qemu/qemu/commit/419233b2b417eec65211b4a5160d94978546467b
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  acpi: pci: drop BSEL usage when deciding that device isn't hotpluggable

previous commit ("pci: fix 'hotplugglable' property behavior") fixed
pcie root port's 'hotpluggable' property to behave consistently.

So we don't need a BSEL crutch anymore to see of device is not
hotpluggable, drop it from 'generic' PCI slots description handling.

BSEL is still used to decide if hotplug part should be called
but that will be moved out of generic code to hotplug one by
followup patches.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-31-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 62dd55fcf736994958eb5706cee5806480acfe25
      
https://github.com/qemu/qemu/commit/62dd55fcf736994958eb5706cee5806480acfe25
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  acpi: pci: move BSEL into build_append_pcihp_slots()

Generic PCI enumeration code doesn't really need access to
BSEL value, it is only used as means to decide if hotplug
enumerator should be called.

Use stateless object_property_find() to do that, and move
the rest of BSEL handling into build_append_pcihp_slots()
where it belongs.

This cleans up generic code a bit from hotplug stuff
and follow up patch will remove remaining call to
build_append_pcihp_slots() from generic code, making
it possible to use without ACPI PCI hotplug dependencies.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-32-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 02c106139a5c01a5668246c748939b5a4bb0c467
      
https://github.com/qemu/qemu/commit/02c106139a5c01a5668246c748939b5a4bb0c467
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/acpi/pci-bridge.c
    M hw/i386/acpi-build.c
    M include/hw/acpi/pcihp.h

  Log Message:
  -----------
  acpi: pci: move out ACPI PCI hotplug generator from generic slot generator 
build_append_pci_bus_devices()

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-33-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 6536e427ce490d1d57e9d4369f1765f9f1a85310
      
https://github.com/qemu/qemu/commit/6536e427ce490d1d57e9d4369f1765f9f1a85310
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/acpi/acpi-pci-hotplug-stub.c
    M hw/acpi/ich9.c
    M hw/acpi/pcihp.c
    M hw/acpi/piix4.c
    M include/hw/acpi/pcihp.h
    M include/hw/acpi/piix4.h

  Log Message:
  -----------
  pcihp: move fields enabling hotplug into AcpiPciHpState

... instead of duplicating them in piix4 and lpc and then
trying to pass them to pcihp routines as arguments.
it simplifies call sites and places pcihp specific in
its own structure.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-34-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: f18e29fc90cf271bae0c671151d0f55bd7649d52
      
https://github.com/qemu/qemu/commit/f18e29fc90cf271bae0c671151d0f55bd7649d52
  Author: Igor Mammedov <imammedo@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/acpi/acpi-pci-hotplug-stub.c
    M hw/acpi/ich9.c
    M hw/acpi/pcihp.c
    M hw/acpi/piix4.c
    M hw/isa/lpc_ich9.c
    M include/hw/acpi/ich9.h
    M include/hw/acpi/pcihp.h

  Log Message:
  -----------
  pcihp: add ACPI PCI hotplug specific is_hotpluggable_bus() callback

Provide pcihp specific callback to check if bus is hotpluggable
and consolidate its scattered hotplug criteria there.
While at it clean up no longer needed
   qbus_set_hotplug_handler(BUS(bus), NULL)
workarounds since callback makes qbus_is_hotpluggable() return
correct answer even if hotplug_handler is set on bus.

PS:
see ("pci: fix 'hotplugglable' property behavior") for details
why callback was introduced.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-35-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 010746ae1db7f52700cb2e2c46eb94f299cfa0d2
      
https://github.com/qemu/qemu/commit/010746ae1db7f52700cb2e2c46eb94f299cfa0d2
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/pci/pcie_aer.c
    M include/hw/pci/pcie_regs.h

  Log Message:
  -----------
  hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register

This register in AER should be both writeable and should
have a default value with a couple of the errors masked
including the Uncorrectable Internal Error used by CXL for
it's error reporting.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Message-Id: <20230302133709.30373-2-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>


  Commit: 9a6ef182c03eaa138bae553f0fbb5a123bef9a53
      
https://github.com/qemu/qemu/commit/9a6ef182c03eaa138bae553f0fbb5a123bef9a53
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/pci/pcie_aer.c

  Log Message:
  -----------
  hw/pci/aer: Add missing routing for AER errors

PCIe r6.0 Figure 6-3 "Pseudo Logic Diagram for Selected Error Message Control
and Status Bits" includes a right hand branch under "All PCI Express devices"
that allows for messages to be generated or sent onwards without SERR#
being set as long as the appropriate per error class bit in the PCIe
Device Control Register is set.

Implement that branch thus enabling routing of ERR_COR, ERR_NONFATAL
and ERR_FATAL under OSes that set these bits appropriately (e.g. Linux)

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Message-Id: <20230302133709.30373-3-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>


  Commit: 47f0e7ab3272737c174ca68c03843e0d1996dc22
      
https://github.com/qemu/qemu/commit/47f0e7ab3272737c174ca68c03843e0d1996dc22
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/pci-bridge/cxl_root_port.c

  Log Message:
  -----------
  hw/pci-bridge/cxl_root_port: Wire up AER

We are missing necessary config write handling for AER emulation in
the CXL root port. Add it based on pcie_root_port.c

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Message-Id: <20230302133709.30373-4-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>


  Commit: 7e33517fdd25ce2dc95b22b8afd743a979d8dfb4
      
https://github.com/qemu/qemu/commit/7e33517fdd25ce2dc95b22b8afd743a979d8dfb4
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/pci-bridge/cxl_root_port.c

  Log Message:
  -----------
  hw/pci-bridge/cxl_root_port: Wire up MSI

Done to avoid fixing ACPI route description of traditional PCI interrupts on q35
and because we should probably move with the times anyway.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Message-Id: <20230302133709.30373-5-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>


  Commit: 6be947bdfcaca6e87ee93a76b2ab2c5536b3b8a6
      
https://github.com/qemu/qemu/commit/6be947bdfcaca6e87ee93a76b2ab2c5536b3b8a6
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/mem/cxl_type3.c

  Log Message:
  -----------
  hw/mem/cxl-type3: Add AER extended capability

This enables AER error injection to function as expected.
It is intended as a building block in enabling CXL RAS error injection
in the following patches.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Message-Id: <20230302133709.30373-6-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>


  Commit: cb4e642cfa1e6db59448978ba4c00c6f1c4fb8bd
      
https://github.com/qemu/qemu/commit/cb4e642cfa1e6db59448978ba4c00c6f1c4fb8bd
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/cxl/cxl-component-utils.c

  Log Message:
  -----------
  hw/cxl: Fix endian issues in CXL RAS capability defaults / masks

As these are about to be modified, fix the endian handle for
this set of registers rather than making it worse.

Note that CXL is currently only supported in QEMU on
x86 (arm64 patches out of tree) so we aren't going to yet hit
an problems with big endian. However it is good to avoid making
things worse for that support in the future.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20230302133709.30373-7-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>


  Commit: 4a295211f7d76d092bf0abcbee6891e8f053f6b8
      
https://github.com/qemu/qemu/commit/4a295211f7d76d092bf0abcbee6891e8f053f6b8
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/pci/pci-internal.h
    M include/hw/pci/pcie_aer.h

  Log Message:
  -----------
  hw/pci/aer: Make PCIE AER error injection facility available for other 
emulation to use.

This infrastructure will be reused for CXL RAS error injection
in patches that follow.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20230302133709.30373-8-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>


  Commit: 415442a1b4ad31521bbe7ae8bf4ee5d25af3977f
      
https://github.com/qemu/qemu/commit/415442a1b4ad31521bbe7ae8bf4ee5d25af3977f
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/cxl/cxl-component-utils.c
    M hw/mem/cxl_type3.c
    A hw/mem/cxl_type3_stubs.c
    M hw/mem/meson.build
    M include/hw/cxl/cxl_component.h
    M include/hw/cxl/cxl_device.h
    A qapi/cxl.json
    M qapi/meson.build
    M qapi/qapi-schema.json

  Log Message:
  -----------
  hw/mem/cxl_type3: Add CXL RAS Error Injection Support.

CXL uses PCI AER Internal errors to signal to the host that an error has
occurred. The host can then read more detailed status from the CXL RAS
capability.

For uncorrectable errors: support multiple injection in one operation
as this is needed to reliably test multiple header logging support in an
OS. The equivalent feature doesn't exist for correctable errors, so only
one error need be injected at a time.

Note:
 - Header content needs to be manually specified in a fashion that
   matches the specification for what can be in the header for each
   error type.

Injection via QMP:
{ "execute": "qmp_capabilities" }
...
{ "execute": "cxl-inject-uncorrectable-errors",
  "arguments": {
    "path": "/machine/peripheral/cxl-pmem0",
    "errors": [
        {
            "type": "cache-address-parity",
            "header": [ 3, 4]
        },
        {
            "type": "cache-data-parity",
            "header": 
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]
        },
        {
            "type": "internal",
            "header": [ 1, 2, 4]
        }
        ]
  }}
...
{ "execute": "cxl-inject-correctable-error",
    "arguments": {
        "path": "/machine/peripheral/cxl-pmem0",
        "type": "physical"
    } }

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20230302133709.30373-9-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 84344ee2da1f8a23819c15361298d997d9e69dbf
      
https://github.com/qemu/qemu/commit/84344ee2da1f8a23819c15361298d997d9e69dbf
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/pci/pcie_port.c
    M include/hw/pci/pcie_port.h

  Log Message:
  -----------
  hw/pci: Add pcie_count_ds_port() and pcie_find_port_first() helpers

These two helpers enable host bridges to operate differently depending on
the number of downstream ports, in particular if there is only a single
port.

Useful for CXL where HDM address decoders are allowed to be implicit in
the host bridge if there is only a single root port.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20230227153128.8164-2-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 154070eaf6597c47f64c3ea917bcba62427ae61f
      
https://github.com/qemu/qemu/commit/154070eaf6597c47f64c3ea917bcba62427ae61f
  Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/cxl/cxl-host.c
    M hw/pci-bridge/pci_expander_bridge.c
    M include/hw/cxl/cxl.h
    M include/hw/cxl/cxl_component.h
    M include/hw/pci/pci_bridge.h

  Log Message:
  -----------
  hw/pxb-cxl: Support passthrough HDM Decoders unless overridden

The CXL r3.0 specification allows for there to be no HDM decoders on CXL
Host Bridges if they have only a single root port. Instead, all accesses
directed to the host bridge (as specified in CXL Fixed Memory Windows)
are assumed to be routed to the single root port.

Linux currently assumes this implementation choice. So to simplify testing,
make QEMU emulation also default to no HDM decoders under these particular
circumstances, but provide a hdm_for_passthrough boolean option to have
HDM decoders as previously.

Technically this is breaking backwards compatibility, but given the only
known software stack used with the QEMU emulation is the Linux kernel
and this configuration did not work before this change, there are
unlikely to be any complaints that it now works. The option is retained
to allow testing of software that does allow for these HDM decoders to exist,
once someone writes it.

Reported-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Tested-by: Fan Ni <fan.ni@samsung.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

--
v2: Pick up and fix typo in tag from Fan Ni
Message-Id: <20230227153128.8164-3-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 90e31232cf8fa7f257263dd431ea954a1ae54bff
      
https://github.com/qemu/qemu/commit/90e31232cf8fa7f257263dd431ea954a1ae54bff
  Author: Albert Esteve <aesteve@redhat.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/vhost-user.c

  Log Message:
  -----------
  hw/virtio/vhost-user: avoid using unitialized errp

During protocol negotiation, when we the QEMU
stub does not support a backend with F_CONFIG,
it throws a warning and supresses the
VHOST_USER_PROTOCOL_F_CONFIG bit.

However, the warning uses warn_reportf_err macro
and passes an unitialized errp pointer. However,
the macro tries to edit the 'msg' member of the
unitialized Error and segfaults.

Instead, just use warn_report, which prints a
warning message directly to the output.

Fixes: 5653493 ("hw/virtio/vhost-user: don't suppress F_CONFIG when supported")
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Message-Id: <20230302121719.9390-1-aesteve@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: bbc1c327d7974261c61566cdb950cc5fa0196b41
      
https://github.com/qemu/qemu/commit/bbc1c327d7974261c61566cdb950cc5fa0196b41
  Author: Carlos López <clopez@suse.de>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M hw/virtio/virtio.c

  Log Message:
  -----------
  virtio: fix reachable assertion due to stale value of cached region size

In virtqueue_{split,packed}_get_avail_bytes() descriptors are read
in a loop via MemoryRegionCache regions and calls to
vring_{split,packed}_desc_read() - these take a region cache and the
index of the descriptor to be read.

For direct descriptors we use a cache provided by the caller, whose
size matches that of the virtqueue vring. We limit the number of
descriptors we can read by the size of that vring:

    max = vq->vring.num;
    ...
    MemoryRegionCache *desc_cache = &caches->desc;

For indirect descriptors, we initialize a new cache and limit the
number of descriptors by the size of the intermediate descriptor:

    len = address_space_cache_init(&indirect_desc_cache,
                                   vdev->dma_as,
                                   desc.addr, desc.len, false);
    desc_cache = &indirect_desc_cache;
    ...
    max = desc.len / sizeof(VRingDesc);

However, the first initialization of `max` is done outside the loop
where we process guest descriptors, while the second one is done
inside. This means that a sequence of an indirect descriptor followed
by a direct one will leave a stale value in `max`. If the second
descriptor's `next` field is smaller than the stale value, but
greater than the size of the virtqueue ring (and thus the cached
region), a failed assertion will be triggered in
address_space_read_cached() down the call chain.

Fix this by initializing `max` inside the loop in both functions.

Fixes: 9796d0ac8fb0 ("virtio: use address_space_map/unmap to access 
descriptors")
Signed-off-by: Carlos López <clopez@suse.de>
Message-Id: <20230302100358.3613-1-clopez@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 674acdd17808052519aafcbee1583ad89b66181a
      
https://github.com/qemu/qemu/commit/674acdd17808052519aafcbee1583ad89b66181a
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2023-03-10 (Fri, 10 Mar 2023)

  Changed paths:
    M MAINTAINERS
    M backends/cryptodev-builtin.c
    A backends/cryptodev-hmp-cmds.c
    M backends/cryptodev-lkcf.c
    M backends/cryptodev-vhost-user.c
    M backends/cryptodev-vhost.c
    M backends/cryptodev.c
    M backends/meson.build
    M hmp-commands-info.hx
    M hw/acpi/acpi-pci-hotplug-stub.c
    M hw/acpi/ich9.c
    M hw/acpi/pci-bridge.c
    M hw/acpi/pcihp.c
    M hw/acpi/piix4.c
    M hw/cxl/cxl-component-utils.c
    M hw/cxl/cxl-host.c
    M hw/i386/acpi-build.c
    M hw/isa/lpc_ich9.c
    M hw/mem/cxl_type3.c
    A hw/mem/cxl_type3_stubs.c
    M hw/mem/meson.build
    M hw/pci-bridge/cxl_root_port.c
    M hw/pci-bridge/pci_expander_bridge.c
    M hw/pci/pci-internal.h
    M hw/pci/pci.c
    M hw/pci/pcie_aer.c
    M hw/pci/pcie_port.c
    M hw/virtio/trace-events
    M hw/virtio/vhost-shadow-virtqueue.c
    M hw/virtio/vhost-user.c
    M hw/virtio/vhost-vdpa.c
    M hw/virtio/vhost.c
    M hw/virtio/virtio-crypto.c
    M hw/virtio/virtio.c
    M include/hw/acpi/ich9.h
    M include/hw/acpi/pcihp.h
    M include/hw/acpi/piix4.h
    M include/hw/cxl/cxl.h
    M include/hw/cxl/cxl_component.h
    M include/hw/cxl/cxl_device.h
    M include/hw/hotplug.h
    M include/hw/pci/pci_bridge.h
    M include/hw/pci/pcie_aer.h
    M include/hw/pci/pcie_port.h
    M include/hw/pci/pcie_regs.h
    M include/hw/qdev-core.h
    M include/hw/virtio/vhost-backend.h
    M include/hw/virtio/vhost-vdpa.h
    M include/monitor/hmp.h
    M include/sysemu/cryptodev.h
    M net/vhost-vdpa.c
    A qapi/cryptodev.json
    A qapi/cxl.json
    M qapi/meson.build
    M qapi/qapi-schema.json
    M qapi/qom.json
    M qapi/stats.json
    M stats/stats-hmp-cmds.c
    M stats/stats-qmp-cmds.c
    M tests/data/acpi/pc/DSDT
    M tests/data/acpi/pc/DSDT.acpierst
    M tests/data/acpi/pc/DSDT.acpihmat
    M tests/data/acpi/pc/DSDT.bridge
    M tests/data/acpi/pc/DSDT.cphp
    M tests/data/acpi/pc/DSDT.dimmpxm
    M tests/data/acpi/pc/DSDT.hpbridge
    M tests/data/acpi/pc/DSDT.hpbrroot
    M tests/data/acpi/pc/DSDT.ipmikcs
    M tests/data/acpi/pc/DSDT.memhp
    M tests/data/acpi/pc/DSDT.nohpet
    M tests/data/acpi/pc/DSDT.numamem
    M tests/data/acpi/pc/DSDT.roothp
    M tests/data/acpi/q35/DSDT
    M tests/data/acpi/q35/DSDT.acpierst
    M tests/data/acpi/q35/DSDT.acpihmat
    M tests/data/acpi/q35/DSDT.acpihmat-noinitiator
    M tests/data/acpi/q35/DSDT.applesmc
    M tests/data/acpi/q35/DSDT.bridge
    M tests/data/acpi/q35/DSDT.core-count2
    M tests/data/acpi/q35/DSDT.cphp
    M tests/data/acpi/q35/DSDT.cxl
    M tests/data/acpi/q35/DSDT.dimmpxm
    M tests/data/acpi/q35/DSDT.ipmibt
    M tests/data/acpi/q35/DSDT.ipmismbus
    M tests/data/acpi/q35/DSDT.ivrs
    M tests/data/acpi/q35/DSDT.memhp
    M tests/data/acpi/q35/DSDT.mmio64
    M tests/data/acpi/q35/DSDT.multi-bridge
    A tests/data/acpi/q35/DSDT.noacpihp
    M tests/data/acpi/q35/DSDT.nohpet
    M tests/data/acpi/q35/DSDT.numamem
    M tests/data/acpi/q35/DSDT.pvpanic-isa
    M tests/data/acpi/q35/DSDT.tis.tpm12
    M tests/data/acpi/q35/DSDT.tis.tpm2
    M tests/data/acpi/q35/DSDT.viot
    M tests/data/acpi/q35/DSDT.xapic
    M tests/qtest/bios-tables-test.c

  Log Message:
  -----------
  Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu 
into staging

virtio,pc,pci: features, fixes

Several features that landed at the last possible moment:

Passthrough HDM decoder emulation
Refactor cryptodev
RAS error emulation and injection
acpi-index support on non-hotpluggable slots
Dynamically switch to vhost shadow virtqueues at vdpa net migration

Plus a couple of bugfixes that look important to have in the release.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmQJ8TYPHG1zdEByZWRo
# YXQuY29tAAoJECgfDbjSjVRp37YIAMpQA5/ddmKKz/ABtBMHB5JX/SVYcG+1xkBR
# j9IFYusOfmmDfmgAhv0Qxi9+Wik95lszVZUnphvocSGd0PXH47pK7yv9RZ1ttaYX
# oAbXrGqXo8rUhl1ksQsJ8Iasj2di1BLP0byPuozbRkg1Kkz5TqRd9+hBqSBGEx21
# tsP5708UVCDAriwYYO78Cx0ZasmB9bqqeom5FdEsg9sYJ5aElOOvitp9YO1p2xhU
# gRvhD+k/aqNi+mfOUF7qGDBanxKgx75VV/KU1cjjS9R1vNtwRhfc/26PBrROY00a
# wkZWnAxmzDFKRS6cEfeb+eDGEVjC3IqLAjcFeuAIT/78CwdvIiY=
# =e1yv
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 09 Mar 2023 14:46:14 GMT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# 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

* tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (72 
commits)
  virtio: fix reachable assertion due to stale value of cached region size
  hw/virtio/vhost-user: avoid using unitialized errp
  hw/pxb-cxl: Support passthrough HDM Decoders unless overridden
  hw/pci: Add pcie_count_ds_port() and pcie_find_port_first() helpers
  hw/mem/cxl_type3: Add CXL RAS Error Injection Support.
  hw/pci/aer: Make PCIE AER error injection facility available for other 
emulation to use.
  hw/cxl: Fix endian issues in CXL RAS capability defaults / masks
  hw/mem/cxl-type3: Add AER extended capability
  hw/pci-bridge/cxl_root_port: Wire up MSI
  hw/pci-bridge/cxl_root_port: Wire up AER
  hw/pci/aer: Add missing routing for AER errors
  hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register
  pcihp: add ACPI PCI hotplug specific is_hotpluggable_bus() callback
  pcihp: move fields enabling hotplug into AcpiPciHpState
  acpi: pci: move out ACPI PCI hotplug generator from generic slot generator 
build_append_pci_bus_devices()
  acpi: pci: move BSEL into build_append_pcihp_slots()
  acpi: pci: drop BSEL usage when deciding that device isn't hotpluggable
  pci: move acpi-index uniqueness check to generic PCI device code
  tests: acpi: update expected blobs
  tests: acpi: add non zero function device with acpi-index on non-hotpluggble 
bus
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/7dfce9bd0fb2...674acdd17808



reply via email to

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