nvme-cli: prevent ARM64 VMs from crashing
Resolves: RHEL-88173 Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
parent
a8002a662b
commit
0affc5bf8a
58
0019-nvme-avoid-using-unsupported-load-store.patch
Normal file
58
0019-nvme-avoid-using-unsupported-load-store.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
diff --git a/nvme-print.c b/nvme-print.c
|
||||||
|
index 2327674..cc27dc9 100644
|
||||||
|
--- a/nvme-print.c
|
||||||
|
+++ b/nvme-print.c
|
||||||
|
@@ -2452,23 +2452,45 @@ static void nvme_show_registers_pmrmscu(uint32_t pmrmscu)
|
||||||
|
pmrmscu);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline uint32_t mmio_read32(void *addr)
|
||||||
|
+/*
|
||||||
|
+ * VMs on arm64 can only use a subset of instructions for MMIO that provide
|
||||||
|
+ * the hypervisor with a complete instruction decode. Provide assembly MMIO
|
||||||
|
+ * accessors to prevent the compiler from using a possibly unsupported
|
||||||
|
+ * instruction.
|
||||||
|
+ *
|
||||||
|
+ * See kernel commit c726200dd106 ("KVM: arm/arm64: Allow reporting non-ISV
|
||||||
|
+ * data aborts to userspace") for more details.
|
||||||
|
+ */
|
||||||
|
+#if defined(__aarch64__)
|
||||||
|
+static inline uint32_t __raw_readl(const volatile uint32_t *addr)
|
||||||
|
+{
|
||||||
|
+ uint32_t val;
|
||||||
|
+
|
||||||
|
+ asm volatile("ldr %w0, %1" : "=r" (val) : "Qo" (*addr));
|
||||||
|
+
|
||||||
|
+ return val;
|
||||||
|
+}
|
||||||
|
+#else
|
||||||
|
+static inline uint32_t __raw_readl(volatile uint32_t *addr)
|
||||||
|
{
|
||||||
|
- __le32 *p = addr;
|
||||||
|
+ return *addr;
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
- return le32_to_cpu(*p);
|
||||||
|
+static inline uint32_t mmio_read32(void *addr)
|
||||||
|
+{
|
||||||
|
+ return le32_to_cpu(__raw_readl(addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Access 64-bit registers as 2 32-bit; Some devices fail 64-bit MMIO. */
|
||||||
|
static inline __u64 mmio_read64(void *addr)
|
||||||
|
{
|
||||||
|
- const volatile __u32 *p = addr;
|
||||||
|
- __u32 low, high;
|
||||||
|
+ uint32_t low, high;
|
||||||
|
|
||||||
|
- low = le32_to_cpu(*p);
|
||||||
|
- high = le32_to_cpu(*(p + 1));
|
||||||
|
+ low = le32_to_cpu(__raw_readl(addr));
|
||||||
|
+ high = le32_to_cpu(__raw_readl(addr + sizeof(uint32_t)));
|
||||||
|
|
||||||
|
- return ((__u64) high << 32) | low;
|
||||||
|
+ return ((uint64_t)high << 32) | low;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void json_ctrl_registers(void *bar)
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: nvme-cli
|
Name: nvme-cli
|
||||||
Version: 1.16
|
Version: 1.16
|
||||||
Release: 9%{?dist}
|
Release: 10%{?dist}
|
||||||
Summary: NVMe management command line interface
|
Summary: NVMe management command line interface
|
||||||
|
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
@ -29,6 +29,7 @@ Patch15: 0015-fix-firmware-log-page-frs-variable-sign.patch
|
|||||||
Patch16: 0016-fix-file-permissions-nvme-print.c.patch
|
Patch16: 0016-fix-file-permissions-nvme-print.c.patch
|
||||||
Patch17: 0017-fabrics-Fix-ordering-for-auto-connect-services.patch
|
Patch17: 0017-fabrics-Fix-ordering-for-auto-connect-services.patch
|
||||||
Patch18: 0018-nvme-fix-rnlpt-to_string-values.patch
|
Patch18: 0018-nvme-fix-rnlpt-to_string-values.patch
|
||||||
|
Patch19: 0019-nvme-avoid-using-unsupported-load-store.patch
|
||||||
|
|
||||||
BuildRequires: libuuid-devel
|
BuildRequires: libuuid-devel
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
@ -60,6 +61,7 @@ nvme-cli provides NVM-Express user space tooling for Linux.
|
|||||||
%patch16 -p1
|
%patch16 -p1
|
||||||
%patch17 -p1
|
%patch17 -p1
|
||||||
%patch18 -p1
|
%patch18 -p1
|
||||||
|
%patch19 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
@ -118,6 +120,9 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Feb 25 2026 Maurizio Lombardi <mlombard@redhat.com> - 1.16-10
|
||||||
|
- Fix VM crash RHEL-88173
|
||||||
|
|
||||||
* Thu Apr 20 2023 Maurizio Lombardi <mlombard@redhat.com> - 1.16-9
|
* Thu Apr 20 2023 Maurizio Lombardi <mlombard@redhat.com> - 1.16-9
|
||||||
- Fix BZ #2187288
|
- Fix BZ #2187288
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user