From nobody Mon Feb 9 16:47:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1593520559; cv=none; d=zohomail.com; s=zohoarc; b=BDybpZ6SL5lgxo6wIsSoasAi1cqmjDgG3PqUBoqX+pvlhC6IptR7ld1ZnIsArGyYZFEjZi70kITmFXtyGS54wgOufN6lZL75JwVRJlluiAjoknkaRIcnjyjNecEs2xfQzB2cWupLxeErRnzKs1o1C5F8K+Gvg7es8xgUHpduxiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593520559; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=WYkL/ySN0BLrd/MNAFoCyBnFqbTvsDBkT6b7W9atg9c=; b=jmyNrMuf2M78QvBWZAI+BJhrTqEPcIEYZfQoJc8ntZBLPOaJvU9umamzP+/au9rTIAB6At2V+4r7fqP6GJSnXM617QcchNswU3cdTeZaw5vEUCUArO3I1p79l9NF6i9g3HsjnQkWOqXC09uq+0bLTBiDbdxwzLdoUeSupr7x8jk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1593520559941505.8252488376477; Tue, 30 Jun 2020 05:35:59 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jqFUJ-00086Z-9d; Tue, 30 Jun 2020 12:35:47 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jqFUH-00084u-6R for xen-devel@lists.xenproject.org; Tue, 30 Jun 2020 12:35:45 +0000 Received: from bagnar.nask.net.pl (unknown [195.187.242.196]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 36959ab0-bace-11ea-8610-12813bfff9fa; Tue, 30 Jun 2020 12:35:43 +0000 (UTC) Received: from bagnar.nask.net.pl (unknown [172.16.9.10]) by bagnar.nask.net.pl (Postfix) with ESMTP id A9886A3800; Tue, 30 Jun 2020 14:35:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id A711FA3802; Tue, 30 Jun 2020 14:35:41 +0200 (CEST) Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id JziU2kPEFnPj; Tue, 30 Jun 2020 14:35:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id 3D95EA37FE; Tue, 30 Jun 2020 14:35:41 +0200 (CEST) Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0-sn10WueO7f; Tue, 30 Jun 2020 14:35:41 +0200 (CEST) Received: from belindir.nask.net.pl (belindir-ext.nask.net.pl [195.187.242.210]) by bagnar.nask.net.pl (Postfix) with ESMTP id 1A422A37F8; Tue, 30 Jun 2020 14:35:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id 016AA223C3; Tue, 30 Jun 2020 14:34:46 +0200 (CEST) Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id vlc-Ku5jd70r; Tue, 30 Jun 2020 14:34:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id 94DB822591; Tue, 30 Jun 2020 14:34:40 +0200 (CEST) Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id gWn4M7wYhlp7; Tue, 30 Jun 2020 14:34:40 +0200 (CEST) Received: from mq-desktop.cert.pl (unknown [195.187.238.217]) by belindir.nask.net.pl (Postfix) with ESMTPSA id 72A7622564; Tue, 30 Jun 2020 14:34:40 +0200 (CEST) X-Inumbo-ID: 36959ab0-bace-11ea-8610-12813bfff9fa X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Virus-Scanned: amavisd-new at bagnar.nask.net.pl X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Quarantine-ID: X-Virus-Scanned: amavisd-new at belindir.nask.net.pl X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: =?UTF-8?q?Micha=C5=82=20Leszczy=C5=84ski?= To: xen-devel@lists.xenproject.org Subject: [PATCH v4 07/10] x86/mm: add vmtrace_buf resource type Date: Tue, 30 Jun 2020 14:33:50 +0200 Message-Id: <2446caa5be5eca36f0b5ca47d2edcbd6f7792484.1593519420.git.michal.leszczynski@cert.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini , tamas.lengyel@intel.com, Wei Liu , Andrew Cooper , Michal Leszczynski , Ian Jackson , George Dunlap , Jan Beulich , luwei.kang@intel.com, =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michal Leszczynski Allow to map processor trace buffer using acquire_resource(). Signed-off-by: Michal Leszczynski --- xen/arch/x86/mm.c | 25 +++++++++++++++++++++++++ xen/include/public/memory.h | 1 + 2 files changed, 26 insertions(+) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index e376fc7e8f..bb781bd90c 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4624,6 +4624,31 @@ int arch_acquire_resource(struct domain *d, unsigned= int type, } break; } + + case XENMEM_resource_vmtrace_buf: + { + mfn_t mfn; + unsigned int i; + struct vcpu *v =3D domain_vcpu(d, id); + rc =3D -EINVAL; + + if ( !v ) + break; + + if ( !v->arch.vmtrace.pt_buf ) + break; + + mfn =3D page_to_mfn(v->arch.vmtrace.pt_buf); + + if ( frame + nr_frames > (v->domain->vmtrace_pt_size >> PAGE_SHIFT= ) ) + break; + + rc =3D 0; + for ( i =3D 0; i < nr_frames; i++ ) + mfn_list[i] =3D mfn_x(mfn_add(mfn, frame + i)); + + break; + } #endif =20 default: diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h index dbd35305df..f823c784c3 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h @@ -620,6 +620,7 @@ struct xen_mem_acquire_resource { =20 #define XENMEM_resource_ioreq_server 0 #define XENMEM_resource_grant_table 1 +#define XENMEM_resource_vmtrace_buf 2 =20 /* * IN - a type-specific resource identifier, which must be zero --=20 2.20.1