From nobody Mon Feb 9 06:01:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1620265366; cv=none; d=zohomail.com; s=zohoarc; b=CTijldTcDu4xPP0yxzdbsuIEa0K7nwWSWYPVwSFSBKP/WcBmpzs7CTjjtK+7Wqfw6kMATI8B/9RodZYmhT4oOzRm+Mg+0ITOUXfq8ESdZuo1JeVyhg95x22bNnimadoHi23sdpYDRkbv4TvmSdhG33KQ0WTLYiQMJH3zJieH+ok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620265366; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=jKb8kJRssXHWn4XK7UUXT6Jj0s8ZvaIVbFqyStI0rCs=; b=jRcPevbt2HUdxVOzq4NgT07Ek9VJf1GYhwG1N92G6WbipBSeyvqK718C5XHSjsEFOZCnJJQDOw1gRM1X68D3g1URAD325RHElGI9d9uCyjRpGa3jr5yQ4WrO7kFQqk5QZvr+5tarzK9s3ykSdkU/MPPGOg32FhmWZ5OLKvYMT00= ARC-Authentication-Results: i=1; mx.zohomail.com; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620265366510203.37055029102305; Wed, 5 May 2021 18:42:46 -0700 (PDT) Received: from localhost ([::1]:48040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leT2L-00047j-FN for importer@patchew.org; Wed, 05 May 2021 21:42:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leT0t-0002es-NX for qemu-devel@nongnu.org; Wed, 05 May 2021 21:41:15 -0400 Received: from mga17.intel.com ([192.55.52.151]:23057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leT0s-0007bf-1H for qemu-devel@nongnu.org; Wed, 05 May 2021 21:41:15 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2021 18:41:08 -0700 Received: from yy-desk-7060.sh.intel.com ([10.239.159.38]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2021 18:41:05 -0700 IronPort-SDR: FIKyKMEbJQ6FY21/bgKVPp3ImoT2ScTtOlU13kmhdr1vgXzkUpO81Agm2F++QJWPj/Zq9i/SKq Jx5SuBxo9KSw== X-IronPort-AV: E=McAfee;i="6200,9189,9975"; a="178579138" X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="178579138" IronPort-SDR: uPhji8wrqNaeZG3Mx15aTG3QoZ6b2xJWQMAzi0YXCWaHM9Oyfz1pgbKWFbHplu9hTt+6w9flb1 uo/VoboerKoA== X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="469220354" From: Yuan Yao To: pbonzini@redhat.com Subject: [RFC][PATCH v1 03/10] Introduce new interface KVMState::set_mr_debug_ops and its wrapper Date: Thu, 6 May 2021 09:40:30 +0800 Message-Id: <20210506014037.11982-4-yuan.yao@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210506014037.11982-1-yuan.yao@linux.intel.com> References: <20210506014037.11982-1-yuan.yao@linux.intel.com> 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: none client-ip=192.55.52.151; envelope-from=yuan.yao@linux.intel.com; helo=mga17.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: isaku.yamahata@intel.com, Thomas.Lendacky@amd.com, ashish.kalra@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, yuan.yao@intel.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Yuan Yao This interface is designed to setup the MemoryRegion::debug_ops. Also introduced 2 wrapper functions for installing/calling the KVMState::set_mr_debug_ops from different targets easily. Signed-off-by: Yuan Yao diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index b6d5c9fd7d..1482561bd7 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -129,6 +129,8 @@ struct KVMState KVMMemoryListener *ml; AddressSpace *as; } *as; + + set_memory_region_debug_ops set_mr_debug_ops; }; =20 KVMState *kvm_state; @@ -3157,6 +3159,21 @@ static void kvm_set_kernel_irqchip(Object *obj, Visi= tor *v, } } =20 +void kvm_setup_memory_region_debug_ops(struct KVMState *s, + set_memory_region_debug_ops new_ops) +{ + if (s) + s->set_mr_debug_ops =3D new_ops; +} + +void kvm_set_memory_region_debug_ops(void *handle, MemoryRegion *mr) +{ + if (!kvm_state || !kvm_state->set_mr_debug_ops) + return; + + kvm_state->set_mr_debug_ops(handle, mr); +} + bool kvm_kernel_irqchip_allowed(void) { return kvm_state->kernel_irqchip_allowed; diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c index 0f17acfac0..f1c57ad8d7 100644 --- a/accel/stubs/kvm-stub.c +++ b/accel/stubs/kvm-stub.c @@ -148,4 +148,15 @@ bool kvm_arm_supports_user_irq(void) { return false; } + +void kvm_setup_memory_region_debug_ops(struct KVMState *s, + set_memory_region_debug_ops new_ops) +{ + +} + +void kvm_set_memory_region_debug_ops(void *handle, MemoryRegion *mr) +{ + +} #endif diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index a1ab1ee12d..64685cad57 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -547,4 +547,9 @@ bool kvm_cpu_check_are_resettable(void); =20 bool kvm_arch_cpu_check_are_resettable(void); =20 +typedef void (*set_memory_region_debug_ops)(void *handle, MemoryRegion *mr= ); +void kvm_setup_memory_region_debug_ops(struct KVMState *s, set_memory_regi= on_debug_ops new_ops); + +void kvm_set_memory_region_debug_ops(void *handle, MemoryRegion *mr); + #endif --=20 2.20.1