From patchwork Mon Oct 8 18:33:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 148435 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3982221lji; Mon, 8 Oct 2018 11:36:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV60WlvpO1zamULPBvMCqUboX7gg9xUNu0V9cs6+c+KUwBXYMVQ5XzU0IIv2TpO/OGxg0uEG2 X-Received: by 2002:a6b:c652:: with SMTP id w79-v6mr15466501iof.142.1539023784492; Mon, 08 Oct 2018 11:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539023784; cv=none; d=google.com; s=arc-20160816; b=bCBK+58rYQQxr+Ythqg1wPfu7mFLv+Rew5wJHYaza7XKmt/RCL/y2jWrvpTj+iJm+V XNegkFCqon0E9ZNC/V6YkekaP+eoa8RZR7kuR8XDf2zPsQZqgmugcjjbFY/HLSeaZNZo XPXRYdFVd643cupSXPDYK5sJ5ASsFv+EqEItX/ZPr6zmy/C63vlEwxBzGfJGsPOrVyic 0BN99sH/Cc909ia7kge6wjWhcfOJYaokgsX4rM8LNSf4qQcc7hTti0S4FVMw0E5Izful mTbnXkVbuLSoC3xb97ZPmMBAOID7cp3FUJ3zBiis8G4JV9X7ayJh4DS7sml/xEhetz/+ 4n/A== 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=LtS3/z8S8W+LSOXIDJxIzaxHGiuiR+B/JeNTGciDr3A=; b=mzE6YqKWHNuxfhmaufIjMACGdplw4wXz9Xzysy9TpwuQHo5LDhP6+RZydKhPMElRn+ tmXW3N22X4SdeFAUzDfSolDEsPODdaIVXgbV+QvSRCMu2DGQHhpk+LciaYGOpp7yA0Qr aq3BAHeB6HMrD/j0k40vJeCbCPiHsOiM7u3ZgWLkpNC6uxF4lC74TMAX1wsNPtVqMFhy GPKw3CS9VuS5+5s9hr5NW3CRwfWgKMj0Q9cT0IAe/jpIvrkTKloMoVjYXQxZ0vPov33p WaM8JROD87egwswxXru5lIe4USrp5xkP6vyguxvEucdvY7Q9msK7omM0OeSo9r+o8HV3 r7hQ== 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 u9-v6si9127322iof.127.2018.10.08.11.36.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Oct 2018 11:36:24 -0700 (PDT) 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 1g9aMD-0005mw-OG; Mon, 08 Oct 2018 18:34:17 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1g9aMC-0005li-E2 for xen-devel@lists.xen.org; Mon, 08 Oct 2018 18:34:16 +0000 X-Inumbo-ID: 67d9cc9d-cb28-11e8-a8a5-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 67d9cc9d-cb28-11e8-a8a5-bc764e045a96; Mon, 08 Oct 2018 20:31:43 +0200 (CEST) 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 03EE2ED1; Mon, 8 Oct 2018 11:34:15 -0700 (PDT) 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 19F043F5B3; Mon, 8 Oct 2018 11:34:13 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 8 Oct 2018 19:33:48 +0100 Message-Id: <20181008183352.16291-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181008183352.16291-1-julien.grall@arm.com> References: <20181008183352.16291-1-julien.grall@arm.com> Subject: [Xen-devel] [RFC 12/16] 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, andre.przywara@linaro.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 --- 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 af445d3313..8537b7bab1 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1507,10 +1507,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 c03557544a..d7afa2bbe8 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -224,8 +224,11 @@ int p2m_set_entry(struct p2m_domain *p2m, p2m_type_t t, p2m_access_t a); -/* 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.