From patchwork Thu Apr 7 08:44:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12804751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0B13C433EF for ; Thu, 7 Apr 2022 08:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238806AbiDGIql (ORCPT ); Thu, 7 Apr 2022 04:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243243AbiDGIqf (ORCPT ); Thu, 7 Apr 2022 04:46:35 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D37D0182AC0; Thu, 7 Apr 2022 01:44:36 -0700 (PDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2376LSlN014307; Thu, 7 Apr 2022 08:44:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=VtK4X4Jj9FK6dMvxWJ/594tiJuAGORzztpgfS5m+rsE=; b=TMw/5qLDOlKWNhcdQ+piWY5sGjpgQkBtjwrJCAbO/hT6iCDNtY0c3+392FzrQJD2QHL7 Q5+ei7JN3KL0h5RvYOpqzhhy0HffV10DKZgSRI7O3E70Ivhp1nSyf0275ipAbyopUfjO zaqCAYnEaLomYWppJCVsnXaqe2lg1qJb+S7lTuUp9eqG1Xtp80u8wn9ytxO2XQvTw0Nc uMIDQkKrCTTcr5pWhcosC09sgV3gTSD71iVsRQXBejBPcMOBK1CHkxq1PVp7u/gocPzI 6EYaKu3e0/gZSC1sWcxFW1ELyMsG1m4Km4SwhQnOoi/2M3A1I/RY4wH7Vv/nI5aQh8lh CQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3f9tm4tphg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Apr 2022 08:44:35 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 2378MAp9002579; Thu, 7 Apr 2022 08:44:35 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3f9tm4tpgx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Apr 2022 08:44:35 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2378XM0f001566; Thu, 7 Apr 2022 08:44:33 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 3f6drhsdbe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Apr 2022 08:44:33 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2378iUW327984142 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Apr 2022 08:44:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D892AE057; Thu, 7 Apr 2022 08:44:30 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7213EAE045; Thu, 7 Apr 2022 08:44:29 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 7 Apr 2022 08:44:29 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, nrb@linux.ibm.com, seiden@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 1/9] lib: s390x: hardware: Add host_is_qemu() function Date: Thu, 7 Apr 2022 08:44:13 +0000 Message-Id: <20220407084421.2811-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220407084421.2811-1-frankja@linux.ibm.com> References: <20220407084421.2811-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: jd-oXdaAbAuqVnEqyw4GToRavzzscU_G X-Proofpoint-ORIG-GUID: fr2shhoR6rPOWUhlY7XP-xhVJZroiG6o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-04-06_13,2022-04-06_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204070043 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 Reviewed-by: Claudio Imbrenda Reviewed-by: Nico Boehr --- 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();