hw/nvme fixes

Some fixes for hw/nvme ioeventfd support.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmLnpQ4ACgkQTeGvMW1P
 Delnywf/fM7Qp5WMR0ExHqVuKfpN1EBK8C6wa3xp7EI0pCDP50ZwJfcMmeZOhDAe
 3KXdNTXV43cxygkdzG/uxh7j26Zq8zGzcf1RVLAIUqzL9wTkoFcJ4+aIuzlV4wjU
 oS1jK+pItJ9/Kb9SeavVGOzTzyBzs2G9odRvjyjGrwrEfpEBEtncwfXAK7mPqt1V
 TNDR0M0qJ9Bheaoqs7miqa4zOevtKKp3pPeG0n2BOhWromGx6MbeHwTuNg96zR0+
 VXuEmUyj8r6ezKmQdgnJPoqFCwEJI0iBGPSKhpIp3EGrkAww2IuBAN8C4bo03Bzq
 Fj3pne5Sr9iBV/nhz9vN267STQzdsw==
 =AL7y
 -----END PGP SIGNATURE-----

Merge tag 'nvme-next-pull-request' of git://git.infradead.org/qemu-nvme into staging

hw/nvme fixes

Some fixes for hw/nvme ioeventfd support.

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmLnpQ4ACgkQTeGvMW1P
# Delnywf/fM7Qp5WMR0ExHqVuKfpN1EBK8C6wa3xp7EI0pCDP50ZwJfcMmeZOhDAe
# 3KXdNTXV43cxygkdzG/uxh7j26Zq8zGzcf1RVLAIUqzL9wTkoFcJ4+aIuzlV4wjU
# oS1jK+pItJ9/Kb9SeavVGOzTzyBzs2G9odRvjyjGrwrEfpEBEtncwfXAK7mPqt1V
# TNDR0M0qJ9Bheaoqs7miqa4zOevtKKp3pPeG0n2BOhWromGx6MbeHwTuNg96zR0+
# VXuEmUyj8r6ezKmQdgnJPoqFCwEJI0iBGPSKhpIp3EGrkAww2IuBAN8C4bo03Bzq
# Fj3pne5Sr9iBV/nhz9vN267STQzdsw==
# =AL7y
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 01 Aug 2022 03:03:58 AM PDT
# gpg:                using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [unknown]
# gpg:                 aka "Klaus Jensen <k.jensen@samsung.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#      Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'nvme-next-pull-request' of git://git.infradead.org/qemu-nvme:
  hw/nvme: do not enable ioeventfd by default
  hw/nvme: unregister the event notifier handler on the main loop
  hw/nvme: skip queue processing if notifier is cleared

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-08-01 06:29:49 -07:00
commit e34de2d13a

View File

@ -4238,7 +4238,9 @@ static void nvme_cq_notifier(EventNotifier *e)
NvmeCQueue *cq = container_of(e, NvmeCQueue, notifier);
NvmeCtrl *n = cq->ctrl;
event_notifier_test_and_clear(&cq->notifier);
if (!event_notifier_test_and_clear(e)) {
return;
}
nvme_update_cq_head(cq);
@ -4275,7 +4277,9 @@ static void nvme_sq_notifier(EventNotifier *e)
{
NvmeSQueue *sq = container_of(e, NvmeSQueue, notifier);
event_notifier_test_and_clear(&sq->notifier);
if (!event_notifier_test_and_clear(e)) {
return;
}
nvme_process_sq(sq);
}
@ -4307,6 +4311,7 @@ static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n)
if (sq->ioeventfd_enabled) {
memory_region_del_eventfd(&n->iomem,
0x1000 + offset, 4, false, 0, &sq->notifier);
event_notifier_set_handler(&sq->notifier, NULL);
event_notifier_cleanup(&sq->notifier);
}
g_free(sq->io_req);
@ -4697,6 +4702,7 @@ static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n)
if (cq->ioeventfd_enabled) {
memory_region_del_eventfd(&n->iomem,
0x1000 + offset, 4, false, 0, &cq->notifier);
event_notifier_set_handler(&cq->notifier, NULL);
event_notifier_cleanup(&cq->notifier);
}
if (msix_enabled(&n->parent_obj)) {
@ -7664,7 +7670,7 @@ static Property nvme_props[] = {
DEFINE_PROP_UINT8("vsl", NvmeCtrl, params.vsl, 7),
DEFINE_PROP_BOOL("use-intel-id", NvmeCtrl, params.use_intel_id, false),
DEFINE_PROP_BOOL("legacy-cmb", NvmeCtrl, params.legacy_cmb, false),
DEFINE_PROP_BOOL("ioeventfd", NvmeCtrl, params.ioeventfd, true),
DEFINE_PROP_BOOL("ioeventfd", NvmeCtrl, params.ioeventfd, false),
DEFINE_PROP_UINT8("zoned.zasl", NvmeCtrl, params.zasl, 0),
DEFINE_PROP_BOOL("zoned.auto_transition", NvmeCtrl,
params.auto_transition_zones, true),