From patchwork Thu Nov 23 18:32:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 119532 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp1172963edl; Thu, 23 Nov 2017 10:34:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMamzrO0tF1J6nnnBV2Wg8tEgTuASsJAp8M5O8UM9+USM2O9Lxq46IsrMVkoL3umkgwTmCfe X-Received: by 10.36.227.3 with SMTP id d3mr12911618ith.47.1511462052623; Thu, 23 Nov 2017 10:34:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511462052; cv=none; d=google.com; s=arc-20160816; b=QIuJf6u7P8PHHp4QEt8XjZnOMXIVOApwB2x83GUgNEoiqO4z0+qqbSYIv6JEeMAfkw OefAtxKJPdJPqyIwTxM5yGQuf6FiGu+JVeeJBwVGofmb7T9We99OqGGhjQkkHubIQCKz vevqSRHNGHffaF8QAHr7wmoz3DPLCTxhEaDrnu5aLPmWhYpbbm0LhdBL/eUAm9pPNtEw CQcObQxBA4a0m4BLkdtfm55r57ESb9iB9T+jAp6FrX9BBBIdpzalttQK0MNfdyaV1wQ/ +k4p8yqbJ5w+nLBipCt728LhyrYwKx9bOGsx+2xNGVMZIsRYFEtwSbFFdmIzMnsWaVo9 6Xww== 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=m/ZFIvDX9Hya/jLmFQ4dF3UXmz2bmmdENiLX/VtVcPk=; b=L79wxsjd4WY293bs3y5nimQQNR56GfAKOJK+I3dbqIufBIfoJJdiry1KWkcWqQl8L/ byw3zrmoHVXQq55RhJjh+zsRzukzdxIFF4OPaHsfFFZ5kTQ+rQ7jlJRCUviFmrpb8W89 haacL9Zk/5Aa+Ieem7mQ6iU2zsWliuDl7RBbV5LQXndRq8LjHd9iwcMfYO2m84JMt1hy ++r1feb2P7KZzdi2poZ3WH7KAdipv3I814/4FJ3bJbTx702LY6plSwUbxpzdKEahXK1t YWxlbLh6ekt131NCGLhpFTYjfoAZzskxc/LmKPwpYEX1RfWwWd3eN4F6xtZ9A2LXL2Uw i0sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=d706IPKq; 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 l74si4102846ioe.133.2017.11.23.10.34.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 10:34:12 -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=d706IPKq; 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 1eHwIV-0005JA-It; Thu, 23 Nov 2017 18:32:27 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHwIU-0005GM-3s for xen-devel@lists.xen.org; Thu, 23 Nov 2017 18:32:26 +0000 Received: from [85.158.143.35] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta-6.messagelabs.com id 63/3D-26583-934171A5; Thu, 23 Nov 2017 18:32:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRvkpGshIh5 l0Ntsa7Hk42IWB0aPo7t/MwUwRrFm5iXlVySwZvTemsRYcIe74t6dU8wNjN2cXYycHEICExkl 5qwS72Lk4mARmMcssenMUUYQR0Kgn1XiyZr/LCBVEgJ5Ev93bwOyOYDsNImZ3yMgzAqJq8+NQ UwhATWJNW+iQDqFBPqYJJ7cX8MIEmcT0JFYN6MWZIiIgLTEtc+XGUFsZoF4icdTr7OBlAgDDX x5PwkkzCKgKvFpz3WwnbwCthK7X12D2i8vsavtIiuIzQkUP3rgAzPEVhuJz58VJzAKLmBkWMW oXpxaVJZapGuol1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kRGGQMQLCDcedzp0OM khxMSqK8Mr/EooT4kvJTKjMSizPii0pzUosPMcpwcChJ8EoKi0cJCRalpqdWpGXmAMMdJi3Bw aMkwrtdCCjNW1yQmFucmQ6ROsVoz/Fj0pU/TBz79twCks9mvm5g5ph2tbWJWYglLz8vVUqcdz NImwBIW0ZpHtxQWHxeYpSVEuZlBDpTiKcgtSg3swRV/hWjOAejkjDvW5ApPJl5JXC7XwGdxQR 01s/jwiBnlSQipKQaGF2/OUonle4KX91ZJ7JTxOuJ4iHVcuWMvL7a7fI7FigFOid/W8RieIH1 7JxE/hXH5s0xtb5bGmFa5Pz9wIKry2alB6r5f7E1PusdqFpY+cPRzji16NHM7h07SzYtcY2Pu nZgd+zlVxkGNTP1HF45bqsovbopsfztFVepwr4g4b2z2eIbHzt8VGIpzkg01GIuKk4EADSz1o TKAgAA X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1511461944!76751757!1 X-Originating-IP: [74.125.82.66] 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 20885 invoked from network); 23 Nov 2017 18:32:24 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 23 Nov 2017 18:32:24 -0000 Received: by mail-wm0-f66.google.com with SMTP id u83so18573030wmb.5 for ; Thu, 23 Nov 2017 10:32:24 -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=L4ecF+4jUObl7GroU/XAZ8xAnCtevI1gOyTw981gxFY=; b=d706IPKqhEMib+yJ/8OtQA6CgV+c5DihWhqT411qXOwSbU4eA29fbTIYkDEM+OF+9g SGNVF7eLUbczYt0DYlHHx/XQ2KBwhrROWnp/3P90X2mGxx0Au89Ry88fNGJ7hkpnBaiD NZGymKa32Oh3dqto+7fRGPGMzKuLQFBRSa1lU= 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=L4ecF+4jUObl7GroU/XAZ8xAnCtevI1gOyTw981gxFY=; b=TWGSGA3t6IP3/Xnz9vs0xZAwq99TV1UCg8lytCQa3n4DN9v1k0eAy/GIZCcaeZUiv8 Xb6/ywx1ZSsl/iLbgxN3MAYQLNKLUNDSKw4yoP7hlZkavabItvYLIi3pzmMk1lmoiv25 ytJprGgTzFL+3vgMY/Dxtw5KlZw1LyZCKG+RBdc9rXMea4UW8OY+PPVlfw9oa3bN0Tuh GSfHgMPewzTss0MzuLbcwZUp2gUzBy5oK3c2OP03q0bS2iRheWJLYjFaxhMDvgO0ns1r B16Mazy14oIe+NH0NmjZxLjy/YinbBGB53OwWDZqafbzHKCwTX6o+0/G2y1eds2FGO7J arkQ== X-Gm-Message-State: AJaThX4VZeXum4BJBGUe+jXh/XiBLwF4RuVV+8XPAUrKyo6GSwQNhBgx wow8lXVPXJ9elU37eTK/rJgn7we6Dd0= X-Received: by 10.28.232.129 with SMTP id f1mr7330805wmi.32.1511461944463; Thu, 23 Nov 2017 10:32:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 10:32:23 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 23 Nov 2017 18:32:04 +0000 Message-Id: <20171123183210.12045-11-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 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 --- 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 42c2e16ef6..9245753a6b 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1948,14 +1948,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);