From patchwork Tue Dec 12 19:01:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 121637 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4508566qgn; Tue, 12 Dec 2017 11:04:38 -0800 (PST) X-Google-Smtp-Source: ACJfBot3RYkfxp47RgPAcztje9ush8tT7r2kn3evFYZ8f2eh++oc8SMSW7UTqVszwpmvDi3ir+hF X-Received: by 10.36.13.141 with SMTP id 135mr868699itx.1.1513105478389; Tue, 12 Dec 2017 11:04:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513105478; cv=none; d=google.com; s=arc-20160816; b=Yj3tfTA4N1RJz6qtHjxk+onhjNTchSisyAgQNrgT5rraK15TLxkwVrntUV78gcNHpH snx9l8A6/MYXXIySQKJeHoNBIK7t8ubRsXOW6lcBwG97IfuU3SLtoV+kclXnf5zz5iG/ xYXGcFlnlPwh+tkZ1mDqt/OFnJC1cTYRMfa4xFikhzWVRhlcnnwm/3Y10qNiGEb912+T LjBt/lXlXxrp3KsP5YHqx2dROlbPqiuUeg0RwMfVvwwOV4JhfS64fXzreaq+HOCjz4EB l1DUle7xaTNDBH9h+o8ex6hvZ3hhm2AeZ7V+NEjkIm8aAu8Cg5kUGKy6xtY/vwc6KmfA PoCA== 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=33boym0iDmpfsXmmsfx3Cc4p6qyAFC5nypFaH+cDut8=; b=IgKrJd9nFnmPZVEAWRNHMRn1NH+yOI0Jig3bV0iydCfwYsNJnWP4saQ6neqkUnMkjA ZXVX77yRl+pqwS80iw0rcPXans4dehK9kzVfISl2dkJdAuZrO9MpusT7oYs08j4KsfUH znj8FPLG9rTuNLltGnUD4e5VSckYx5nS877TSZvpFtBfzihh8OKRBcWf5N51M0Yumf5z JRGMRkMGIj9FkXwM3QwE363cGENVqI1aRNMnL3p4LLym+lYmwGJEKpPjqxlWVDRkxBzw UZieFVQkwoGrtSVgYSwycdUvDs6dIse3KeoUoDJXt4yGl5h9GW0qYqCVNxi3qme5NB6q K3rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b7eg6LXU; 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 11si192198iti.19.2017.12.12.11.04.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:04:38 -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=b7eg6LXU; 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 1eOpot-0002PE-0w; Tue, 12 Dec 2017 19:02:23 +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 1eOpor-0002Or-MB for xen-devel@lists.xen.org; Tue, 12 Dec 2017 19:02:21 +0000 X-Inumbo-ID: e77c6f8c-df6e-11e7-b4a6-bc764e045a96 Received: from mail-wr0-x244.google.com (unknown [2a00:1450:400c:c0c::244]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id e77c6f8c-df6e-11e7-b4a6-bc764e045a96; Tue, 12 Dec 2017 20:01:48 +0100 (CET) Received: by mail-wr0-x244.google.com with SMTP id h1so22163349wre.12 for ; Tue, 12 Dec 2017 11:02:20 -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=MdxMH+VIvgy5VjBNW3qVmrBsYeleqekgCTkPmsYq044=; b=b7eg6LXUZNC0uARS2Mjz+lBNJow3Hf+y/yL5ya/+ZTUpgTWfN7Vb79LbUoCHaL/AHS pkSUIRH2IaUzRcRTD9Vk5hrj3aIv5BgNED0Y28jozqIdIk8hAYivg08lndPDY4iUze7h hYApzJFx63XC9bibiLSnt789pY2+yr9KnhCYQ= 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=MdxMH+VIvgy5VjBNW3qVmrBsYeleqekgCTkPmsYq044=; b=KXsWVmd+8a8Uy+o7Pyb+AG1uEz8EY+0Cwd/WnG2ZYCKJc+xxsDuCOeaAcrj24A4MyR liDHmzpBaPEZHnrYBDq2Cncm+WO0YocS0R4NzSKRR0ZXyvnY/9rgtnepH9qnpzcOvs+v EFZbl5lknuuAwrjSuiDvvvPyCOUI05OHz92ovR50ItoKL5eYdDjuXM8dJNvP/4zjxd3K o2rBB9KPjmDdezpXkiSMRxC/vnvVuLhlBsJ5/JfpZU/W032zn1T0p2zYf3Mv0b7+X0S3 qxO0ztjxUVmhaNMjnZnPxld8cP2GpgTWKqIiIBusFDM7Sxie0wVBq1bCJMDeAg+H1cQA u1WA== X-Gm-Message-State: AKGB3mKY5+CBTtWsI2P40Khxj01JoZXZX0vHFojjH3parAVMJ0uzXXPz 01HTRuFqtEaFdPb/swbnXR90Ob9ptJA= X-Received: by 10.223.139.67 with SMTP id v3mr4659404wra.70.1513105339432; Tue, 12 Dec 2017 11:02:19 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:02:18 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Dec 2017 19:01:57 +0000 Message-Id: <20171212190212.5535-2-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 01/16] xen/arm: raw_copy_to_guest_helper: Rename flush_dcache to flags 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" In a follow-up patch, it will be necessary to pass more flags to the function. Rename flush_dcache to flags and introduce a define to tell whether the cache needs to be flushed after the copy. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/guestcopy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 4ee07fcea3..2620e659b4 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -5,8 +5,10 @@ #include #include +#define COPY_flush_dcache (1U << 0) + static unsigned long raw_copy_to_guest_helper(void *to, const void *from, - unsigned len, int flush_dcache) + unsigned len, int flags) { /* XXX needs to handle faults */ unsigned offset = (vaddr_t)to & ~PAGE_MASK; @@ -24,7 +26,7 @@ static unsigned long raw_copy_to_guest_helper(void *to, const void *from, p = __map_domain_page(page); p += offset; memcpy(p, from, size); - if ( flush_dcache ) + if ( flags & COPY_flush_dcache ) clean_dcache_va_range(p, size); unmap_domain_page(p - offset); @@ -50,7 +52,7 @@ unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len) unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from, unsigned len) { - return raw_copy_to_guest_helper(to, from, len, 1); + return raw_copy_to_guest_helper(to, from, len, COPY_flush_dcache); } unsigned long raw_clear_guest(void *to, unsigned len)