Received: by 2002:a17:906:b2c6:b0:930:eaf4:5c09 with SMTP id cf6csp2764301ejb; Tue, 28 Mar 2023 09:02:27 -0700 (PDT) X-Received: by 2002:a7b:c00f:0:b0:3eb:3945:d3fd with SMTP id c15-20020a7bc00f000000b003eb3945d3fdmr12550629wmb.14.1680019347105; Tue, 28 Mar 2023 09:02:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680019347; cv=none; d=google.com; s=arc-20160816; b=BG6aGDXiiRdsrRAMx1a3frMmLgpOiWBOKTTcUxeTymVopBwZ07rOyY/tHmRFmyjSQD nMCYSLRucGO9OWudLMUq8kM8cmFeHlOEWyS27GUz1VBjAo0i8ZVBJuuzdktZw5E3u56N ykFsvGTB7ctMkxQImFATFODeU1N8lPTasLCHXewy22FfOYdpnpN8aqNL8hUHNqtyWSJg NEnG4fs7AOT/LzOFL7WLkrperCOwekIna9IgRJOnQFpMQFXACngtlYxDEtF6fmD+TWOH 82VJRksuDvlYBm7tdsR4t5UqC2bMTzwt8hJNnvFy28WEVTh37CeU92buUdtvInRwZ0M7 xUHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=6MbnN+0f617dsehwYtlh7IWt8dwxE1cjBMBOmowF/jo=; b=hG3gXhn0bPUwJOIrRNYomRT+Qpqcb72BsNk4UPYo9dVjBGUX5unCHCziEI1hsGaP3Z fnBBLRe1Ak4cLJWTrAgCCfwQwiBUA16Be3c8qpwZWzLTrvvpgBRwKJ/jPm9vI4B761um t+TKGbNqVNQ9QtZxf6b6SNoBgKmz6XqjXdkCwq8M5EMTjxj0Xba/FqA6VFvQ6qT4gDQJ YdaH07g5vS/lbXyG6JHFE9Hr4vgoUgbK0bhuwy5OWchiWFIQJBlysXmhmIL5A1BD6sL6 mLNYVuH0dRQR0jNOPWFxSc6Rteia4mmsE+GVDubP/EI9T9EM0CvGG76UvL8tMDl9W5uh J11g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJZ0iiE8; spf=pass (google.com: domain of philmd@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=philmd@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id o5-20020adfe805000000b002c55870b58esor12342791wrm.30.2023.03.28.09.02.27 for (Google Transport Security); Tue, 28 Mar 2023 09:02:27 -0700 (PDT) Received-SPF: pass (google.com: domain of philmd@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJZ0iiE8; spf=pass (google.com: domain of philmd@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=philmd@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680019347; 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=6MbnN+0f617dsehwYtlh7IWt8dwxE1cjBMBOmowF/jo=; b=VJZ0iiE81gahmAHh33wdnxu9f+fm7PWswjCh7eESenZk4qw+MBxuSDrdCRJA0VrjEI +C7aKvPD13wY3jABL63HkqOa9uMkiu9Mbn2+aR07oiNg+xMVJQrsjvj4hLMsKVcydEBY nwiqU5BDc6N6afTuF03JZqD8tCyzkYo3IEfdUUPofFV4GZMfjkRzf6rM6AHXt6J9wY2r HMQigzyW+2RXu4nay6XAGfMfQXkEWxNc2j8yR2sEAbCMcg6+rBtCdJvepi60ZidtWN9n c0gEDCsuxeLXDQAbKpXAHz6BYiGfYjVotey3OfXSQsTFqFBrXE/2h/6xbGPnvH2z/hHT 0Cpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680019347; 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=6MbnN+0f617dsehwYtlh7IWt8dwxE1cjBMBOmowF/jo=; b=qM3NnVGVp0kGzQMlwJnMM+fuXPpf8LAonesLzNAkBydcfwumVou+UkKuXaO8fS6jC2 15kq6LsB59U7QncpeoJsMnJI4SYqVCuh+VU/BkKE8Z1MHXAIrsL/p9rzOfn8uWvmM3t+ al2l3AMDO42BZ5hcSJZn6UB311eegbyN58wOxKAVHhXHT5FWf4uEH9krt+p+kmUy5Odl fVCyN4142VKTHpja5NTHCtCKa3uSCba1/gD4uSL1+ucDqWfrMQ2rb+awt5kUoWCLiqjZ ooGEaT90lH/6/RVdO+FtbCzcfF/Yd0t6NfZ5m+K9CtuK0CIF2WqtCTHpSsEpC37UnXu8 0/Ug== X-Gm-Message-State: AAQBX9dIfrOUD7ASvAbT25mnJEq5fmFRvcrqh8Q+Zn+oDlgRTSL+rmi3 O1UyHpIY6q0edhxu9FK0H/tWIJ1l X-Google-Smtp-Source: AKy350ZFQOfZ6NGkv37Y8Zyt4NAfhytXhLygwXOKe3bf5X+CGLXdwq0Za3H95yZDpyNDB1L/YK+wcg== X-Received: by 2002:adf:f4c2:0:b0:2ce:ad40:7705 with SMTP id h2-20020adff4c2000000b002cead407705mr13934370wrp.25.1680019346740; Tue, 28 Mar 2023 09:02:26 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([176.187.210.212]) by smtp.gmail.com with ESMTPSA id f11-20020a5d4dcb000000b002cfe3f842c8sm27713200wru.56.2023.03.28.09.02.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 Mar 2023 09:02:26 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , kvm@vger.kernel.org, qemu-s390x@nongnu.org, Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Paolo Bonzini , Greg Kurz , Christian Borntraeger , Thomas Huth , Peter Maydell , Richard Henderson , Ilya Leoshkevich , Halil Pasic , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Daniel Henrique Barboza , David Gibson , Yanan Wang , qemu-ppc@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.0 3/3] softmmu: Restore use of CPU watchpoint for all accelerators Date: Tue, 28 Mar 2023 18:02:03 +0200 Message-Id: <20230328160203.13510-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230328160203.13510-1-philmd@linaro.org> References: <20230328160203.13510-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TUID: AQouwHzrfI3I CPU watchpoints can be use by non-TCG accelerators. KVM uses them: $ git grep CPUWatchpoint|fgrep kvm target/arm/kvm64.c:1558: CPUWatchpoint *wp = find_hw_watchpoint(cs, debug_exit->far); target/i386/kvm/kvm.c:5216:static CPUWatchpoint hw_watchpoint; target/ppc/kvm.c:443:static CPUWatchpoint hw_watchpoint; target/s390x/kvm/kvm.c:139:static CPUWatchpoint hw_watchpoint; See for example commit e4482ab7e3 ("target-arm: kvm - add support for HW assisted debug"): This adds basic support for HW assisted debug. The ioctl interface to KVM allows us to pass an implementation defined number of break and watch point registers. [...] This partially reverts commit 2609ec2868e6c286e755a73b4504714a0296a. Fixes: 2609ec2868 ("softmmu: Extract watchpoint API from physmem.c") Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 2 +- softmmu/watchpoint.c | 4 ++++ softmmu/meson.build | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index ce312745d5..397fd3ac68 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -949,7 +949,7 @@ static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask) return false; } -#if !defined(CONFIG_TCG) || defined(CONFIG_USER_ONLY) +#if defined(CONFIG_USER_ONLY) static inline int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, int flags, CPUWatchpoint **watchpoint) { diff --git a/softmmu/watchpoint.c b/softmmu/watchpoint.c index 9d6ae68499..5350163385 100644 --- a/softmmu/watchpoint.c +++ b/softmmu/watchpoint.c @@ -104,6 +104,8 @@ void cpu_watchpoint_remove_all(CPUState *cpu, int mask) } } +#ifdef CONFIG_TCG + /* * Return true if this watchpoint address matches the specified * access (ie the address range covered by the watchpoint overlaps @@ -220,3 +222,5 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, } } } + +#endif /* CONFIG_TCG */ diff --git a/softmmu/meson.build b/softmmu/meson.build index 0180577517..1a7c7ac089 100644 --- a/softmmu/meson.build +++ b/softmmu/meson.build @@ -5,11 +5,11 @@ specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files( 'physmem.c', 'qtest.c', 'dirtylimit.c', + 'watchpoint.c', )]) specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: [files( 'icount.c', - 'watchpoint.c', )]) softmmu_ss.add(files( -- 2.38.1