From patchwork Tue Dec 4 20:26:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 152850 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp8503324ljp; Tue, 4 Dec 2018 12:29:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/UQ5aR73xkw7pPhh3HXN6VsyAiYprsslRR0xHBf2PIahMRrwhVifqGAs+qRnaPd+szjn9r6 X-Received: by 2002:a81:5744:: with SMTP id l65mr1869233ywb.91.1543955360820; Tue, 04 Dec 2018 12:29:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543955360; cv=none; d=google.com; s=arc-20160816; b=1CKue5L24KulSwYb4U5m8c03o0tIbV3OXGSdDtOYGA71CViaga21DU+7MrjlbtS1xD a4KUHDxAIkhqu0Rdk7YMwv3Ko+c3m02vfPYZ420CUqLHsTo8WRwzuZCBeCnJVm2QT/RQ xRz9ZiJRxMQgB3riQwMNdFStiIokE/X0fKHl8SF1OH6zdnHlE7X6u1R9mItt+MgmJlHh jvSJF3X8XSirmU2fKoz0tZCGDtKFxN0FjdaPqRPxsNbPswJy2n2sBJIFrOG+FADshL4a aVqo8ntRoOnO87kxqLC73jkXJO2d8oKjm6f7mJd60Xamoxj0kPSFwpOD+BlL0RVp3Jd+ GCGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=QwSdEvsEGngWvKE294h9+mdVc7hYn2MX17dbvCGUysU=; b=xUwKl24Nj5R+I8Nu+22dlsEsinHCKjf79oHSAUYNPoXMCh7l5pjFyzaZ8uO7AdOsgV hGAyNgXVGITqRd9UmAiNOG6XS2rOwc0wGv8lSY1htEb2Ffd7jSHGNSn/RW7qzGDRBzIb if6q0YvPimh33UnBJQ+tW0nGq1GIpNBKU16ypoUec1GwmQZIdvfUIvbxvrAHpAo+ZiSe DBHj/ZZiVkenomtI12HLMwO9uiK2LrUnIMUPfrTSw1PQvKBGZrEV0fxzk41/+sMpb5sV P85gWcTzWJksoRRoBNx5JYW8PP5spPGPhj6iJ+dsSqhd9p2v/EQNZI0Oc/r3FTc3hBEd SUKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@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.google.com with ESMTPS id c10-v6si10226516ybm.200.2018.12.04.12.29.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Dec 2018 12:29:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gUHI1-00088K-66; Tue, 04 Dec 2018 20:27:29 +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.89) (envelope-from ) id 1gUHI0-00087r-Be for xen-devel@lists.xenproject.org; Tue, 04 Dec 2018 20:27:28 +0000 X-Inumbo-ID: 040c01d6-f803-11e8-8f66-2710c3a051a6 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 040c01d6-f803-11e8-8f66-2710c3a051a6; Tue, 04 Dec 2018 20:27:27 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06C0515BE; Tue, 4 Dec 2018 12:27:27 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3E4623F614; Tue, 4 Dec 2018 12:27:26 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 4 Dec 2018 20:26:43 +0000 Message-Id: <20181204202651.8836-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181204202651.8836-1-julien.grall@arm.com> References: <20181204202651.8836-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.12 v2 09/17] xen/arm: Rework p2m_cache_flush to take a range [begin, end) 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: Julien Grall , sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The function will be easier to re-use in a follow-up patch if you have only the begin and end. At the same time, rename the function to reflect the change in the prototype. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/domctl.c | 2 +- xen/arch/arm/p2m.c | 3 +-- xen/include/asm-arm/p2m.h | 7 +++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c index 4587c75826..c10f568aad 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -61,7 +61,7 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, if ( e < s ) return -EINVAL; - return p2m_cache_flush(d, _gfn(s), domctl->u.cacheflush.nr_pfns); + return p2m_cache_flush_range(d, _gfn(s), _gfn(e)); } case XEN_DOMCTL_bind_pt_irq: { diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 2706db3e67..836157292c 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1514,10 +1514,9 @@ int relinquish_p2m_mapping(struct domain *d) return rc; } -int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr) +int p2m_cache_flush_range(struct domain *d, gfn_t start, gfn_t end) { struct p2m_domain *p2m = p2m_get_hostp2m(d); - gfn_t end = gfn_add(start, nr); gfn_t next_gfn; p2m_type_t t; unsigned int order; diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 13f7a27c38..5858f97e9c 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -228,8 +228,11 @@ int p2m_set_entry(struct p2m_domain *p2m, bool p2m_resolve_translation_fault(struct domain *d, gfn_t gfn); -/* Clean & invalidate caches corresponding to a region of guest address space */ -int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr); +/* + * Clean & invalidate caches corresponding to a region [start,end) of guest + * address space. + */ +int p2m_cache_flush_range(struct domain *d, gfn_t start, gfn_t end); /* * Map a region in the guest p2m with a specific p2m type.