From patchwork Thu Oct 5 17:42:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114956 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp848285qgn; Thu, 5 Oct 2017 10:44:42 -0700 (PDT) X-Received: by 10.36.172.74 with SMTP id m10mr33620954iti.150.1507225481943; Thu, 05 Oct 2017 10:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507225481; cv=none; d=google.com; s=arc-20160816; b=JqkuzXbMFjmbGFXnHN/lHefmdFnvvyaz677illxqdLtXCg060rn6wFFiZJd0y2IXB+ 9IOtO/uxcDrf3pwjdciE92MZN9B6q9+WsTcYFVCZcza832T+AW8TxUIp/JRlLvAbNkmy Wjr0oVZ89BNsL9IaWOEdziJDxIqgrE28SHdGzD05bxxS6srOV99wBFTBpNK2rm37aq4O FM+35jaQzVt+OUDS34Pbq99jkq1dY71CUuVIWp5k2B+VYi66Z7xmCFmeqi9CSbx3VH1/ UywNUvSF4Ad7CDxfwtudcrw36jaNw8C9jBsAAix1gl86Lx371CbGgdT+ZM26IsjLyRth 1GqQ== 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=jh+vouMko+x/OxmrtZMsTQ3JYxvsRqflHfua12sgefM=; b=GJO9Xq0MMx6Ne23NWWxXa7XhQhfF3NtCKiCbjnyxhXGGPlui0Y6UGSQvgyqWINvgno a6+GHkTlirCy6saMNGzYwj6uexygRHubb4y96cuQLG+hhuKipUUHHEAclpBGulbeF0Ap mrblFIWSTXBBx6e41MYFJUOqohhVKrHfsIKmkm5Pmg9lt84UflAGoaYvt6kgLs717DfJ GipHnQEsUGwpI70GCXssNDlGDQzNsp0kCn8tysNYK2BqWzJQSQziPjl966XkVCYCRI4f FxWR67dVT0KVwXeBv8hvRBiYaJXw6QS/H1MsKAsiZtj41xmS8w2+Z1GCk2+/e6IzvVTs Zl9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IwPRQH4n; 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 62si14749207iox.281.2017.10.05.10.44.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2017 10:44:41 -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=IwPRQH4n; 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 1e0AAL-0000xU-To; Thu, 05 Oct 2017 17:42:33 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0AAK-0000xI-SI for xen-devel@lists.xen.org; Thu, 05 Oct 2017 17:42:33 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id DF/36-01909-80F66D95; Thu, 05 Oct 2017 17:42:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVyMfTOVl32/Gu RBl2TlCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxbO3pYCjqFK97ffMzWwDiDr4uRi0NIYDKj xIHJu5lAHBaBecwS57/uYARxJAT6WSUeHd7K1sXICeTkSfx5cosdwk6TuPT4PBOEXSkx7UsTa xcjB9AoNYk1b6IgpvYxSXzdeIQJJM4moCOxbkYtSLmIgLTEtc+XGUFsZoEIifMfDoKNFxZwk3 g9eyMziM0ioCox5Wg/I0grr4CNxKzLiRCb5CV2tV1kBbE5BWwl1vfcAbtGCKhk+YqzzBMYBRc wMqxi1ChOLSpLLdI1MtVLKspMzyjJTczM0TU0MNbLTS0uTkxPzUlMKtZLzs/dxAgMt3oGBsYd jK0n/A4xSnIwKYnyemVdixTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwcufB5QTLEpNT61Iy8wBB j5MWoKDR0mE92kuUJq3uCAxtzgzHSJ1itGS48KdS3+YOA7suQUkO27e/cMkxJKXn5cqJc5rDD JPAKQhozQPbhwsOi8xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEub9A7KWJzOvBG7rK6CDmIA OmtN0BeSgkkSElFQDo1CLT5lWm9Lr6Z/u2X8uZXS5O03r2uln4f22cjx5bneMizf4Xf4x+ciL DP0FTRz7rNT0m98GKjKW3V3fbD47r1Zk6oa3fAKtcUvqnFOVD8gofnz953bD58U+J1NmaS9IP hyZcHIvx8KlDb+M22fHWjzbnXa4K1r6x5RtTzZ3+2dk3qidZhz3RImlOCPRUIu5qDgRAAOjca DJAgAA X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1507225350!118196111!1 X-Originating-IP: [209.85.220.181] 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 1251 invoked from network); 5 Oct 2017 17:42:31 -0000 Received: from mail-qk0-f181.google.com (HELO mail-qk0-f181.google.com) (209.85.220.181) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 5 Oct 2017 17:42:31 -0000 Received: by mail-qk0-f181.google.com with SMTP id w63so15514138qkd.10 for ; Thu, 05 Oct 2017 10:42:31 -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=Tniu595kLO7uKPICEjK9faE8Zn+YBoOmSLupwI0Q000=; b=IwPRQH4nJKjandrchq6Ezla87sEyMaFZSD/WiCwTezFkKocc0E165euAkP2giwA068 O0+QYKTbtUDz+BTyYgLcESbrbPLunJ1Ly3lsfKuHSzfxwGeJ9UCjVBtiSAEl4QHj19eT 0Phl4y9sv2nFtvY77qcUyNOtG1HG/ODmwuZEo= 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=Tniu595kLO7uKPICEjK9faE8Zn+YBoOmSLupwI0Q000=; b=FmI+SXg3G64GIETWoeL9rXgMdt9ZUY5D3MmoxIDT09Y2F+KLZdHcMkGTM/QF73bw5b 4Qj+30oNZtihSLXBRPY/FRGg+1mBN6VISErDb+jRQY2z7Vk8PK07MXl1Z9MJFlUo3zvO WdftSMrQBdbG424v2u0C7Od+G83rAjeHgUQmUdeyc5BAQ/3TQ9APwti+zMH1rG+OG558 4EHtIRMF48MhtYTsuZF92GCtI89Amg4pkV89fEUdOgiMhWMOa7bG+t7/TK1htOd/kWQS icV0TMB+83YVthz0k399uJfb+OvL+BfYpEn5qJeeK5MHILksVHluYTqnonkSdG9OpssO 8oCQ== X-Gm-Message-State: AMCzsaVAOB4HAdQkWbm7YzAGhXA2ewKWtNnLMd28mHo03TfMsnLBZ9za StGRggnqAzUkuZQT0Y3Az1fMN7fOX98= X-Google-Smtp-Source: AOwi7QDKG1mF+m1PI1oMKQ4oKxmQOCIEECi4Tw6YXaCWHITZG8LS2SIHL6cpoRu1vf0rpmP0xpPY8g== X-Received: by 10.55.16.87 with SMTP id a84mr33029416qkh.170.1507225350381; Thu, 05 Oct 2017 10:42:30 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id y63sm11815084qky.75.2017.10.05.10.42.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2017 10:42:29 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 5 Oct 2017 18:42:14 +0100 Message-Id: <20171005174222.29161-2-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171005174222.29161-1-julien.grall@linaro.org> References: <20171005174222.29161-1-julien.grall@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v2 1/9] 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 --- 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 3723dc3f78..167711b4fa 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;