From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66324C433ED for ; Thu, 6 May 2021 01:42:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D96A2613B4 for ; Thu, 6 May 2021 01:42:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D96A2613B4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leT2H-00047j-LH for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 21:42:41 -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 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" 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 IronPort-SDR: uPhji8wrqNaeZG3Mx15aTG3QoZ6b2xJWQMAzi0YXCWaHM9Oyfz1pgbKWFbHplu9hTt+6w9flb1 uo/VoboerKoA== X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="469220354" 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 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: 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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; }; KVMState *kvm_state; @@ -3157,6 +3159,21 @@ static void kvm_set_kernel_irqchip(Object *obj, Visitor *v, } } +void kvm_setup_memory_region_debug_ops(struct KVMState *s, + set_memory_region_debug_ops new_ops) +{ + if (s) + s->set_mr_debug_ops = 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); bool kvm_arch_cpu_check_are_resettable(void); +typedef void (*set_memory_region_debug_ops)(void *handle, MemoryRegion *mr); +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 -- 2.20.1