From patchwork Thu Nov 23 18:32:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 119530 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp1172916edl; Thu, 23 Nov 2017 10:34:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMYcF7ZM9irCy/MOHr6a+yKlOt1CsygZpGOjUcChy8VsG9SWYWuklMNgUyNhx2Y0UY/r0h3S X-Received: by 10.36.120.135 with SMTP id p129mr12625546itc.87.1511462050272; Thu, 23 Nov 2017 10:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511462050; cv=none; d=google.com; s=arc-20160816; b=YTsJji2Fz5dWT7co+/WeM8v0j1a1ktHp9H26zvIHI+Wbayhm2Kf2Ldv3soMD3tRMo3 w/qd2CQLHUsGDOW79E6+HRwt0fiwjk1LkgIORqiObeRjbhp8O6k8qOTMBnKIJShbKVMZ 9wBbmAFZFxpZVr0CibjByXouEnW2xy7Bgb5bVfy3yhbs8wT9dpenXMkqAOUljiKwJw+h Y+zKoSTdG00yagEG6d0FpYL0J4KCO426BnDc2D+a5zDFKJXeRR87+EPnvPyoyK5wkGeN uFeLWWlCBOXKMMK5m7Ib+OmZ1M0HbwhvZwU6eCpWKzjdX1B0tGetmovbikqGRBhIRkhd TayA== 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=UbB/1+UYoyINc4hngC1h+fX3asi2q+zDVEyMnN4CwQE=; b=qEwgQs0PVAnedRnNChfxE9BntjNJEbw0O4+gignzF+sQjhck53MENIHbQnp4+OLot9 88bz/aGrhsPTYX6mQwuTvNZ2wt8nFYxDEugc2YOICSe3zh48xl3c0wuXLp8JniQ2lWK2 QUHHoRvW5qR146X6rBUdYxxS0I/VEcWsnzt5T1WeUz83AFg8X3nwAz5/gpqCOGalG1fp 5rrkxxgr7O+1GGXDBqRIOx8yjl8aSeBVcnfX6OvZb3oFtLzqhH34jpyLebBKl33Q4bSm mkqgNXGxBlsZw0vpG1r2Xh5xh6U4Upaj68+AG2rK6UzcVVY1wzWpG8DsAtweNl1RVFjI MQxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LSO5tKDn; 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 f32si15821931iod.248.2017.11.23.10.34.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 10:34:10 -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=LSO5tKDn; 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 1eHwIS-0005Ea-NN; Thu, 23 Nov 2017 18:32:24 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHwIR-0005CO-JV for xen-devel@lists.xen.org; Thu, 23 Nov 2017 18:32:23 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id EC/6E-20254-634171A5; Thu, 23 Nov 2017 18:32:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRWlGSWpSXmKPExsXiVRvkomsmIh5 l0PVVymLJx8UsDoweR3f/ZgpgjGLNzEvKr0hgzTixaA5zwUeBip7dC9kbGP9xdzFycQgJTGSU ONXXzAzisAjMY5bYcLuVHcSREOhnlVj6+R5TFyMnkJMn0XrtLiuEnSbx42gXUAcHkF0hMWETI 4gpJKAmseZNFMTQPiaJJVMOsoDE2QR0JNbNqAXpFBGQlrj2+TIjiM0sEC/xeOp1NhBbWCBI4u SqL2ATWQRUJW40ZIKEeQVsJH48WcAIsVReYlfbRbADOAVsJY4e+MAMsdVG4vNnxQmMggsYGVY xahSnFpWlFukamuklFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQmFesl5+duYgSGGgMQ7GCc+j7u EKMkB5OSKK/ML7EoIb6k/JTKjMTijPii0pzU4kOMMhwcShK8fcLiUUKCRanpqRVpmTnAoIdJS 3DwKInwLgFJ8xYXJOYWZ6ZDpE4xWnLs23PrDxPHs5mvG5g5pl1tbWIWYsnLz0uVEuf1BGkQAG nIKM2DGweLzEuMslLCvIxABwrxFKQW5WaWoMq/YhTnYFQS5l0MMoUnM68EbusroIOYgA76eVw Y5KCSRISUVAMjQzQHcwjbRpVJd+SjOyMFl2YvXsH8fctRbjPP7lUuP7PNTuv/Nw0W3/LhZoew h1Mo1zWFTXfU7WaKbLxwftnrbfHxUfvmBtQs5Nuyf9UvK2thVb/IQ0tuW6esXBpgYypo9291X dDtTUtOnf663PJapNoSFnnOn7terph+L2FfgzGP6a6bP45fUGIpzkg01GIuKk4EANEEUpfHAg AA X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-9.tower-206.messagelabs.com!1511461942!108664476!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54156 invoked from network); 23 Nov 2017 18:32:22 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-9.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 23 Nov 2017 18:32:22 -0000 Received: by mail-wm0-f68.google.com with SMTP id x63so18278293wmf.4 for ; Thu, 23 Nov 2017 10:32:22 -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=KWIl5fS94/S1+VaJSGlsGIK86ijHSyRIXcY0HJcjrXM=; b=LSO5tKDnDY+9Bu66oxKQEKNb1RcfM4ErcWeuxL1gigbIAVeNGOxNi4J3FhhyZTMQxC 3SClesQnj8RjotpmLRmnGRvImQu4UoTRdJzlDIUTEfgCZcClKTyUlHw8XQIX4SGiwe+K iFiOjnhLbVcgt7YyML2LXnWS3aRSq3N7NHN6U= 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=KWIl5fS94/S1+VaJSGlsGIK86ijHSyRIXcY0HJcjrXM=; b=it6+QZxhJ7ppA5IkxNWENSFft06jfnFEKxX1st58BwNpKCvw56E0XQ/OKUyALJfu5g tugMggXhMCBhzkXlE7+FHo4bjGp1mCK7DXvxuGNlY8jzhKmVnlPaah5i0F0yKjCIgpLj 8MRvUXSjrvw4+PhrxfFdNGv1gxc4bE1HTPsQCBTY+FvUCvQawhuFy0b+d2wkSyp0gUYM 7fnLKkDnr8Ko/797fd0bMdwqzRARn7rsHvjS5Odn7UGZiMCxwIpZKuc62xU+4lvGd/tK 5CMvlRMYu4gFx6KVoThD9zMCk3h+s+QyNVLG+i0w8a1uzTuU7GEULVceh+c/FpTTFb7t RFGg== X-Gm-Message-State: AJaThX5vituXSBf+2NOPc37ndeHLjJy/L2fR/pqUGc4AIOL88w/GUltO iIqNZiI3IYyJySPAl+/6kNSS41rucGA= X-Received: by 10.28.14.195 with SMTP id 186mr7612245wmo.56.1511461941829; Thu, 23 Nov 2017 10:32:21 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id n32sm41412950wrb.62.2017.11.23.10.32.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 10:32:21 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 23 Nov 2017 18:32:01 +0000 Message-Id: <20171123183210.12045-8-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171123183210.12045-1-julien.grall@linaro.org> References: <20171123183210.12045-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall , andre.przywara@linaro.org Subject: [Xen-devel] [PATCH for-next 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 --- xen/arch/arm/guestcopy.c | 10 ++++++++++ xen/include/asm-arm/guest_access.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index be53bee559..7958663970 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -110,6 +110,16 @@ 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) +{ + /* P2M is shared between all vCPUs, so the vCPU used does not matter. */ + return copy_guest(buf, gpa, len, d->vcpu[0], + 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);