From patchwork Tue Dec 12 19:02:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 121640 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4508608qgn; Tue, 12 Dec 2017 11:04:39 -0800 (PST) X-Google-Smtp-Source: ACJfBovOkwoSthvcJjsZhdoUqP+WBoCF9gLFqO1xegxBQjYIr6uWYupVxxhuNx9VNMBfQzw2nGC+ X-Received: by 10.107.173.70 with SMTP id w67mr6811275ioe.246.1513105479723; Tue, 12 Dec 2017 11:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513105479; cv=none; d=google.com; s=arc-20160816; b=M9qA2EGXEtOHdGPf20DUNf5butaf3vJOYGXOJVbN+HcNSokCZYK0Cm99gRVKS/Lb+r Hub9JLYt0vPyZPkcP8ZQuZTG6MmU73WQ+wFZiEsqcxLrtP31BYCspU+V9aB4nRN9s/xX jkNhF+YXsGLlhYpKkxJlxrooN8yRmQWjXtbsqaZNa56T2nLAVwNVopYpX5UImVy422H3 yj3+BtJXtfessItWKl7RdyoWUcTHHHocCQzoTpHRxV0VMdwjaTeHAMUHX1mjHLOSh8ur r/ocCTRiZYhDWClgT8SlY1ptyAJnM73KaB/KNGRX4mdu9tunwZPfGcqy8KjztY3Ij14n PgcA== 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 :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=1aaD9qnLb0LYG5CpaP/C6CPO+IoMf2VAru40ykpMbmw=; b=jMrvEcckH1tbBBrgS/OTtpUuf1I22AK0iTc0zOTnben/FlGJRISfrNIZggkBqT3Rws Ihha+Yl7QNJe2gBNZXGfLo9wsFZnPheVj92zKqvaubQC6HEzCm5wPlujynSQIRlYSCp2 NeagfRu+OdmmrGfHPT4PoNpZTRXdP6t2UVR5nIn6qrban3lGm7SwjMtxJ1+pGe+qKcG4 yOqHaDQlkNxhVdtDCkTaxyKBFpnnB9S/iD52rnHF6H6ExNvS5NsH9qEzDyRXgXQWX1K9 dAA+7dtqZsboLM9bUWSZJkFFxgRshCLKXpNsjHupe80Ak/LH8EqJfCnWaDsO5I6FEUP0 T2bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jAJb/sUR; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id s31si12505760ioi.146.2017.12.12.11.04.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:04:39 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jAJb/sUR; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOpp3-0002WY-Do; Tue, 12 Dec 2017 19:02:33 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOpp2-0002VI-8U for xen-devel@lists.xen.org; Tue, 12 Dec 2017 19:02:32 +0000 X-Inumbo-ID: eddb1c6a-df6e-11e7-b4a6-bc764e045a96 Received: from mail-wm0-x243.google.com (unknown [2a00:1450:400c:c09::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id eddb1c6a-df6e-11e7-b4a6-bc764e045a96; Tue, 12 Dec 2017 20:01:59 +0100 (CET) Received: by mail-wm0-x243.google.com with SMTP id r78so652083wme.5 for ; Tue, 12 Dec 2017 11:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MyFwm1Ppczs1NIORYl7fjDlL6EedtAlEclHWy3YKWVU=; b=jAJb/sUR/TFo+YiZ+5wCEqhoBEob9c0FSnho+M+zxrGKyxefre9OGb24o2sOjll8Om bjNO8l6zgejdz9jN1iYWQEo2akIffGnzio53HBrtPLzz1epMYFLo8HAj9nLGHza8ZfPM jjRQb7PcU8WbjB2OF5iL+ZX0H4ntMBySJ/WbY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MyFwm1Ppczs1NIORYl7fjDlL6EedtAlEclHWy3YKWVU=; b=MeaCQDPqzm6+IFzQOBHA2Ncg/GziDlC7ERfW/ynGDDb7zeDQKnENwIllf/oPGS8d2J NDERKeW6jwx3DhK8nvGPVbz+6xjIdniOaRtZFC9DB84tRNY2Bq8r/8/Dp4ioeI/LEW6W LXEZHTqEhehhvGv/I+bkJUebRpVa4AsTe7UZSAM6iCHVqwLd2Wq4RtT+y9efQISchmEB wYr1i69vKi/LphzfmrOLTg9lbQAEuSdId5udPN4ipzuhLzEmlAbwFcQpGWO8m2UvVTpD 9AHq8P2fPjSu4w0nKSPHuUA0Yc6k6IrkaXaTOcENSE2GDIW2fgLSjrS3TlPWwfk7xxdM 1cOg== X-Gm-Message-State: AKGB3mIgxkzWEwHQIyagxYZzEZOqXGu71hbP2iaqNrXE2DFiKkCmqd/Z UWyo5jGS2YlLzc4JZQV3U9dMyLuovZU= X-Received: by 10.28.138.75 with SMTP id m72mr2808006wmd.97.1513105350004; Tue, 12 Dec 2017 11:02:30 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id n14sm207508wmh.37.2017.12.12.11.02.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:02:29 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Dec 2017 19:02:03 +0000 Message-Id: <20171212190212.5535-8-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171212190212.5535-1-julien.grall@linaro.org> References: <20171212190212.5535-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall , andre.przywara@linaro.org Subject: [Xen-devel] [v2 07/16] xen/arm: Introduce copy_to_guest_phys_flush_dcache X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This new function will be used in a follow-up patch to copy data to the guest using the IPA (aka guest physical address) and then clean the cache. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Use the new interface --- xen/arch/arm/guestcopy.c | 9 +++++++++ xen/include/asm-arm/guest_access.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 93e4aa2d3f..7a0f3e9d5f 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -130,6 +130,15 @@ unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned le COPY_from_guest | COPY_linear); } +unsigned long copy_to_guest_phys_flush_dcache(struct domain *d, + paddr_t gpa, + void *buf, + unsigned int len) +{ + return copy_guest(buf, gpa, len, GPA_INFO(d), + COPY_to_guest | COPY_ipa | COPY_flush_dcache); +} + int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf, uint32_t size, bool is_write) { diff --git a/xen/include/asm-arm/guest_access.h b/xen/include/asm-arm/guest_access.h index 6796801cfe..224d2a033b 100644 --- a/xen/include/asm-arm/guest_access.h +++ b/xen/include/asm-arm/guest_access.h @@ -11,6 +11,12 @@ unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from, unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len); unsigned long raw_clear_guest(void *to, unsigned len); +/* Copy data to guest physical address, then clean the region. */ +unsigned long copy_to_guest_phys_flush_dcache(struct domain *d, + paddr_t phys, + void *buf, + unsigned int len); + int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf, uint32_t size, bool is_write);