From patchwork Wed Nov 1 14:03:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 117697 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp927865qgn; Wed, 1 Nov 2017 07:05:36 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Rz5ZpDxYFOPED563YmDknYnhxtQgcVocpdLxXLwPNVfJoqLdFvErOpriYQi+kBxBy1rl+6 X-Received: by 10.107.198.74 with SMTP id w71mr7242318iof.90.1509545135951; Wed, 01 Nov 2017 07:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509545135; cv=none; d=google.com; s=arc-20160816; b=V7vjDkwftj36VT3QH4qH6t2lMDExv/h9k5iyA8NS3gIkcLaFOWsFiQzfPYyNSAnjZC Kce2TWiDs33xvstAMwrXTD3e+sdYl9fWUtemu5QIhIiLQhZQcaLsmyVJ6nHxL42UoQh/ 2hVw65wYyXzW/wd04jJPED3LR/+y6G9LxZKic+XTZZ/VJk3PBBEkJ7Mpkj47uBWO5WLZ 9l+vkI7t0H2BXpEbZ4S0pAKY2WsOiYuiWm5yJw9dAM59GJMDc0mI2yDWiNGIQeVG2LEU FY+ISrLT0Q64cI03SQ7LNgtfTokqn684GDv/Q9OJaK1LxqfBtBdHUtc6PurQn2QGwpFO OFQw== 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=b+KzTdXS4+KOK+XRA1EL3KsA5JbSIeJB6dJKhgFuYZM=; b=toW9r0gcjYhuUw147xJHjU7DfHecMvs+yZVTAO7Z85hSt8x6mBXwG9a/Jc2SJ6omno ht6eoVHxAusT2YxMU1E4XRLkE5ZTfzzTD83t9PeORLWP7Z5lmCqNnJeYvGHGn/f8av87 MVyMQ9nKlKfRTvyq+8MZvIlWjNAecOg/YeFjnP89lP9T0PzXLOsvb7ANEvAFE92J5euf oDgC7FDmcwSmSB+zRDAI8nkZxxgS38LoWYOoFVp773F4ixqiz1wxwyCdDaDkElg7eWVD TRtdfHI+pho5J6l408A/PM30jPK/UcpW+jIu5lLIyLhFqohfpPLg4ySVkoYe76aZhCsr ohSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SHyO6z0h; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.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 n31si686091ioi.71.2017.11.01.07.05.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Nov 2017 07:05:35 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) 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=SHyO6z0h; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.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 1e9tc5-0007ss-8U; Wed, 01 Nov 2017 14:03:25 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9tc3-0007sb-Tz for xen-devel@lists.xen.org; Wed, 01 Nov 2017 14:03:24 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 2D/76-02146-B24D9F95; Wed, 01 Nov 2017 14:03:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsVyMbThkK7WlZ+ RBnv3qVgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlnGyewFnQKV+zonsjWwDiDr4uRi0NIYAKj RM+hhywgDovAPGaJazdWMYI4EgL9rBL/5l9j6mLkBHLyJO5fbmXuYuQAstMkji3kgghXSzy/2 gAWFhJQk1jzJgpiaDeTxI85R5hA4mwCOhLrZtSClIsISEtc+3yZEcRmFoiQOP/hIBuILSzgL7 H923GwOIuAqsSZpT/YQWxeARuJBT+eskCskpfY1XaRFWQkp4CtxLIr5iBhIaCS2w0n2CcwCi5 gZFjFqFGcWlSWWqRraKqXVJSZnlGSm5iZo2toYKqXm1pcnJiempOYVKyXnJ+7iREYbAxAsIOx YbvnIUZJDiYlUd6djt8jhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwNlz+GSkkWJSanlqRlpkDD HuYtAQHj5IIrwJImre4IDG3ODMdInWK0Z7jwp1Lf5g4Duy5BSQ7bt4Fks9mvm5gFmLJy89LlR Ln9QRpEwBpyyjNgxsKi9NLjLJSwryMQGcK8RSkFuVmlqDKv2IU52BUEuY9fgloCk9mXgnc7ld AZzEBneUl8QPkrJJEhJRUA6P26g9fiwJDo+VZC67I/fbNsxWaKn21PaOU+dh/UcGD37KP/F4d cvSkvoPkzAcH1tz/65D4dNfd5c769twrJYIltIKO/b5yVeWdW0b5Qe9/t/+9X2v6oOxDTJv7H f3Jbx8cX9q0bGPHm9jbW6unHDBpV3154z3fQ6n0m0KHL4ZuWhO4alrgQZFwJZbijERDLeai4k QAUb/ffc4CAAA= X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-11.tower-206.messagelabs.com!1509545002!89866573!1 X-Originating-IP: [209.85.128.194] 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 52459 invoked from network); 1 Nov 2017 14:03:22 -0000 Received: from mail-wr0-f194.google.com (HELO mail-wr0-f194.google.com) (209.85.128.194) by server-11.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 1 Nov 2017 14:03:22 -0000 Received: by mail-wr0-f194.google.com with SMTP id l1so2045471wrc.3 for ; Wed, 01 Nov 2017 07:03:22 -0700 (PDT) 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=auPzgYdYvNUtym022RmzXmFeIpSa7v4QplQOWd8aEjA=; b=SHyO6z0hwH9WD5USUMukHj/7xuFDCHgEzSpmy9PWiOU69fB0k83Uq+olDvMiwN/Kv5 JKIjutrhfBq2H6gnsIknHo6ubcgsmLb87LrSkiDa3BI9McOx8TH9a/TR8lAXtvfGiNon xYOnCfN8hxzuuwk5JvtLIgc8o/j7yPY7W6mAc= 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=auPzgYdYvNUtym022RmzXmFeIpSa7v4QplQOWd8aEjA=; b=Qqis2tiKjgvQurccRX8iXNIEal8876ij1qQRcKxfh2cbXVZXdJgq/pKeQ77IlbR7u3 QwCTaPCX3LGfO76p/17fSL+iIB4bM4nOEK3IBgln1YYiLwS0FD3HKcxvxLPRJanu4w7d s0v4pvESICJR/2JLDDthhQLXkjCRE08sqMV+OdJiF4qB8LOcW6W2gpYaBIV5uJ8C5k9T +VpIb8wYG2O3BbyXqxEPb5YP+Axr3XHpLfDClA9Wo5Po1K9BgOh2uT9SB+FMfTiFkkQI mopNlpVsu59ortLW9z1Vj7Kp8t51r8K7Y4NF//yWRH4/qVUG2MkAuNTWKtQbYghsbhw1 1izw== X-Gm-Message-State: AMCzsaXNV+jEksdcSgqK2nxlUR5q7br2PAdPMTQccMhsTb7P6D8N9Kbo 23kFcQJE11Ef6jRVZoQArDzgfdSjpIg= X-Received: by 10.223.139.221 with SMTP id w29mr4806729wra.243.1509545001782; Wed, 01 Nov 2017 07:03:21 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id w4sm595582wrc.17.2017.11.01.07.03.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Nov 2017 07:03:20 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 1 Nov 2017 14:03:13 +0000 Message-Id: <20171101140316.31333-2-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171101140316.31333-1-julien.grall@linaro.org> References: <20171101140316.31333-1-julien.grall@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v3 for-next 1/4] xen/arm: domain_build: Clean-up insert_11_bank X-BeenThere: xen-devel@lists.xen.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.xen.org Sender: "Xen-devel" - Remove spurious () - Add missing spaces - Turn 1 << to 1UL << - Rename spfn to smfn and switch to mfn_t Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Cc: Stefano Stabellini Changes in v2: - Remove double space - s/spfn/smfn/ and switch to mfn_t --- xen/arch/arm/domain_build.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index bf29299707..5532068ab1 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -50,6 +50,8 @@ struct map_range_data /* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn #define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) +#undef page_to_mfn +#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) //#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION @@ -104,16 +106,16 @@ static bool insert_11_bank(struct domain *d, unsigned int order) { int res, i; - paddr_t spfn; + mfn_t smfn; paddr_t start, size; - spfn = page_to_mfn(pg); - start = pfn_to_paddr(spfn); - size = pfn_to_paddr((1 << order)); + smfn = page_to_mfn(pg); + start = mfn_to_maddr(smfn); + size = pfn_to_paddr(1UL << order); D11PRINT("Allocated %#"PRIpaddr"-%#"PRIpaddr" (%ldMB/%ldMB, order %d)\n", start, start + size, - 1UL << (order+PAGE_SHIFT-20), + 1UL << (order + PAGE_SHIFT - 20), /* Don't want format this as PRIpaddr (16 digit hex) */ (unsigned long)(kinfo->unassigned_mem >> 20), order); @@ -126,7 +128,7 @@ static bool insert_11_bank(struct domain *d, goto fail; } - res = guest_physmap_add_page(d, _gfn(spfn), _mfn(spfn), order); + res = guest_physmap_add_page(d, _gfn(mfn_x(smfn)), smfn, order); if ( res ) panic("Failed map pages to DOM0: %d", res); @@ -167,7 +169,8 @@ static bool insert_11_bank(struct domain *d, */ if ( start + size < bank->start && kinfo->mem.nr_banks < NR_MEM_BANKS ) { - memmove(bank + 1, bank, sizeof(*bank)*(kinfo->mem.nr_banks - i)); + memmove(bank + 1, bank, + sizeof(*bank) * (kinfo->mem.nr_banks - i)); kinfo->mem.nr_banks++; bank->start = start; bank->size = size;