From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id EED7892133 for ; Mon, 13 Mar 2023 12:44:29 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C52E3AC9A for ; Mon, 13 Mar 2023 12:43:59 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 13 Mar 2023 12:43:58 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 304BB43E36 for ; Mon, 13 Mar 2023 12:43:58 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 13 Mar 2023 12:43:54 +0100 Message-Id: <20230313114354.94905-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu] add patches to fix regression with LSI SCSI controller X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Mar 2023 11:44:30 -0000 The patch 0008-memory-prevent-dma-reentracy-issues.patch introduced a regression for the LSI SCSI controller leading to boot failures [0], because, in its current form, it relies on reentrancy for a particular ram_io region. [0]: https://forum.proxmox.com/threads/123843 Signed-off-by: Fiona Ebner --- Needs these two patches first (for the numbering in the series file): https://lists.proxmox.com/pipermail/pve-devel/2023-March/056110.html ...isabling-re-entrancy-checking-per-MR.patch | 38 +++++++++++++++++++ ...le-reentrancy-detection-for-script-R.patch | 33 ++++++++++++++++ debian/patches/series | 2 + 3 files changed, 73 insertions(+) create mode 100644 debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch create mode 100644 debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch diff --git a/debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch b/debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch new file mode 100644 index 0000000..3d5c267 --- /dev/null +++ b/debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexander Bulekov +Date: Mon, 13 Mar 2023 04:24:16 -0400 +Subject: [PATCH] memory: Allow disabling re-entrancy checking per-MR + +Signed-off-by: Alexander Bulekov +--- + include/exec/memory.h | 3 +++ + softmmu/memory.c | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/include/exec/memory.h b/include/exec/memory.h +index 91f8a2395a..d7268d9f39 100644 +--- a/include/exec/memory.h ++++ b/include/exec/memory.h +@@ -765,6 +765,9 @@ struct MemoryRegion { + unsigned ioeventfd_nb; + MemoryRegionIoeventfd *ioeventfds; + RamDiscardManager *rdm; /* Only for RAM */ ++ ++ /* For devices designed to perform re-entrant IO into their own IO MRs */ ++ bool disable_reentrancy_guard; + }; + + struct IOMMUMemoryRegion { +diff --git a/softmmu/memory.c b/softmmu/memory.c +index 7dcb3347aa..2b46714191 100644 +--- a/softmmu/memory.c ++++ b/softmmu/memory.c +@@ -544,7 +544,7 @@ static MemTxResult access_with_adjusted_size(hwaddr addr, + } + + /* Do not allow more than one simultanous access to a device's IO Regions */ +- if (mr->owner && ++ if (mr->owner && !mr->disable_reentrancy_guard && + !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) { + dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE); + if (dev) { diff --git a/debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch b/debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch new file mode 100644 index 0000000..a4ed0ee --- /dev/null +++ b/debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexander Bulekov +Date: Mon, 13 Mar 2023 04:24:17 -0400 +Subject: [PATCH] lsi53c895a: disable reentrancy detection for script RAM + +As the code is designed to use the memory APIs to access the script ram, +disable reentrancy checks for the pseudo-RAM ram_io MemoryRegion. + +In the future, ram_io may be converted from an IO to a proper RAM MemoryRegion. + +Reported-by: Fiona Ebner +Signed-off-by: Alexander Bulekov +--- + hw/scsi/lsi53c895a.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c +index 50979640c3..894b9311ac 100644 +--- a/hw/scsi/lsi53c895a.c ++++ b/hw/scsi/lsi53c895a.c +@@ -2302,6 +2302,12 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp) + memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s, + "lsi-io", 256); + ++ /* ++ * Since we use the address-space API to interact with ram_io, disable the ++ * re-entrancy guard. ++ */ ++ s->ram_io.disable_reentrancy_guard = true; ++ + address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io"); + qdev_init_gpio_out(d, &s->ext_irq, 1); + diff --git a/debian/patches/series b/debian/patches/series index ba3279e..681b57d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -18,6 +18,8 @@ extra/0017-vhost-avoid-a-potential-use-of-an-uninitialized-vari.patch extra/0018-chardev-char-socket-set-s-listener-NULL-in-char_sock.patch extra/0019-intel-iommu-fail-MAP-notifier-without-caching-mode.patch extra/0020-intel-iommu-fail-DEVIOTLB_UNMAP-without-dt-mode.patch +extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch +extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch -- 2.30.2