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: 10036341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 10B1D6032D for ; Wed, 1 Nov 2017 14:05:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E110228BBB for ; Wed, 1 Nov 2017 14:05:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5DAA28BBD; Wed, 1 Nov 2017 14:05:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D169928BBB for ; Wed, 1 Nov 2017 14:05:57 +0000 (UTC) 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-Google-Smtp-Source: ABhQp+RVCjCyD9h1tylxjfAv03pgFfAT27SN30iFpLXQ/QWPomQ6lJJICv/a5V3o2SL9d4NZS87YYA== 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" X-Virus-Scanned: ClamAV using ClamSMTP - 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 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;