Re: [kvm-unit-tests PATCH 1/3] lib: s390x: hw: Provide early detect host

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

 



On 10/10/23 13:42, Claudio Imbrenda wrote:
On Tue, 10 Oct 2023 13:03:08 +0200
Janosch Frank <frankja@xxxxxxxxxxxxx> wrote:

On 10/10/23 12:40, Claudio Imbrenda wrote:
On Tue, 10 Oct 2023 07:38:53 +0000
Janosch Frank <frankja@xxxxxxxxxxxxx> wrote:
For early sclp printing it's necessary to know if we're under LPAR or
not so we can apply compat SCLP ASCII transformations.

Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx>
---
   lib/s390x/hardware.c | 8 ++++++++
   lib/s390x/hardware.h | 1 +
   2 files changed, 9 insertions(+)

diff --git a/lib/s390x/hardware.c b/lib/s390x/hardware.c
index 2bcf9c4c..d5a752c0 100644
--- a/lib/s390x/hardware.c
+++ b/lib/s390x/hardware.c
@@ -52,6 +52,14 @@ static enum s390_host do_detect_host(void *buf)
   	return HOST_IS_UNKNOWN;
   }
+enum s390_host detect_host_early(void)
+{
+	if (stsi_get_fc() == 2)
+		return HOST_IS_LPAR;
+
+	return HOST_IS_UNKNOWN;
+}
+
   enum s390_host detect_host(void)
   {
   	static enum s390_host host = HOST_IS_UNKNOWN;
diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h
index 86fe873c..5e5a9d90 100644
--- a/lib/s390x/hardware.h
+++ b/lib/s390x/hardware.h
@@ -24,6 +24,7 @@ enum s390_host {
   };
enum s390_host detect_host(void);
+enum s390_host detect_host_early(void);

I wonder if it weren't easier to fix detect_host so it can be used
early....

Problem is, where do you start and where do you end?

We could statically allocate a page but why did we add the current
version then? (The old version did that if I remember correctly).

the old version also allocated pages, and was a hodgepodge of various
functions replicating the same behaviour, many calling the others. the
main goal of the current version was to make it more readable and
maintainable.

a possible fix could also involve allocating the buffer on the stack of
do_detect_host(), so it's not taking up memory permanently.


We have 64k of stack and since we're calling this from the setup code a huge part should be free. I'll have a look at this.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux