From nobody Wed Nov 27 00:47:33 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=1703013396; cv=none; d=zohomail.com; s=zohoarc; b=Vdj6dlhnchIkxSm9bggTbmc0vDaGZyVb53nwyeka/6HcCcB7vBv1x45GvqwDISIfoeCh0ikCRL4fwv6D03b3Md5Na/E9ZtDW4sMeAwdePbpd2LFmJKLN+R2SzLSQGjJQpSWw2hhzlz0NptPJtWE3jnfsMbTrMsVbRkwh3QBasCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703013396; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=F3jDm6hsuPn369Wfm7LfYD3ZrqbNS5l6yUoiu2wnKtg=; b=LnxviXxHcRlt/qJI1r7xKBMiczzSYfZlx8AAayG6QykrfWr86RVnhnVdLiGAPJUtTZvCAmbgQOhd2439NfWACyDaAc026R9Jnwv2lL7U/7+sX5UBGHb0aJGjg7jn8/CJFW+mXz1dfRgfMZqVG0EDJykMhfrQ2xLmOOOc8KpDsQU= 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 1703013396888459.0891397765597; Tue, 19 Dec 2023 11:16:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rFfWn-0001mY-Bu; Tue, 19 Dec 2023 14:13:17 -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 1rFfWl-0001k5-4L for qemu-devel@nongnu.org; Tue, 19 Dec 2023 14:13:15 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rFfWj-0001lK-23 for qemu-devel@nongnu.org; Tue, 19 Dec 2023 14:13:14 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40c3fe6c08fso56500835e9.1 for ; Tue, 19 Dec 2023 11:13:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f5-20020a5d5685000000b0033657376b62sm12007754wrv.105.2023.12.19.11.13.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 11:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703013190; x=1703617990; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=F3jDm6hsuPn369Wfm7LfYD3ZrqbNS5l6yUoiu2wnKtg=; b=ORXSRtICHeMcAZA+QFJd47mFqT0mF/ElJBSUq1tt7IvcRVphjewYCmWgudwVFL5Nen Q4/GSZdBsvEX7cDyN2qaI6P8tn2WWsXj7EJwF3+UDCIRn27KVblZl2tBD8PslA0dJGXy 8NE9KN4qqWZqY1hctAbBtIpqx4p7xAHoqwM1TufplDrF2CP7JwWpPeriTQ+fpdOf+D2R gttyeLaKK2s0DWjktCBiUbuQPBc5X2cYHUkE2fjlYpa3syGEQxjpP8npC9/USlDRK6Se CA65XKljL8xFNsiNuM3NVjgGA3AS1JFxkveVyvF7/txoQnaSo7dBMFk3Gv8GJ/61AkAW RmFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703013190; x=1703617990; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F3jDm6hsuPn369Wfm7LfYD3ZrqbNS5l6yUoiu2wnKtg=; b=s7bWSB1pVVbc2XrDPNO2yYkE+hBlcvMFjdqkHgwy18itaiVuV4SnA/jX8uUW9v+Qo3 vFC5I70NSqNb6kc9TYj8ZQvULBFN/v7pXF9wSk/SIgx1Av2K097jBKYb7W421GdMUycd lFkke42sttNhptqJLIs8gCWedF1IN1EcVIbIR8rXq7TrmGKem/PTPm/1zbjDiVaFbGVk 2q43BTAXJqH5vxeCLnJKJ0+4IKbK5rT2ILKtBBmNh99yQLk4/W8jP4THeiqNYNK/Da18 6n0nm3zk7WinT2ketda6nLFfsbouG6O3W0mdMhKuYDShLbMJQ5QGQX+nyAkOLJqjsBFi BlrQ== X-Gm-Message-State: AOJu0YxiU8HPxAr2OaDXE9xcy0Hy2ELMY73Y86PeuDjPUzk5G4EJ+2b9 xRYcVJxwvdoKQknzpGfj+U2cyjRyaXIsFgdayqg= X-Google-Smtp-Source: AGHT+IGDqMgdXc3M+uIw8511sqYOy8r0wMPutaNm+Iy8KzcULfpBbfuk0X+vV/YOSIXavIIGeNa31w== X-Received: by 2002:a05:600c:2802:b0:40b:5e59:99b6 with SMTP id m2-20020a05600c280200b0040b5e5999b6mr6808312wmb.214.1703013190477; Tue, 19 Dec 2023 11:13:10 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/43] target/arm: kvm64: remove a redundant KVM_CAP_SET_GUEST_DEBUG probe Date: Tue, 19 Dec 2023 19:12:26 +0000 Message-Id: <20231219191307.2895919-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231219191307.2895919-1-peter.maydell@linaro.org> References: <20231219191307.2895919-1-peter.maydell@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::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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=ham 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: 1703013397664100001 From: Chao Du The KVM_CAP_SET_GUEST_DEBUG is probed during kvm_init(). gdbserver will fail to start if the CAP is not supported. So no need to make another probe here, like other targets. Signed-off-by: Chao Du Reviewed-by: Richard Henderson Message-Id: <20231025070726.22689-1-duchao@eswincomputing.com> Signed-off-by: Richard Henderson Reviewed-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- target/arm/kvm64.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 3c175c93a7a..b8bb25a1eaa 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -32,13 +32,9 @@ #include "hw/acpi/acpi.h" #include "hw/acpi/ghes.h" =20 -static bool have_guest_debug; =20 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,33 +1137,23 @@ 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 (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; - } - return 0; - } else { - error_report("guest debug not supported on this kernel"); + 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; } + return 0; } =20 int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *= bp) { static uint32_t brk; =20 - if (have_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)) { - return -EINVAL; - } - return 0; - } else { - error_report("guest debug not supported on this kernel"); + 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))= { return -EINVAL; } + return 0; } =20 /* See v8 ARM ARM D7.2.27 ESR_ELx, Exception Syndrome Register --=20 2.34.1