Compare commits

...

No commits in common. "imports/c8s-stream-rhel/SLOF-20191022-3.git899d9883.module+el8.3.0+6423+e4cb6418" and "c8-beta-stream-rhel" have entirely different histories.

7 changed files with 164 additions and 347 deletions

View File

@ -1 +1 @@
8b17e3cd9c6cd9ea46febee20738bc194405c83d SOURCES/qemu-slof-20191022.tar.gz
9bc8b85c83af0d4108d0a44625d83ccc9a22fa04 SOURCES/qemu-slof-20210217.tar.gz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/qemu-slof-20191022.tar.gz
SOURCES/qemu-slof-20210217.tar.gz

View File

@ -1,240 +0,0 @@
From d53b544b88877a8a91a6579d54a2b384ee8a3715 Mon Sep 17 00:00:00 2001
From: David Gibson <dgibson@redhat.com>
Date: Tue, 7 Jan 2020 00:40:36 +0000
Subject: [PATCH 2/2] fdt: Fix updating the tree at H_CAS
RH-Author: David Gibson <dgibson@redhat.com>
Message-id: <20200107004037.421470-3-dgibson@redhat.com>
Patchwork-id: 93281
O-Subject: [RHEL-AV-8.2.0 SLOF PATCH 2/2] fdt: Fix updating the tree at H_CAS
Bugzilla: 1778704
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
From: Alexey Kardashevskiy <aik@ozlabs.ru>
The previous approach to merge the QEMU FDT into the existing tree and
then patch it turned to be broken as we patch properties based on their
names only so we patch not just what QEMU provides (which was
the intention) but also all properties SLOF created. This breaks one of
them - "interrupt-map" - it is created by QEMU for a PHB but SLOF creates
it for PCI bridges and since they have different sizes, patching phandles
at fixed offset fails.
Rather than skipping certain nodes in the SLOF tree, this uses different
approach: now we read the QEMU FDT in 3 passes:
1. find all phandle/linux-phandle properties and store these in the SLOF
internal tree to allow phandle->node lookup later;
2. walk through all FDT properties, patch them if needed using
phandles from the SLOF tree and save patched values in SLOF properties;
3. delete phandle/linux-phandle properties created in 1. This is safe
as SLOF does not create these properties anyway.
Fixes: 44d06f9e68cf ("fdt: Update phandles after H_CAS")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
(cherry picked from commit 497f61400d3b10cde3f2bd98201bf99441ec0eae)
Signed-off-by: David Gibson <dgibson@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
board-qemu/slof/archsupport.fs | 1 -
board-qemu/slof/fdt.fs | 123 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 117 insertions(+), 7 deletions(-)
diff --git a/board-qemu/slof/archsupport.fs b/board-qemu/slof/archsupport.fs
index 6512d57..fc48830 100644
--- a/board-qemu/slof/archsupport.fs
+++ b/board-qemu/slof/archsupport.fs
@@ -33,7 +33,6 @@
fdt-check-header
fdt-struct fdt-fix-cas-node
fdt-fix-cas-success NOT ( memaddr err? )
- s" /" find-node fdt-fix-phandles
ELSE
FALSE
THEN
diff --git a/board-qemu/slof/fdt.fs b/board-qemu/slof/fdt.fs
index 5ece270..fc39a82 100644
--- a/board-qemu/slof/fdt.fs
+++ b/board-qemu/slof/fdt.fs
@@ -12,6 +12,7 @@
0 VALUE fdt-debug
TRUE VALUE fdt-cas-fix?
+0 VALUE fdt-cas-pass
\ Bail out if no fdt
fdt-start 0 = IF -1 throw THEN
@@ -294,6 +295,81 @@ fdt-claim-reserve
2drop 2drop
;
+: (phandle>node) ( phandle current -- node|0 )
+ dup s" phandle" rot get-property 0= IF
+ decode-int nip nip ( phandle current phandle-prop )
+ 2 pick = IF
+ fdt-debug IF ." Found phandle; " dup . ." <= " over . cr THEN
+ nip ( current )
+ EXIT
+ THEN
+ ELSE
+ dup s" linux-phandle" rot get-property 0= IF
+ decode-int nip nip ( phandle current phandle-prop )
+ 2 pick = IF
+ fdt-debug IF ." Found linux-phandle; " dup . ." <= " over . cr THEN
+ nip ( current )
+ EXIT
+ THEN
+ THEN
+ THEN
+ child BEGIN
+ dup
+ WHILE
+ 2dup
+ RECURSE
+ ?dup 0<> IF
+ nip nip
+ EXIT
+ THEN
+ PEER
+ REPEAT
+ 2drop 0
+;
+
+: phandle>node ( phandle -- node ) s" /" find-node (phandle>node) ;
+
+: (fdt-patch-phandles) ( prop-addr prop-len -- )
+ BEGIN
+ dup
+ WHILE ( prop-addr prop-len )
+ over l@ phandle>node
+ ?dup 0<> IF
+ fdt-debug IF ." ### Patching phandle=" 2 pick l@ . cr THEN
+ 2 pick l!
+ TRUE TO (fdt-phandle-replaced)
+ THEN
+ 4 - swap 4 + swap
+ REPEAT
+ 2drop
+;
+
+: (fdt-patch-interrupt-map) ( prop-addr prop-len -- )
+ \ interrupt-controller phandle is expected to be the same accross the map
+ over 10 + l@ phandle>node ?dup 0= IF 2drop EXIT THEN
+ -rot
+ fdt-debug IF ." ### Patching interrupt-map: " over 10 + l@ . ." => " 2 pick . cr THEN
+
+ TRUE TO (fdt-phandle-replaced)
+ BEGIN
+ dup
+ WHILE ( newph prop-addr prop-len )
+ 2 pick 2 pick 10 + l!
+ 1c - swap 1c + swap
+ REPEAT
+ 3drop
+;
+
+: fdt-patch-phandles ( prop-addr prop-len nameadd namelen -- )
+ 2dup s" interrupt-map" str= IF 2drop (fdt-patch-interrupt-map) EXIT THEN
+ 2dup s" interrupt-parent" str= IF 2drop (fdt-patch-phandles) EXIT THEN
+ 2dup s" ibm,gpu" str= IF 2drop (fdt-patch-phandles) EXIT THEN
+ 2dup s" ibm,npu" str= IF 2drop (fdt-patch-phandles) EXIT THEN
+ 2dup s" ibm,nvlink" str= IF 2drop (fdt-patch-phandles) EXIT THEN
+ 2dup s" memory-region" str= IF 2drop (fdt-patch-phandles) EXIT THEN
+ 4drop
+;
+
\ Replace one phandle "old" with a phandle "new" in "node" and recursively
\ in its child nodes:
: fdt-replace-all-phandles ( old new node -- )
@@ -394,6 +470,12 @@ r> drop
find-node ?dup 0 <> IF set-node THEN
;
+: str=phandle? ( s len -- true|false )
+ 2dup s" phandle" str= >r
+ s" linux,phandle" str=
+ r> or
+;
+
: (fdt-fix-cas-node) ( start -- end )
recursive
fdt-next-tag dup OF_DT_BEGIN_NODE <> IF
@@ -414,7 +496,7 @@ r> drop
2dup find-node ?dup 0 <> IF
set-node 2drop
ELSE
- fdt-debug IF ." Node not found, creating " 2dup type cr THEN
+ fdt-debug IF ." Creating node: " 2dup type cr THEN
fdt-create-cas-node
THEN
fdt-debug IF ." Current now: " pwd cr THEN
@@ -422,22 +504,48 @@ r> drop
fdt-next-tag dup OF_DT_END_NODE <>
WHILE
dup OF_DT_PROP = IF
- fdt-debug IF ." Found property " cr THEN
drop dup ( drop tag, dup addr : a1 a1 )
dup l@ dup rot 4 + ( fetch size, stack is : a1 s s a2)
dup l@ swap 4 + ( fetch nameid, stack is : a1 s s i a3 )
rot ( we now have: a1 s i a3 s )
fdt-encode-prop rot ( a1 s pa ps i)
fdt-fetch-string ( a1 s pa ps na ns )
- property
- fdt-debug IF ." Setting property done " cr THEN
+
+ fdt-cas-pass CASE
+ 0 OF
+ 2dup str=phandle? IF
+ fdt-debug IF 4dup ." Phandle: " type ." =" swap ." @" . ." " .d ." bytes" cr THEN
+ property
+ ELSE
+ 4drop
+ THEN
+ ENDOF
+ 1 OF
+ 2dup str=phandle? not IF
+ fdt-debug IF 4dup ." Property: " type ." =" swap ." @" . ." " .d ." bytes" cr THEN
+ 4dup fdt-patch-phandles
+ property
+ ELSE
+ 4drop
+ THEN
+ ENDOF
+ 2 OF
+ 2dup str=phandle? IF
+ fdt-debug IF 4dup ." Deleting: " type ." =" swap ." @" . ." " .d ." bytes" cr THEN
+ delete-property
+ 2drop
+ ELSE
+ 4drop
+ THEN
+ ENDOF
+ ENDCASE
+
+ 8 + 3 + fffffffc and
ELSE dup OF_DT_BEGIN_NODE = IF
drop ( drop tag )
4 -
(fdt-fix-cas-node)
get-parent set-node
- fdt-debug IF ." Returning back " pwd cr THEN
ELSE
." Error " cr
drop
@@ -450,7 +558,10 @@ r> drop
;
: fdt-fix-cas-node ( start -- )
- (fdt-fix-cas-node) drop
+ 0 to fdt-cas-pass dup (fdt-fix-cas-node) drop \ Add phandles
+ 1 to fdt-cas-pass dup (fdt-fix-cas-node) drop \ Patch+add other properties
+ 2 to fdt-cas-pass dup (fdt-fix-cas-node) drop \ Delete phandles from pass 1
+ drop
;
: fdt-fix-cas-success
--
1.8.3.1

View File

@ -1,96 +0,0 @@
From 16b3bfa4f74942d9c2f49159715008d8d93c0f2d Mon Sep 17 00:00:00 2001
From: David Gibson <dgibson@redhat.com>
Date: Tue, 7 Jan 2020 00:40:35 +0000
Subject: [PATCH 1/2] ibm, client-architecture-support: Fix stack handling
RH-Author: David Gibson <dgibson@redhat.com>
Message-id: <20200107004037.421470-2-dgibson@redhat.com>
Patchwork-id: 93280
O-Subject: [RHEL-AV-8.2.0 SLOF PATCH 1/2] ibm, client-architecture-support: Fix stack handling
Bugzilla: 1778704
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
From: Alexey Kardashevskiy <aik@ozlabs.ru>
fdt-fix-cas-node returns the end address after it's finished which
the caller (ibm,client-architecture-support) does not use or drop.
This renames fdt-fix-cas-node to (fdt-fix-cas-node) and adds a wrapper
on top of that which does the drop. This will be used later for 2-pass
tree patching.
While at this, exit the function if memory allocation failed.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
(cherry picked from commit c50195e007319bf39c5315289ab93a2d7d02828b)
Signed-off-by: David Gibson <dgibson@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
board-qemu/slof/archsupport.fs | 8 ++++++--
board-qemu/slof/fdt.fs | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/board-qemu/slof/archsupport.fs b/board-qemu/slof/archsupport.fs
index 33ea765..6512d57 100644
--- a/board-qemu/slof/archsupport.fs
+++ b/board-qemu/slof/archsupport.fs
@@ -18,7 +18,11 @@
\ to come back to right boot device
\ Allocate memory for H_CALL
cas-buffer-size alloc-mem ( vec memaddr )
- dup 0= IF ." out of memory during ibm,client-architecture-support" cr THEN
+ dup 0= IF
+ ." out of memory during ibm,client-architecture-support" cr
+ 2drop TRUE
+ EXIT
+ THEN
swap over cas-buffer-size ( memaddr vec memaddr size )
\ make h_call to hypervisor
hv-cas 0= IF ( memaddr )
@@ -28,7 +32,7 @@
dup 4 + fdt-init
fdt-check-header
fdt-struct fdt-fix-cas-node
- fdt-fix-cas-success NOT
+ fdt-fix-cas-success NOT ( memaddr err? )
s" /" find-node fdt-fix-phandles
ELSE
FALSE
diff --git a/board-qemu/slof/fdt.fs b/board-qemu/slof/fdt.fs
index 3e4c1b3..5ece270 100644
--- a/board-qemu/slof/fdt.fs
+++ b/board-qemu/slof/fdt.fs
@@ -394,7 +394,7 @@ r> drop
find-node ?dup 0 <> IF set-node THEN
;
-: fdt-fix-cas-node ( start -- end )
+: (fdt-fix-cas-node) ( start -- end )
recursive
fdt-next-tag dup OF_DT_BEGIN_NODE <> IF
." Error " cr
@@ -435,7 +435,7 @@ r> drop
ELSE dup OF_DT_BEGIN_NODE = IF
drop ( drop tag )
4 -
- fdt-fix-cas-node
+ (fdt-fix-cas-node)
get-parent set-node
fdt-debug IF ." Returning back " pwd cr THEN
ELSE
@@ -449,6 +449,10 @@ r> drop
drop \ drop tag
;
+: fdt-fix-cas-node ( start -- )
+ (fdt-fix-cas-node) drop
+;
+
: fdt-fix-cas-success
fdt-cas-fix?
;
--
1.8.3.1

View File

@ -0,0 +1,87 @@
From 27f045e2d52ee49ddbb375b5593d4fc387aad4b0 Mon Sep 17 00:00:00 2001
From: Jordan Niethe <jniethe5@gmail.com>
Date: Tue, 29 Aug 2023 10:12:01 +1000
Subject: [PATCH 2/2] virtio-serial: Do not close stdout on quiesce
RH-Author: Thomas Huth <thuth@redhat.com>
RH-MergeRequest: 1: Fix SLOF crash when only using virtio console (without spapr-vty)
RH-Jira: RHEL-3709
RH-Acked-by: David Gibson (Red Hat) <dgibson@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Commit: [2/2] cbde239703a11aa2676a12b8415281d37cba54a5
Commit 76fee95 ("slof: Only close stdout for virtio-serial devices")
says that commit cf28264 ("virtio-serial: Rework shutdown sequence")
fixed a hang. The problem was believed to be that it was necessary to
close stdout to shutdown the underlying virtio device.
Commit cf28264 ("virtio-serial: Rework shutdown sequence") closed stdout
on quiesce. This meant when prom_init() called write on stdout after
quiesce, there is a use after free so this is unreliable, and can also
hang (especially after reboots).
Quiescing is intended to put hardware into a safe state for the client
to take over. It is incorrect for SLOF to close ihandles that the client
could still be using, even after a quiesce.
Rather than closing the stdout device, all that needs to happen is to
ensure virtio-serial-shutdown gets called. On quiesce, close the virtio
device, but leave the stdout device itself open.
Commit 8174acd ("virtio-serial: Close device completely") handles reads
and writes as no-ops if the underlying virtio device is closed so there
is no problem with the client calling "write" on stdout after this, but
no output will be displayed.
Fixes: cf28264 ("virtio-serial: Rework shutdown sequence")
Debugged-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
Co-developed-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
(cherry picked from commit dd4d4ea0add97df078d571b48192adaf7c4b0d87)
Jira: https://issues.redhat.com/browse/RHEL-3709
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
board-qemu/slof/virtio-serial.fs | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/board-qemu/slof/virtio-serial.fs b/board-qemu/slof/virtio-serial.fs
index 41e2e04..de42cc7 100644
--- a/board-qemu/slof/virtio-serial.fs
+++ b/board-qemu/slof/virtio-serial.fs
@@ -33,16 +33,14 @@ virtio-setup-vd VALUE virtiodev
: virtio-serial-term-key? virtiodev virtio-serial-haschar ;
: virtio-serial-term-key BEGIN virtio-serial-term-key? UNTIL virtiodev virtio-serial-getchar ;
-: virtio-serial-close-stdout s" stdout" get-chosen IF decode-int nip nip close-dev THEN ;
-
\ Basic device initialization - which has only to be done once
: init ( -- )
virtiodev virtio-serial-init drop
TRUE to initialized?
- \ Linux closes stdin at some point in prom_init(). This internally triggers a
- \ quiesce in SLOF. We must ensure stdout gets closed as well otherwise the
- \ device cannot be reset properly and the boot will hang.
- ['] virtio-serial-close-stdout add-quiesce-xt
+ \ virtiodev must be shutdown at quiesce so the device is reset properly.
+ \ The read and write methods can be called after quiesce so must handle
+ \ virtiodev being closed.
+ ['] shutdown add-quiesce-xt
;
0 VALUE open-count
@@ -62,8 +60,8 @@ virtiodev virtio-serial-init drop
open-count 0> IF
open-count 1 - dup to open-count
0= IF shutdown THEN
+ close
THEN
- close
;
: write ( addr len -- actual )
--
2.41.0

View File

@ -0,0 +1,58 @@
From 67cbc16b3e6d34cf3932f88fd32323878026d6a0 Mon Sep 17 00:00:00 2001
From: Kautuk Consul <kconsul@linux.vnet.ibm.com>
Date: Tue, 29 Aug 2023 10:12:00 +1000
Subject: [PATCH 1/2] virtio-serial: Make read and write methods report failure
RH-Author: Thomas Huth <thuth@redhat.com>
RH-MergeRequest: 1: Fix SLOF crash when only using virtio console (without spapr-vty)
RH-Jira: RHEL-3709
RH-Acked-by: David Gibson (Red Hat) <dgibson@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Commit: [1/2] 7aee41dceade77a47edd794cab43672ff95896d0
The read and write methods return successfully even if the virtio device
is closed (virtiodev is 0) and it is not able to send or receive any
characters.
Make the read and write methods return 0 to indicate they did not
succeed in this case.
This also fixes an invalid stack access in the read method.
Fixes: 8174acd ("virtio-serial: Close device completely")
Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
(cherry picked from commit 63b66a5147069bda815989732442cb07790609db)
Jira: https://issues.redhat.com/browse/RHEL-3709
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
board-qemu/slof/virtio-serial.fs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board-qemu/slof/virtio-serial.fs b/board-qemu/slof/virtio-serial.fs
index 82868e2..41e2e04 100644
--- a/board-qemu/slof/virtio-serial.fs
+++ b/board-qemu/slof/virtio-serial.fs
@@ -67,7 +67,7 @@ virtiodev virtio-serial-init drop
;
: write ( addr len -- actual )
- virtiodev 0= IF nip EXIT THEN
+ virtiodev 0= IF 2drop 0 EXIT THEN
tuck
0 ?DO
dup c@ virtiodev SWAP virtio-serial-putchar
@@ -78,7 +78,7 @@ virtiodev virtio-serial-init drop
: read ( addr len -- actual )
0= IF drop 0 EXIT THEN
- virtiodev 0= IF nip EXIT THEN
+ virtiodev 0= IF drop 0 EXIT THEN
virtiodev virtio-serial-haschar 0= IF 0 swap c! -2 EXIT THEN
virtiodev virtio-serial-getchar swap c! 1
;
--
2.41.0

View File

@ -1,22 +1,21 @@
%define GITDATE 20191022
%define GITCOMMIT 899d9883
%define GITDATE 20210217
%global debug_package %{nil}
Name: SLOF
Version: %{GITDATE}
Release: 3.git%{GITCOMMIT}%{?dist}
Release: 2%{?dist}
Summary: Slimline Open Firmware
Group: Applications/Emulators
License: BSD
URL: http://www.openfirmware.info/SLOF
Source0: https://github.com/aik/SLOF/archive/qemu-slof-20191022.tar.gz
Source0: https://github.com/aik/SLOF/archive/qemu-slof-20210217.tar.gz
# For bz#1778704 - Guest failed to boot up with device under pci-bridge
Patch2: slof-ibm-client-architecture-support-Fix-stack-handling.patch
# For bz#1778704 - Guest failed to boot up with device under pci-bridge
Patch3: slof-fdt-Fix-updating-the-tree-at-H_CAS.patch
# For RHEL-3709 - SLOF regression prevents VM startup
Patch1: slof-virtio-serial-Make-read-and-write-methods-report-fai.patch
# For RHEL-3709 - SLOF regression prevents VM startup
Patch2: slof-virtio-serial-Do-not-close-stdout-on-quiesce.patch
BuildArch: noarch
ExclusiveArch: %{power64}
@ -40,7 +39,6 @@ separately. It is a dependency of qemu-system-ppc64.
%setup -q -n SLOF-qemu-slof-%{GITDATE}
%autopatch -p1
%build
export CROSS=""
@ -62,6 +60,16 @@ install -c -m 0644 boot_rom.bin $RPM_BUILD_ROOT%{_datadir}/qemu-kvm/slof.bin
%{_datadir}/qemu-kvm/slof.bin
%changelog
* Wed Oct 04 2023 Jon Maloy <jmaloy@redhat.com> - 20210217-2.el8
- slof-virtio-serial-Make-read-and-write-methods-report-fai.patch [RHEL-3709]
- slof-virtio-serial-Do-not-close-stdout-on-quiesce.patch [RHEL-3709]
- Resolves: RHEL-3709
(SLOF regression prevents VM startup)
* Thu Sep 2 2021 Danilo C. L. de Paula <ddepaula@redhat.com> - 20210217-1.el8
- Resolves: bz#2000225
(Rebase virt:rhel module:stream based on AV-8.6)
* Mon Apr 27 2020 Danilo C. L. de Paula <ddepaula@redhat.com> - 20191022
- Resolves: bz#1810193
(Upgrade components in virt:rhel module:stream for RHEL-8.3 release)