Message ID | 20220407084421.2811-2-frankja@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: Cleanup and maintenance 4 | expand |
On Thu, 7 Apr 2022 08:44:13 +0000 Janosch Frank <frankja@linux.ibm.com> wrote: > In the future we'll likely need to check if we're hosted on QEMU so > let's make this as easy as possible by providing a dedicated function. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > lib/s390x/hardware.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h > index 01eeb261..86fe873c 100644 > --- a/lib/s390x/hardware.h > +++ b/lib/s390x/hardware.h > @@ -45,6 +45,11 @@ static inline bool host_is_lpar(void) > return detect_host() == HOST_IS_LPAR; > } > > +static inline bool host_is_qemu(void) > +{ > + return host_is_tcg() || host_is_kvm(); > +} > + > static inline bool machine_is_z15(void) > { > uint16_t machine = get_machine_id();
On Thu, 2022-04-07 at 08:44 +0000, Janosch Frank wrote: > In the future we'll likely need to check if we're hosted on QEMU so > let's make this as easy as possible by providing a dedicated > function. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Reviewed-by: Nico Boehr <nrb@linux.ibm.com> We could also adjust the check we already have in s390x/epsw.c to use the new function, but also fine to leave as-is.
On 11/04/2022 13.46, Nico Boehr wrote: > On Thu, 2022-04-07 at 08:44 +0000, Janosch Frank wrote: >> In the future we'll likely need to check if we're hosted on QEMU so >> let's make this as easy as possible by providing a dedicated >> function. >> >> Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > > Reviewed-by: Nico Boehr <nrb@linux.ibm.com> > > We could also adjust the check we already have in s390x/epsw.c to use > the new function, but also fine to leave as-is. I'd suggest to fix it: It has the same "goto done" + prefix_pop problem that we recently saw in another patch, too. Thomas
diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h index 01eeb261..86fe873c 100644 --- a/lib/s390x/hardware.h +++ b/lib/s390x/hardware.h @@ -45,6 +45,11 @@ static inline bool host_is_lpar(void) return detect_host() == HOST_IS_LPAR; } +static inline bool host_is_qemu(void) +{ + return host_is_tcg() || host_is_kvm(); +} + static inline bool machine_is_z15(void) { uint16_t machine = get_machine_id();
In the future we'll likely need to check if we're hosted on QEMU so let's make this as easy as possible by providing a dedicated function. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> --- lib/s390x/hardware.h | 5 +++++ 1 file changed, 5 insertions(+)