From patchwork Wed Aug 23 20:22:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 716113 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp1002585wrp; Wed, 23 Aug 2023 13:26:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF959K/jE8wATa6KtEK+jG2LB8hr9o5p/EKriyRo39kER8tSkOSpyz165s38auewmEn2yap X-Received: by 2002:a05:620a:843:b0:76c:4307:3446 with SMTP id u3-20020a05620a084300b0076c43073446mr11904008qku.74.1692822401119; Wed, 23 Aug 2023 13:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692822401; cv=none; d=google.com; s=arc-20160816; b=CDggOBwTj/1CQu4LbUvqYkUAsNCfo445pd7fP3jHTKeSsNA16pWPfyTQUOs3dTu0d0 I4jQfMxY12TG7vRnF7rjJLu8UtZeRGTqS0/BPvUUGVMynNww70sBeWtgkC8uxpuHYufN L6uShUEVMjS9OzVqroIwAF6+xP2uCxvX1ft97Wq/5EwMpLQs3SrQtzXK6DwcVxuYX70+ 6/flvpnimTNhY4NndpmO8NQZgqe8UE+boXSAzsFNZaGrdENGCZs5ep4bxjYyogw4vkfc ZlmI/F1t0GrKnC73lQ+8FCzn1rbiRiY0yM+atcR+FfaJukfp3B2+OOJfW3lXKVD3tyxr IexA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cSCfZX36SM4x81luXkG6DawpBtd9wgJBICXgd1wDuO8=; fh=i53HmQH8ogkFLEAGHKavbm8W6+9/FINwiyX11eWiycE=; b=V8pRAFaZnO3zwTviVecBi29x9ikhgFWVuJoRsrVrCTYa7sh7LezV8uN4qF5qMQnSgK ir29ZyByWhckrgy2N1JpCRxUxU07N8IkiIftHNMYFMIoH7QnrItc3eIt42pFK7Jjlw5a JVh0x0Wxg7hlJhJZIUwvnI/bHdxOzMrlTRYrlKHRsPjY66Xbr0YNCE+0C/FWhoQ9qaTa 40Ugke0ka0TBrjc2z/+1aZanYvwNdBbfLaEe8Tv4+wqxk4q03M9W2NvjXyZHu73ZCYkC JZgItrEttlPx3+3WBCqMKFYnOhoFeQvKVmEPuHaKJRaYBsNDVsQHzltowMN4Sw5pNf+J UEjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=arWSiKRQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id su11-20020a05620a4b4b00b0076da9a5c93dsi3789873qkn.335.2023.08.23.13.26.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2023 13:26:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=arWSiKRQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYuOe-00008m-8G; Wed, 23 Aug 2023 16:24:08 -0400 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 1qYuOV-0008L1-7v for qemu-devel@nongnu.org; Wed, 23 Aug 2023 16:23:59 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYuOK-0005TX-OM for qemu-devel@nongnu.org; Wed, 23 Aug 2023 16:23:52 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bf3a2f44ffso44712445ad.1 for ; Wed, 23 Aug 2023 13:23:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692822211; x=1693427011; 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=cSCfZX36SM4x81luXkG6DawpBtd9wgJBICXgd1wDuO8=; b=arWSiKRQoo+s42l/a19OIDtOIWh9F9gmR0fYIgkJKTprTFFwr6zS+QJZaST7ZsVJeD Q5xDwkmTkDs8Hj09mYmiODa5biDP9RljPH6lhhKGr9T0Zb50M9AAtDxILHzTYU3Af086 gc0ChXpPpUfO85PeK7JQqnWV8KhqnJU8yy4MfB/UOkRfd+M4De/8SwkWaQsHqkEd6J27 0iqFg2nF7ziF2VDBWKxZqvvyHB3aT5SVsD4vbS1kJCWsl0NZvzHGYQBaH2VX7xNkq9pl wjHtYE39ODLehgKCHtSdNCfC9slIRUrHyxMhw9ZoGIap3vT9TG5iwpvUE7cWeKdaf+dU GYUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692822211; x=1693427011; 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=cSCfZX36SM4x81luXkG6DawpBtd9wgJBICXgd1wDuO8=; b=lCVrp95CSSH7VlrBKHFkxLV0y5bK7MB6cNmHlqjFTx2LtlqW+kstYSV+5xaPbZhpUS 6bcyMAYB1rRBYvSY27fde8Sd35QMu/NEux0bCI8/GfsgnuSW/qCFC3pkMEF7iEykSq+3 Q3ceZ9UDbs3foZqTF0elc/V+CnFAqfWpgn+DJzLk4POaoUCfManCjTK5jJ/1bGcjrhrS CRNlKAqpKkcBRwhIiJ1/oVA0aTJQ0n6ROC80C1K61PzkxCt4l9/iqZoHiTBNRpBEfLnV qz4XnKg9RXBWJnnDt9xtL6BMsLP1ZE00nDSeZub5fLCv7JqAGCJsJJOp1GTmthyDsG8y pfaw== X-Gm-Message-State: AOJu0Yzg3yWXifiu6tcQl/XkAbcXRtzpld/ecVT0FbMiJ2OVft/f27cv i5BYmYWDl99hhieGY2bpvkZ9wlb3k/vRF+1mUQk= X-Received: by 2002:a17:903:2305:b0:1bf:cdc:f402 with SMTP id d5-20020a170903230500b001bf0cdcf402mr17389974plh.48.1692822210919; Wed, 23 Aug 2023 13:23:30 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:72f0:1ea7:85d2:141e]) by smtp.gmail.com with ESMTPSA id iz22-20020a170902ef9600b001b9da42cd7dsm11418641plb.279.2023.08.23.13.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 13:23:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Anton Johansson Subject: [PULL 03/48] sysemu/kvm: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint Date: Wed, 23 Aug 2023 13:22:41 -0700 Message-Id: <20230823202326.1353645-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230823202326.1353645-1-richard.henderson@linaro.org> References: <20230823202326.1353645-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Anton Johansson via Changes the signature of the target-defined functions for inserting/removing kvm hw breakpoints. The address and length arguments are now of vaddr type, which both matches the type used internally in accel/kvm/kvm-all.c and makes the api target-agnostic. Signed-off-by: Anton Johansson Reviewed-by: Richard Henderson Message-Id: <20230807155706.9580-4-anjo@rev.ng> Signed-off-by: Richard Henderson --- include/sysemu/kvm.h | 6 ++---- target/arm/kvm64.c | 6 ++---- target/i386/kvm/kvm.c | 8 +++----- target/ppc/kvm.c | 13 ++++++------- target/s390x/kvm/kvm.c | 6 ++---- 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 5670306dbf..19d87b20e8 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -426,10 +426,8 @@ int kvm_arch_insert_sw_breakpoint(CPUState *cpu, struct kvm_sw_breakpoint *bp); int kvm_arch_remove_sw_breakpoint(CPUState *cpu, struct kvm_sw_breakpoint *bp); -int kvm_arch_insert_hw_breakpoint(target_ulong addr, - target_ulong len, int type); -int kvm_arch_remove_hw_breakpoint(target_ulong addr, - target_ulong len, int type); +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type); +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type); void kvm_arch_remove_all_hw_breakpoints(void); void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg); diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 94bbd9661f..4d904a1d11 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -49,8 +49,7 @@ void kvm_arm_init_debug(KVMState *s) return; } -int kvm_arch_insert_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) { switch (type) { case GDB_BREAKPOINT_HW: @@ -65,8 +64,7 @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, } } -int kvm_arch_remove_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) { switch (type) { case GDB_BREAKPOINT_HW: diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index ebfaf3d24c..295228cafb 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -4995,7 +4995,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct kvm_run *run) kvm_rate_limit_on_bus_lock(); } -#ifdef CONFIG_XEN_EMU +#ifdef CONFIG_XEN_EMU /* * If the callback is asserted as a GSI (or PCI INTx) then check if * vcpu_info->evtchn_upcall_pending has been cleared, and deassert @@ -5156,8 +5156,7 @@ static int find_hw_breakpoint(target_ulong addr, int len, int type) return -1; } -int kvm_arch_insert_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) { switch (type) { case GDB_BREAKPOINT_HW: @@ -5197,8 +5196,7 @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, return 0; } -int kvm_arch_remove_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) { int n; diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index a8a935e267..91e73620d3 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1444,15 +1444,15 @@ static int find_hw_watchpoint(target_ulong addr, int *flag) return -1; } -int kvm_arch_insert_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) { - if ((nb_hw_breakpoint + nb_hw_watchpoint) >= ARRAY_SIZE(hw_debug_points)) { + const unsigned breakpoint_index = nb_hw_breakpoint + nb_hw_watchpoint; + if (breakpoint_index >= ARRAY_SIZE(hw_debug_points)) { return -ENOBUFS; } - hw_debug_points[nb_hw_breakpoint + nb_hw_watchpoint].addr = addr; - hw_debug_points[nb_hw_breakpoint + nb_hw_watchpoint].type = type; + hw_debug_points[breakpoint_index].addr = addr; + hw_debug_points[breakpoint_index].type = type; switch (type) { case GDB_BREAKPOINT_HW: @@ -1488,8 +1488,7 @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, return 0; } -int kvm_arch_remove_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) { int n; diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index a9e5880349..1b240fc8de 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -995,8 +995,7 @@ static int insert_hw_breakpoint(target_ulong addr, int len, int type) return 0; } -int kvm_arch_insert_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) { switch (type) { case GDB_BREAKPOINT_HW: @@ -1014,8 +1013,7 @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, return insert_hw_breakpoint(addr, len, type); } -int kvm_arch_remove_hw_breakpoint(target_ulong addr, - target_ulong len, int type) +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) { int size; struct kvm_hw_breakpoint *bp = find_hw_breakpoint(addr, len, type);