From nobody Tue Nov 11 15:42:16 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1556658248; cv=none; d=zoho.com; s=zohoarc; b=QKVTYKvfAjKoBVTHVMKLTm6ZZ/f6jAG1DGdBeHN0MoZHX61hnVQ12qFKGFiffR2Q8y8lGa7HBxYHzngoWrWvnxCmtqTjXxnCdr5V6QXSYoUxiRmDo+6pFA9gtpefvJGEZsfsyHC57/9ybfCVeQegG+zWONvTvCdnU7SfUVXRngE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556658248; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=MRNNLr6F+LufpcXyb5Krkvi46dWYNqwAs/YytUGaChg=; b=egeOdDZA+1xZG/8F54r5uIP1A5ab4nwLS8lYq3o0OBBIEw9UyESyu59BmststdYAJ3R+6DAOvR+AWqyK6ARB1wAvqHqtARIHZ5c1scn0K9qX4P4s+qjWnobRwX5D/oV+oKR6KwsuTjRyXDQklJ9MwDMpXEHMx29/3n0smHqBax0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1556658248712843.5897558453368; Tue, 30 Apr 2019 14:04:08 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLZty-0007f6-U3; Tue, 30 Apr 2019 21:02:58 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLZty-0007em-3r for xen-devel@lists.xenproject.org; Tue, 30 Apr 2019 21:02:58 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 54450349-6b8b-11e9-843c-bc764e045a96; Tue, 30 Apr 2019 21:02:57 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 76EB12177B; Tue, 30 Apr 2019 21:02:56 +0000 (UTC) X-Inumbo-ID: 54450349-6b8b-11e9-843c-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556658176; bh=NQUyl3rKiLRTUqRGxZzyFAIOHiSK54kIHSS6xSLVyDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PoPYOHhiR+3jNmcwUSL8eYtb3Yny0nHuyqA0PGlanbrR/PG+JzfbFT471d5tGvAut Nvzve+YZQ7b6hDtXNrGXsdE0bj5jf19Ih/L+SVNo3mTh+skGyF2BJ4Szp2QCosPA2g ril0H8Nj9isc8U+XWqRnlxr/G1+ntTwWIBmFZr60= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 30 Apr 2019 14:02:46 -0700 Message-Id: <1556658172-8824-4-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v2 04/10] libxc: introduce xc_domain_mem_map_policy X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , julien.grall@arm.com, sstabellini@kernel.org, ian.jackson@eu.citrix.com, wei.liu2@citrix.com MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Introduce a new libxc function that makes use of the new memory_policy parameter added to the XEN_DOMCTL_memory_mapping hypercall. The parameter values are the same for the XEN_DOMCTL_memory_mapping hypercall (0 is MEMORY_POLICY_DEFAULT). Pass MEMORY_POLICY_DEFAULT by default -- no changes in behavior. We could extend xc_domain_memory_mapping, but QEMU makes use of it, so it is easier and less disruptive to introduce a new libxc function and change the implementation of xc_domain_memory_mapping to call into it. Signed-off-by: Stefano Stabellini CC: ian.jackson@eu.citrix.com CC: wei.liu2@citrix.com --- Changes in v2: - rename cache_policy to memory policy - rename MEMORY_POLICY_DEVMEM to MEMORY_POLICY_ARM_DEV_nGRE - rename MEMORY_POLICY_MEMORY to MEMORY_POLICY_ARM_MEM_WB - introduce xc_domain_mem_map_policy --- tools/libxc/include/xenctrl.h | 8 ++++++++ tools/libxc/xc_domain.c | 24 ++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 49a6b2a..16ff286 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1714,6 +1714,14 @@ int xc_deassign_dt_device(xc_interface *xch, uint32_t domid, char *path); =20 +int xc_domain_mem_map_policy(xc_interface *xch, + uint32_t domid, + unsigned long first_gfn, + unsigned long first_mfn, + unsigned long nr_mfns, + uint32_t add_mapping, + uint32_t memory_policy); + int xc_domain_memory_mapping(xc_interface *xch, uint32_t domid, unsigned long first_gfn, diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 05d771f..02f5778 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -2042,13 +2042,14 @@ failed: return -1; } =20 -int xc_domain_memory_mapping( +int xc_domain_mem_map_policy( xc_interface *xch, uint32_t domid, unsigned long first_gfn, unsigned long first_mfn, unsigned long nr_mfns, - uint32_t add_mapping) + uint32_t add_mapping, + uint32_t memory_policy) { DECLARE_DOMCTL; xc_dominfo_t info; @@ -2070,6 +2071,7 @@ int xc_domain_memory_mapping( domctl.cmd =3D XEN_DOMCTL_memory_mapping; domctl.domain =3D domid; domctl.u.memory_mapping.add_mapping =3D add_mapping; + domctl.u.memory_mapping.memory_policy =3D memory_policy; max_batch_sz =3D nr_mfns; do { @@ -2105,8 +2107,9 @@ int xc_domain_memory_mapping( * Errors here are ignored. */ if ( ret && add_mapping !=3D DPCI_REMOVE_MAPPING ) - xc_domain_memory_mapping(xch, domid, first_gfn, first_mfn, nr_mfns, - DPCI_REMOVE_MAPPING); + xc_domain_mem_map_policy(xch, domid, first_gfn, first_mfn, nr_mfns, + DPCI_REMOVE_MAPPING, + MEMORY_POLICY_DEFAULT); =20 /* We might get E2BIG so many times that we never advance. */ if ( !done && !ret ) @@ -2115,6 +2118,19 @@ int xc_domain_memory_mapping( return ret; } =20 +int xc_domain_memory_mapping( + xc_interface *xch, + uint32_t domid, + unsigned long first_gfn, + unsigned long first_mfn, + unsigned long nr_mfns, + uint32_t add_mapping) +{ + return xc_domain_mem_map_policy(xch, domid, first_gfn, first_mfn, + nr_mfns, add_mapping, + MEMORY_POLICY_DEFAULT); +} + int xc_domain_ioport_mapping( xc_interface *xch, uint32_t domid, --=20 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel