From patchwork Tue Dec 12 19:02:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 121644 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4508726qgn; Tue, 12 Dec 2017 11:04:46 -0800 (PST) X-Google-Smtp-Source: ACJfBos8Wo2Ij6GiBeHRoJoRtucHayJGm4T5kAtvfcA8Jd9acLhXsOXYFQ+czNVLDFmh4WG7WhnQ X-Received: by 10.36.115.79 with SMTP id y76mr881320itb.144.1513105486110; Tue, 12 Dec 2017 11:04:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513105486; cv=none; d=google.com; s=arc-20160816; b=f/ywfDaq4KLhQdbkN3qSyKSGuketFKARYR+mxeB6fHhkju56tapx5v2P2r7eBXvxAz nCI6GVdfGgorjSGo67QsRRKOAQh229EAkdmIgQTzHvtz7/AlFSCyl+kt4ZYVleJK6c8f XDhbLrkDAl5oEj0UptfMV9qMCShRPxGNeUPBlSmH66nEDSRskEKhaG0RTTy0ABmpA0A5 wAEHiUehE8X3LdsUftX3X5Qas0qgOH9W68Rh+XjeIUxCwpwyvhIAFOdyfr+oyETAlbYG 1rNTaD4olPg+BadLqu3T3CRQrFCDyftLuC5uopJMT4VLtBQQIeWvidoNaeQf+KmIxD0G bVSg== 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=ZX41R8Kz/NEBCQJIVRTTnfM6NlqEmyX0/I/LyJPTr8w=; b=GpHFRFRIXWdgs7tkUDxRKS9pgiJfgoDR56OmBrqi9q3uqH6TQJvSQMGL+HY2Wz1yLw xUpER0UM7auXKMJi+7QX9TIxZkyqz+lemqbJfpp3bBQbbvdsi/QMaahP4QQUbczEJ6Jw MMwuq0Db0QQB0LQc5hg5/MMUlxMgmoXbCk/oki561ebRE5VXbSxrt1i9z8pbURe+si5y NKgrb6TpJ80yKy8nqSrLtV+2PYIrSRG3P8GrslAeWFCobICW25HhfmVtsz20+jIhTHlT 1MP/b8W1ZPTa7f6BZScafwuYTfy9IbEp9A78dNjWL8khU3jCqA7rPkmBZWnwkRf2ws1l VQ5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Rrop5gAn; 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 o189si191223itc.18.2017.12.12.11.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:04:46 -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=Rrop5gAn; 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 1eOpp7-0002be-9J; Tue, 12 Dec 2017 19:02:37 +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 1eOpp5-0002Zp-Q9 for xen-devel@lists.xen.org; Tue, 12 Dec 2017 19:02:35 +0000 X-Inumbo-ID: efe06f9a-df6e-11e7-b4a6-bc764e045a96 Received: from mail-wr0-x243.google.com (unknown [2a00:1450:400c:c0c::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id efe06f9a-df6e-11e7-b4a6-bc764e045a96; Tue, 12 Dec 2017 20:02:02 +0100 (CET) Received: by mail-wr0-x243.google.com with SMTP id x49so22183496wrb.13 for ; Tue, 12 Dec 2017 11:02:34 -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=OAyrQLPkZ4XMKTzacliWHSEdVkVcvpNFnWM880UKNyI=; b=Rrop5gAnX6zEOk4JE8DSyDAy55TKi0Rv/ff7AnwORGgpROUuWewfr/qU7ZiM7hWydy LkD+TgRpRov7+BH3UiR18Zh0keUfLou4DPtqC71e3K6VQlMaBV5r12qJ9d0WGW5eKNt7 8O19Uj1heWI/TJHOYTsj8gSflEs2MO7Qrhbag= 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=OAyrQLPkZ4XMKTzacliWHSEdVkVcvpNFnWM880UKNyI=; b=LrjuBhl5P8lB9h8RT7VvPB9SWVHiMRcYLa3EbJwyePw1gYEw0c8lLYxgQLOjtwktyy NTvjYWZXkX3GvH9ji82KNFjwwiaJY1kxTCYp1jGpDU4lieKO/taqauofK8yGQ3/pDAQ3 6AsLh5iBZJBcZHl/82Y/ZjTXqAFJaO1XQK43uCy5Q47TFVW5xWCny+m/UlRyu+qctR68 5Xpy2cv2gqKTURHp6Ixu0FuQOnYmjQpCiX5DEArk/NrQ9nl6pm4pXF9hx1HTOtl8aKo8 pNO3Ijs9lFXJaXr7Ic6pXYA3FWT4ZOPHJMNBvLSlc2Xdz4Hljq8kM1yG8MnYIA7fAn5n OhpQ== X-Gm-Message-State: AKGB3mJ6CYTYnapLF0VpQpIOGRYFdjIz+J1W309x1AkOWG271L/rNiQT frLlvUaBEb7mtTTJPKSP93zPTbqePK0= X-Received: by 10.223.176.194 with SMTP id j2mr4468436wra.62.1513105353367; Tue, 12 Dec 2017 11:02:33 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:02:32 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Dec 2017 19:02:06 +0000 Message-Id: <20171212190212.5535-11-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 10/16] xen/arm: domain_build: Use copy_to_guest_phys_flush_dcache in dtb_load 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" The function dtb_load is dealing with IPA but uses gvirt_to_maddr to do the translation. This is currently working fine because the stage-1 MMU is disabled. Rather than relying on such assumption, use the new copy_to_guest_phys_flush_dcache. This also result to a slightly more comprehensible code. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/domain_build.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 66fd77def6..155c952349 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1950,14 +1950,15 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) #endif static void dtb_load(struct kernel_info *kinfo) { - void * __user dtb_virt = (void * __user)(register_t)kinfo->dtb_paddr; unsigned long left; printk("Loading dom0 DTB to 0x%"PRIpaddr"-0x%"PRIpaddr"\n", kinfo->dtb_paddr, kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt)); - left = raw_copy_to_guest_flush_dcache(dtb_virt, kinfo->fdt, - fdt_totalsize(kinfo->fdt)); + left = copy_to_guest_phys_flush_dcache(kinfo->d, kinfo->dtb_paddr, + kinfo->fdt, + fdt_totalsize(kinfo->fdt)); + if ( left != 0 ) panic("Unable to copy the DTB to dom0 memory (left = %lu bytes)", left); xfree(kinfo->fdt);