From nobody Wed Nov 27 05:33:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1701441188; cv=none; d=zohomail.com; s=zohoarc; b=RUyNITs9g2UT0b6q6vcGB3kTHrwNsoyk4qP1DAc5by8MbANoo0exdMk1ZjxF4USLzxuBEXsCapSuU0qKnUlAjG+2ks4vmpNDJVn+wpF2HRg3hlDkTEsM76B9cFldCTzFGMwps/YBY2xqjeY3Si9VNN8Ot7wOhP4AAUwo2mm/gWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701441188; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lzQsYOZx1lby/03o6yhLAnKTrunXv93oPFAjodmUZ7Q=; b=dBSei0DClyNjGf1cS76CLoIDfTzZfeo+gFClKus9o0hobinkmlaJt5+gsbc4sTqetTAPo0ybvLos5X29NFghdYMX0SXAyARjnegdOGO0GokerqR8b/1nm500Y2jRMHfeCN/DDPNv97/83ZD4Z1N3WJxS7nBfWuug+ZaSljfhi90= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701441188334448.34887688496144; Fri, 1 Dec 2023 06:33:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r94Z6-0003Zy-1u; Fri, 01 Dec 2023 09:32:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r94Yz-0003ZC-WD for qemu-devel@nongnu.org; Fri, 01 Dec 2023 09:32:18 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r94Yy-0002Xp-Du for qemu-devel@nongnu.org; Fri, 01 Dec 2023 09:32:17 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-50bc36725bbso3210417e87.2 for ; Fri, 01 Dec 2023 06:32:16 -0800 (PST) Received: from m1x-phil.lan ([176.176.160.225]) by smtp.gmail.com with ESMTPSA id d9-20020a056000114900b00332e8dd713fsm4350612wrx.74.2023.12.01.06.32.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 01 Dec 2023 06:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701441134; x=1702045934; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lzQsYOZx1lby/03o6yhLAnKTrunXv93oPFAjodmUZ7Q=; b=mGNXZeGt4LleZsRH7SVt8Q7wjSqera5hWc063YxmTU+nEbsPen88n1h/SbUw88OQm/ UxXn+aLHtTtynu8NZf6WyhNrXahAOe1tva4cozSwozUkraZ/7YmPCWmulVFCEsN38d7R c83VVsbPnsEFTlxshnlj+my8t6Np5jZGjB9a6VWTHJ3yrnPU0sNr312uO9zzrMECBWXU 6Jt5Ncebw6O8YzUB2o8Gf5G2blMp0PGGiSr497AImY0s2pJn+wr7pfmBPK7hpLoyGTeO kjC5ikBXWxlok9I8XXKVAC3sC8b+68ePGaQ3aA4jHADRJqjmvgm4vIfW9apwJ7N/+4Xy L2XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701441134; x=1702045934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lzQsYOZx1lby/03o6yhLAnKTrunXv93oPFAjodmUZ7Q=; b=wgFv4OCigTzvTEHoZW8AAp2UgC5wbtUBYjkWPWPj9jsd5byed58WqdLzakfaLIpu0O xgryiyBuOlSflLNZ83TY3xkoImAqsh7Pf2ni6upR7KWgLylw5A11MpLRUbz3yHb2C72w VR+aiGlj3idnh8IL08X0om9xeaCj2xVHg9E6wMEwHk8xQNGqlM7cydn9NKn8Q0QZ3FHI AZtcbEwEEPslkZsKLH88HrWIsA/tBMJyyG0gqoFWGGfsmEJNocxS7iytfpJ80U/Gk5Ta uId7WEOpKfuvegWbK9uu+iQNd5zbRdaM15OUyALPUS4yvwZorCu9fMNOzlqixuh60Zdf EJQQ== X-Gm-Message-State: AOJu0YyKoqyoBWi0qg52H2JQxZf+WFgdjbA/CIr3hw14sE5M2ncxFLf0 yhB2GUyhS7cmcSflLnG8Uxi2C2+zJngutAkt1QQ= X-Google-Smtp-Source: AGHT+IGxNtCUIXiaeul22hFkOioPcdXpn+nN/fti0ygrW7t/+DOLxnpEWtcg8NiaYZKBjrk5iX+fQg== X-Received: by 2002:a05:6512:1598:b0:50b:d763:fe35 with SMTP id bp24-20020a056512159800b0050bd763fe35mr1096852lfb.80.1701441134581; Fri, 01 Dec 2023 06:32:14 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , kvm@vger.kernel.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 2/2] target/arm/kvm: Use generic kvm_supports_guest_debug() Date: Fri, 1 Dec 2023 15:32:01 +0100 Message-ID: <20231201143201.40182-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231201143201.40182-1-philmd@linaro.org> References: <20231201143201.40182-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1701441190380000005 Do not open-code the generic kvm_supports_guest_debug(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Gavin Shan --- target/arm/kvm64.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 3c175c93a7..031d20ad92 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -32,13 +32,8 @@ #include "hw/acpi/acpi.h" #include "hw/acpi/ghes.h" =20 -static bool have_guest_debug; - void kvm_arm_init_debug(KVMState *s) { - have_guest_debug =3D kvm_check_extension(s, - KVM_CAP_SET_GUEST_DEBUG); - max_hw_wps =3D kvm_check_extension(s, KVM_CAP_GUEST_DEBUG_HW_WPS); hw_watchpoints =3D g_array_sized_new(true, true, sizeof(HWWatchpoint), max_hw_wps); @@ -1141,7 +1136,7 @@ static const uint32_t brk_insn =3D 0xd4200000; =20 int kvm_arch_insert_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *= bp) { - if (have_guest_debug) { + if (kvm_supports_guest_debug()) { if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 4,= 0) || cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&brk_insn, 4, 1)) { return -EINVAL; @@ -1157,7 +1152,7 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struc= t kvm_sw_breakpoint *bp) { static uint32_t brk; =20 - if (have_guest_debug) { + if (kvm_supports_guest_debug()) { if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&brk, 4, 0) || brk !=3D brk_insn || cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 4,= 1)) { --=20 2.41.0