From patchwork Mon Aug 14 14:23:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110019 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281860obb; Mon, 14 Aug 2017 07:26:32 -0700 (PDT) X-Received: by 10.36.236.195 with SMTP id g186mr6578371ith.1.1502720792246; Mon, 14 Aug 2017 07:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720792; cv=none; d=google.com; s=arc-20160816; b=0THlclhdUbW0pIYi7s3DvSIEWAxXySJLozNOfrH6nTs5owLP8q40gds39fL++q5MDD RsOejutdLQUA9X9sGnXrqG3YI9cBFUZ68YdDjOQBJunaG67QEt/B18UI33Pq5NeNS4nT /VBJ4OLS/MLii9jM4uKP8mMnBsFMtXpVbzj6+wlkiwinhIENeCjjf89NFmTUgeCpETUW Uxqs+22sqeHSWJd6VyrOL5kgYEZlWgnpKDHoFINx++OAxYg44LgGkpLJrLH7rlW4lkqc 4pbB+aWD0+sg3GSJ1SWcAS98/W54NNnV2JIlJ5g9DNQ5yYemfXcnMd4AFs5bHoDCb1Yg voHQ== 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:arc-authentication-results; bh=f13jIHBYoHGRdDqnEfY/4z65tYQKsLh7LRDQ7G5EQYo=; b=WIIK2sAD9Pd4QWqx0ovAFT+Krz2aMPPyTDFX+OnD8gvpYth7mz1PR4R2bnZxFfMbtO 0kKWynWwmZ4NQ2ZoVjApX8q2NNufc8d7u4w2SjiIKVKibeaodZipFgXzXLQzKrlAICAV H7+AdxIXe+EuuwgSpdLyWnzsI2BcZw9aAR2JAroyZcKU6Wqml62h7TU15LTP6axXXALT lgLsUHmo8N/WKhGiSXZ1sXB+ezP5+YtLkRSb2TUHXvMeSjKIbuzFoPpBF6iXFTY+XHhH /0n3eBou2KThF26wpbJcEdYGvCf2Q2WpRuAeaq1RkYQULaWiVzfu3s54uFpYtwEBK9Pv 6Cag== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z200si7175689iod.34.2017.08.14.07.26.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:32 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIF-0000Af-G4; Mon, 14 Aug 2017 14:24:35 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGID-0000A9-9L for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:33 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id D4/5A-02962-0A2B1995; Mon, 14 Aug 2017 14:24:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTXfBpom RBht6eS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ox7i9+yFKxir+i9voapgfE1axcjF4eQwGZG iSvz1zJDOKcZJR6cXsnUxcjJwSagKXHn8ycwW0RAWuLa58uMIEXMAssZJTbsX8EOkhAW8JTYu XYvSxcjBweLgKrEhF+GIGFeAUuJhxNfM4LYEgLyErvaLrKC2JwCVhKdd3eygNhCQDUnVs9mm8 DIvYCRYRWjRnFqUVlqka6RmV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRqCHGYB gB+OZBYGHGCU5mJREeRN8eiOF+JLyUyozEosz4otKc1KLDzHKcHAoSfCmbpwYKSRYlJqeWpGW mQMMNZi0BAePkgjvDZA0b3FBYm5xZjpE6hSjMUfThy1fmDheTfj/jUmIJS8/L1VKnLccpFQAp DSjNA9uECwGLjHKSgnzMgKdJsRTkFqUm1mCKv+KUZyDUUmYdzPIFJ7MvBK4fa+ATmECOqUP5A ve4pJEhJRUA+ODaJc18wVvunWb2mUWb+xOLZbJZjoXpPScJcrE1aNENt1swiPZuMvXV/1fe+1 h1uJZAe1Oz18v+2V0KHtDya/tL4tZast1nimrZNUpFYdYnX5emW+5O8Y29CmTkHXpg1+vDvYL clbcsi9301yfcyJov8WkCc1SZq/2H7DY+fibsHdF9NrDD5RYijMSDbWYi4oTATAafmJ8AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1502720671!74726571!1 X-Originating-IP: [217.140.101.70] 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 41988 invoked from network); 14 Aug 2017 14:24:32 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-21.messagelabs.com with SMTP; 14 Aug 2017 14:24:32 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7CF2615A2; Mon, 14 Aug 2017 07:24:31 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A1213F483; Mon, 14 Aug 2017 07:24:30 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:52 +0100 Message-Id: <20170814142418.13267-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 01/27] xen/x86: numa: Don't check alloc_boot_pages return 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" alloc_boot_pages will panic if it is not possible to allocate. So the check in the caller is pointless. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/numa.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index d45196fafc..ffeba6e180 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -101,14 +101,6 @@ static int __init allocate_cachealigned_memnodemap(void) unsigned long size = PFN_UP(memnodemapsize * sizeof(*memnodemap)); unsigned long mfn = alloc_boot_pages(size, 1); - if ( !mfn ) - { - printk(KERN_ERR - "NUMA: Unable to allocate Memory to Node hash map\n"); - memnodemapsize = 0; - return -1; - } - memnodemap = mfn_to_virt(mfn); mfn <<= PAGE_SHIFT; size <<= PAGE_SHIFT; From patchwork Mon Aug 14 14:23:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110008 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281632obb; Mon, 14 Aug 2017 07:26:20 -0700 (PDT) X-Received: by 10.36.214.203 with SMTP id o194mr5672078itg.3.1502720780611; Mon, 14 Aug 2017 07:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720780; cv=none; d=google.com; s=arc-20160816; b=UfLWCnNTzkOFA0pRzHjPObW/dPn+AFJuljw5KKwNIGao1MXdueVDTV/lWVZQ0uoz5O bHX2tUxk94fnmYys2jQgBX+S6CQmkB8dVo7WLg2BlxX+WIekG/AijYpt3F4anuqlqaCi 21RiAh1TnzN5zZ1I2ej6mu45uASFsMstByaeGTSdsWWfWKttEMzIQHaDNYlqj8bV0nab mTW/AHXXfZW5IFuGbK9UAlFjoW5mQ2Gt7VWJ4gVlUq1HROEQoJVfR8RrckV/HCVuUh+Q zx6Riwzit05uZseV/xff0/RXWp0wm1yqu5RhGWXLDIkOrmd10BJbazbnMIW/POlX4b6p 8/9A== 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:arc-authentication-results; bh=ViCZZAX4rejmxoBY+sDu1VC+cqew6idIM4cvwgTN6Ss=; b=bXjoipTWGdrP91DrVSp7CLYMHZX0jfeVeSxGuQx3P+T71owuX+GYuZtMei/pzcVBgg 0KDEro5I+JE5+2VXTRtnOkEC01CVs2THAZ/gi5ZVj7ZAHDTQ2lBI6tIhK36pxPcvSWrD liFkTCDA6spe3z/9A9XARnqSaYGEukUGTziM+mLhaSIvXNrohsee3JfJiTndxWvxsDen IROPtBNv9Oh+9hnkXzusyEdX+gL2Url9o5UqkpfTF1rCM+2u2bf/RgNUJ0T1GhL1ABl4 fNzH7VePvkpySPAV8btCo+tMP/qrG4OyzFKYLWxvCGFKU4iK6iEui2wenS9IuCrGu3E1 oxEA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y144si7144632iof.216.2017.08.14.07.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:20 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIG-0000CC-Ql; Mon, 14 Aug 2017 14:24:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIF-0000Ae-UY for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:36 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id E5/21-22472-3A2B1995; Mon, 14 Aug 2017 14:24:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRWlGSWpSXmKPExsVysyfVTXfRpom RBlf3alks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBm/v01jKjjNVvFw4ga2BsbTrF2MXBxCApsZ JRaub2KHcE4zSrRevA3kcHKwCWhK3Pn8iQnEFhGQlrj2+TIjSBGzwHJGiQ37V4AVCQt4Ssxuv 8YIYrMIqEq8PXYHzOYVsJRYfvAYG4gtISAvsavtIiuIzSlgJdF5dycLiC0EVHNi9Wy2CYzcCx gZVjFqFKcWlaUW6RoZ6SUVZaZnlOQmZuboGhoY6+WmFhcnpqfmJCYV6yXn525iBPq4noGBcQf j1BN+hxglOZiURHkTfHojhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnw3tg4MVJIsCg1PbUiLTMH GGwwaQkOHiUR3lkgad7igsTc4sx0iNQpRmOOpg9bvjBxvJrw/xuTEEtefl6qlDhvOUipAEhpR mke3CBYFFxilJUS5mVkYGAQ4ilILcrNLEGVf8UozsGoJMxbCTKFJzOvBG7fK6BTmIBO6QP5gr e4JBEhJdXAmK9lfPDM+9hNZ3Rnz39ak1z/TuPalO5lz99VtjDlBO3q5NjyTp+9T+yUzL5C68R b+++3pV6oOnLjZWiKzOfZl0LmzfjBzzMhY/WNbH+R8w1SLOaLn0S8+soh9cu6etkmsZ0nVTyE Km4nnHZd4KVsx5JTUdudoflH6Omf6msH7BSEHmfMzK1KVmIpzkg01GIuKk4EANYmj9B9AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1502720674!109784799!1 X-Originating-IP: [217.140.101.70] 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 45832 invoked from network); 14 Aug 2017 14:24:34 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-31.messagelabs.com with SMTP; 14 Aug 2017 14:24:34 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EEA92164F; Mon, 14 Aug 2017 07:24:32 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BBEB13F483; Mon, 14 Aug 2017 07:24:31 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:53 +0100 Message-Id: <20170814142418.13267-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 02/27] xen/x86: srat: Don't check alloc_boot_pages return 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" alloc_boot_pages will panic if it is not possible to allocate. So the check in the caller is pointless. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/srat.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index cd1283e58c..95660a9bbc 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -194,11 +194,6 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) return; } mfn = alloc_boot_pages(PFN_UP(slit->header.length), 1); - if (!mfn) { - printk(KERN_ERR "ACPI: Unable to allocate memory for " - "saving ACPI SLIT numa information.\n"); - return; - } acpi_slit = mfn_to_virt(mfn); memcpy(acpi_slit, slit, slit->header.length); } From patchwork Mon Aug 14 14:23:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110017 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281842obb; Mon, 14 Aug 2017 07:26:31 -0700 (PDT) X-Received: by 10.107.15.16 with SMTP id x16mr19478907ioi.288.1502720791368; Mon, 14 Aug 2017 07:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720791; cv=none; d=google.com; s=arc-20160816; b=CJDVsUZmvPRLmKG1P0sHVqY3cu9345a65alwnJyJ9xbNxosbuggVTfCtUKrClcB8kn ZMOgs3FE0ZfkwPBPTtscTBoH/Z+vtcxWbPaKfe8+PbQUJzD3ssNxPgyx7HxBBVe6rpK7 +SZTJEURmvHWz8bDarYHK+lQVjeoXGJRnLmyK3+hZD1QlDmoj+k6ESqj4BRcDaltYkK0 kOQTfdjeEL1asPXr/rQBoyxGW03KPz8pOamv5RaPMVL0rQr7dBGnBCzEm/ioyTpqVioV leX0W1gtE2/EIleUKGpVDCS+wG7S3Ja3BWpB0UtKzuX9BLNCdvEVFmaiUPG7oXiYChIV 2F8w== 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:arc-authentication-results; bh=o/Ne1l+/oLhNUNCkKD1NShx4bcw/KDYCfD5s0n9bzxw=; b=PVWjc5lSOlFYxWxRPVmdSQETMk+9mcVteSbe4cESBairFE7PMvP9zTMgkJMDYl2IVP uB5g3Dh+0K3k01oISPSsk9wYmWd5VO/SIg7UB/H3vnYTRKfftgyYdwTPX2+PdiCWhNzX xpbFhBYR+BIBGKiESBMHkr08UP1qK5JCPi01fDKM2GIWH4Sk7Etm5rwlYXvebTGOf9Pq pS02D2vcl29z4NFOcCOBB9WVXH4wRrgzguW3DNSUXFRWjDENa3JJbhgEeGJwpHeBl/L4 t6gER8jGhGYIKCYXDBQyvtZE6uvY0TJF3EvI8YXH5zA2CndtdTZr+6lvWtu95ovbI0vp w/vg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 129si6941025iou.316.2017.08.14.07.26.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:31 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGII-0000DE-1r; Mon, 14 Aug 2017 14:24:38 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIG-0000Bk-I5 for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:36 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id A8/88-02181-3A2B1995; Mon, 14 Aug 2017 14:24:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysyfVTXfxpom RBjtW81gs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkf+zuZC05wVZw4fYetgXE+RxcjF4eQwGZG iaOX/zJCOKcZJVpWfmHrYuTkYBPQlLjz+RMTiC0iIC1x7fNlsCJmgeWMEhv2r2AHSQgLuEus/ PyCFcRmEVCVePfyAQuIzStgKXH73z2wQRIC8hK72i6C1XAKWEl03t0JViMEVHNi9Wy2CYzcCx gZVjFqFKcWlaUW6Roa6yUVZaZnlOQmZuboGhoY6+WmFhcnpqfmJCYV6yXn525iBPqYAQh2MG7 b7nmIUZKDSUmUN8GnN1KILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG/qxomRQoJFqempFWmZOcBg g0lLcPAoifDOAknzFhck5hZnpkOkTjHqcrya8P8bkxBLXn5eqpQ4bzlIkQBIUUZpHtwIWOBfY pSVEuZlBDpKiKcgtSg3swRV/hWjOAejkjDvkQ1AU3gy80rgNr0COoIJ6Ig+kPt5i0sSEVJSDY zHP/2RNbh71lfgEvcEhi1uHR3eH34Y/OY6aJJlbf2w8blX/re84CTDXGOPm4xPCp2+1t2eeaX m8O95r79qqWxcxcR4ZbJULfOf+9q+Me/nLl/Xz5z9Nmxeje80zolbtu/69vZj/qVFpQ83ztry QtzwsOblC/2cUW4HnwqpVSoK8et4T3TQDa9VYinOSDTUYi4qTgQAuVrgJncCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1502720674!105894450!1 X-Originating-IP: [217.140.101.70] 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 42837 invoked from network); 14 Aug 2017 14:24:35 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-15.tower-31.messagelabs.com with SMTP; 14 Aug 2017 14:24:35 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C6F0165C; Mon, 14 Aug 2017 07:24:34 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39A713F483; Mon, 14 Aug 2017 07:24:33 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:54 +0100 Message-Id: <20170814142418.13267-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 03/27] xen/x86: mm: Don't check alloc_boot_pages return 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" The only way alloc_boot_pages will return 0 is during the error case. Although, Xen will panic in the error path. So the check in the caller is pointless. Looking at the loop, my understanding is it will try to allocate in smaller chunk if a bigger chunk fail. Given that alloc_boot_pages can never check, the loop seems unecessary. Signed-off-by: Julien Grall Reviewed-by: Jan Beulich Reviewed-by: Andre Przywara --- Cc: Jan Beulich Cc: Andrew Cooper I haven't tested this code, only build test it. I can't see how alloc_boot_pages would return 0 other than the error path. --- xen/arch/x86/mm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index f53ca43554..66e337109d 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -200,11 +200,7 @@ static void __init init_frametable_chunk(void *start, void *end) */ while ( step && s + (step << PAGE_SHIFT) > e + (4 << PAGE_SHIFT) ) step >>= PAGETABLE_ORDER; - do { - mfn = alloc_boot_pages(step, step); - } while ( !mfn && (step >>= PAGETABLE_ORDER) ); - if ( !mfn ) - panic("Not enough memory for frame table"); + mfn = alloc_boot_pages(step, step); map_pages_to_xen(s, mfn, step, PAGE_HYPERVISOR); } From patchwork Mon Aug 14 14:23:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110023 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281996obb; Mon, 14 Aug 2017 07:26:39 -0700 (PDT) X-Received: by 10.107.173.150 with SMTP id m22mr19305889ioo.264.1502720799749; Mon, 14 Aug 2017 07:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720799; cv=none; d=google.com; s=arc-20160816; b=fEeDN2X3mPW/AkxEg+nBU01pMI39dwK92NdwO2YHu8PATE4ESvQWU9l+WWn5UZB/Z7 MXs4FPfpfhtjmrKHylVUVBFpVNCg6YSqpCXS0b7M1PkHW04yYSY4Vj1w5Xo/EqwisobL ENVGqEpG2kRLljDPIJJru1W4SkLyd/WL0yfxqtmxbt3nlLDZyEcqF4lslhZcaOBjgovn yOkQZ4XcCNU9eAP3Zvet8Q95oOs+ZR6M79F1CeuaR3AdQ5kIWZJPxGWr2ywjl+Ew7Onw pKoek9vAE0gXz24nK5IvYVOUiKymngCKa8yDDFG11HJa4q9p/S1Rqa+VUfU+ZIzQtDCC m3jQ== 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:arc-authentication-results; bh=2D7UBZz3v8W8EHFw32152XF6iDS3RFkmLF6yIrhZmQY=; b=Imeq7bUN3gzrAWwVy3b0SqiN6tp9GITENI1GVpi3++KvJxbfRef7lKfelyyzqki26l SvN0VTYsiwoQEvJBd/jnba9GihgqioFLRsaW3+aYeHTKQ0/IPBvPuYfxhHRW7pkEWu8b dnHxLjqRswBQBbYQ4U/vS9C02VsjyZ51iEJJW6ilg7EGqcP9kx3g9lSMQYsghi4uB9S0 dEKljESZiVskmXqNQ7ZlwQJ/KU7+mr5TVe/85w0NX7cOJ5MXdLBjY2umVAaNXHazOtz6 f1nh0SleHfQJgjJUgQi4Dmlnkwk5SGEznvRakzZHZZRodImQftI9rcSTHf6bTKW2bqpt ofaA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 91si7153653ioi.126.2017.08.14.07.26.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:39 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIK-0000Es-8p; Mon, 14 Aug 2017 14:24:40 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGII-0000DU-KN for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:38 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 0E/D4-03557-5A2B1995; Mon, 14 Aug 2017 14:24:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXfppom RBj+ei1ks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkHLnSzFlwTrNh1dxdjA+MC/i5GLg4hgc2M EguP/WbpYuQEck4zShw6rQ5iswloStz5/IkJxBYRkJa49vkyI0gDs8BrJonPW7cxgySEBQIk7 ndfB7NZBFQlHpz7zghi8wpYSrz7+QNsqISAvMSutousIDangJVE592dUMssJU6sns02gZF7AS PDKkaN4tSistQiXUMDvaSizPSMktzEzBwgz0wvN7W4ODE9NScxqVgvOT93EyPQwwxAsIPx+Pu 4Q4ySHExKorwJPr2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4UzdOjBQSLEpNT61Iy8wBhhpM WoKDR0mEdxZImre4IDG3ODMdInWKUZfj1YT/35iEWPLy81KlxHlrNgAVCYAUZZTmwY2Ahf0lR lkpYV5GoKOEeApSi3IzS1DlXzGKczAqCfM6gaziycwrgdv0CugIJqAj+kDu5y0uSURISTUwNr 48fZw1bN5f3zec5e19G/0MC+Xkn8608j0f2FDwKa7n0s4Mi2751Lp073My5y957ZS0eZ4h31X 2t0EuMUyYxzB/skRnRLDexJv3b5ZpOtwt4ou4HabffnLjzd1v3Pv1p+TkrBIXKgiKSA8J2sTy 6fr0ZSqh9yzvJwm9Se/nmFFRW5thxKrEUpyRaKjFXFScCABxqgoIdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1502720676!111915511!1 X-Originating-IP: [217.140.101.70] 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 26572 invoked from network); 14 Aug 2017 14:24:37 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:37 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D7AE164F; Mon, 14 Aug 2017 07:24:36 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ACC873F483; Mon, 14 Aug 2017 07:24:34 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:55 +0100 Message-Id: <20170814142418.13267-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, Wei Liu , George Dunlap , andre.przywara@arm.com, Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 04/27] xen/mm: Move {G, M]FN <-> {G, M}ADDR helpers to common code 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" Helpers to convert {G,M}FN to {G,M}ADDR and vice-versa were recently introduced on ARM. However, they could be used in common code to simplify a bit the code when using typesafes. Signed-off-by: Julien Grall --- Cc: Stefano Stabellini Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu --- xen/include/asm-arm/mm.h | 4 ---- xen/include/xen/mm.h | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index ef84b72474..28bdcc900e 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -207,10 +207,6 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) #define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) #define paddr_to_pdx(pa) pfn_to_pdx(paddr_to_pfn(pa)) -#define gfn_to_gaddr(gfn) pfn_to_paddr(gfn_x(gfn)) -#define gaddr_to_gfn(ga) _gfn(paddr_to_pfn(ga)) -#define mfn_to_maddr(mfn) pfn_to_paddr(mfn_x(mfn)) -#define maddr_to_mfn(ma) _mfn(paddr_to_pfn(ma)) #define vmap_to_mfn(va) paddr_to_pfn(virt_to_maddr((vaddr_t)va)) #define vmap_to_page(va) mfn_to_page(vmap_to_mfn(va)) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 503b92e4b0..eb0409d832 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -92,6 +92,9 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) return mfn_x(x) == mfn_x(y); } +#define maddr_to_mfn(maddr) _mfn(paddr_to_pfn(maddr)) +#define mfn_to_maddr(mfn) pfn_to_paddr(mfn_x(mfn)) + TYPE_SAFE(unsigned long, gfn); #define PRI_gfn "05lx" #define INVALID_GFN _gfn(~0UL) @@ -130,6 +133,9 @@ static inline bool_t gfn_eq(gfn_t x, gfn_t y) return gfn_x(x) == gfn_x(y); } +#define gaddr_to_gfn(gaddr) _gfn(paddr_to_pfn(gaddr)) +#define gfn_to_gaddr(gfn) pfn_to_paddr(gfn_x(gfn)) + TYPE_SAFE(unsigned long, pfn); #define PRI_pfn "05lx" #define INVALID_PFN (~0UL) From patchwork Mon Aug 14 14:23:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110025 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4282144obb; Mon, 14 Aug 2017 07:26:48 -0700 (PDT) X-Received: by 10.36.167.70 with SMTP id s6mr5658354iti.156.1502720808620; Mon, 14 Aug 2017 07:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720808; cv=none; d=google.com; s=arc-20160816; b=lR387AF+tN4w03h2UJR3ixk8tD6GfElluFcyMIK3XIbY1fips/RQ4k2FJUwrXgSZCw c1txbsHwEAtSlYyHOV2BZ58W7S4J48kzxgF50k5dOZ7cH+fKbToc8BddVTgGcLoSOFl/ VDTu3lu629uzPyaBrfXTf7l3w2jDi2xYt2VE/7eOmly1OkVRZGGmMrdGPJhh4LBQHn4Q Ay2cbVmK+Y42LKpavptcXOhOynTPGaOPvAuellgsgUjLcEOn3YWI5UfZREmMjneut0KC orD44ZV3U83dTkEfSqLQLSboDnt/d4iyVhN6epDOK8RVbnhSylaOR59z23chhaNmH6pb STfQ== 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:arc-authentication-results; bh=hyZmSgZAwCmFOZEwG45J+uvYpyeh+VTujyi+woe+L2Y=; b=jGr3Y1FD3gv9H4/RuFYQbOiJ6NX4D7YZik5pZSx8NkA2Zjf4OvByrtAKdpjs7n8rVu 3K7siuhZF+SbviryVdEIfm+YEY6XaT9jKo5VzkACk6WtQQ0DpuCvYmgtE3KjhiPXlSR8 uTOif7SGDKkdsfY9Yn6f0L2lEpdgo+BmAcBN0uQ+LXRSYNOxnN7CvksuYfkJM4ZJRvxY hNdjfQbHuUTvlzCDIqjcxdmoLAtZFcxy7FFy7Cxz8njp0m8jD9a7sbxCcia/x/r/F2Be XuLm57NP+ASnN0m8WdWd5kMXfIq2KpZ5rouyIyo0mWMnAa5F1ykBt7k8PtxguGprHkF2 XIoA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id i14si7042439ioa.297.2017.08.14.07.26.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:48 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIM-0000Ht-Fa; Mon, 14 Aug 2017 14:24:42 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIL-0000Fh-8e for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:41 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id C0/7E-03937-8A2B1995; Mon, 14 Aug 2017 14:24:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRWlGSWpSXmKPExsVysyfVTXf5pom RBut6NC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyP3yaxFzxyqGjae4u9gXGKSRcjF4eQwGZG ibk9/cwQzmlGics/zjJ1MXJysAloStz5/AnMFhGQlrj2+TIjSBGzwGsmic9btzGDJIQFvCUer n7ECmKzCKhKdHxqZASxeQUsJaZ/3wBmSwjIS+xquwhWwylgJdF5dycLiC0EVHNi9Wy2CYzcCx gZVjFqFKcWlaUW6RoZ6CUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBPqYAQh2MP5 aFnCIUZKDSUmUN8GnN1KILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG/qxomRQoJFqempFWmZOcBg g0lLcPAoifCu3QCU5i0uSMwtzkyHSJ1iNObYsHr9FyaOVxP+f2MSYsnLz0uVEud9BVIqAFKaU ZoHNwgWBZcYZaWEeRmBThPiKUgtys0sQZV/xSjOwagkzFsJcg9PZl4J3L5XQKcwAZ3SB/IFb3 FJIkJKqoFxV3nH1FDLy0Ki75NizPoEz1Q9NDE9duhQ55Iyj7mO/dMsa61fbtu/oWJDh7d3wMz abQ1760wNr558fap7zUnzD0sOPVG1ZPypHH9h55WOvs6Y8OWbzGY2HckMsn56ZLc3YyKnwPq3 S4otC2cqV/1e0NfQnOTObqbzf2cAs7Avb2Puvktv3QyUWIozEg21mIuKEwGPkTwnfQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1502720679!100827900!1 X-Originating-IP: [217.140.101.70] 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 13571 invoked from network); 14 Aug 2017 14:24:39 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:39 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CE64B1682; Mon, 14 Aug 2017 07:24:38 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DDAF93F483; Mon, 14 Aug 2017 07:24:36 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:56 +0100 Message-Id: <20170814142418.13267-6-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, Wei Liu , George Dunlap , andre.przywara@arm.com, Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 05/27] xen/mm: Use typesafe MFN for alloc_boot_pages return 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" At the moment, most of the callers will have to use mfn_x. However follow-up patches will remove some of them by propagating the typesafe a bit further. Signed-off-by: Julien Grall --- Cc: Stefano Stabellini Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu --- xen/arch/arm/mm.c | 26 ++++++++++++++------------ xen/arch/arm/setup.c | 4 ++-- xen/arch/x86/mm.c | 4 ++-- xen/arch/x86/numa.c | 2 +- xen/arch/x86/srat.c | 2 +- xen/common/page_alloc.c | 7 +++---- xen/drivers/acpi/osl.c | 2 +- xen/include/xen/mm.h | 3 +-- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index a810a056d7..b3def63ed7 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -864,13 +864,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, } else { - unsigned long first_mfn = alloc_boot_pages(1, 1); + mfn_t first_mfn = alloc_boot_pages(1, 1); - clear_page(mfn_to_virt(first_mfn)); - pte = mfn_to_xen_entry(_mfn(first_mfn), WRITEALLOC); + clear_page(mfn_to_virt(mfn_x(first_mfn))); + pte = mfn_to_xen_entry(first_mfn, WRITEALLOC); pte.pt.table = 1; write_pte(p, pte); - first = mfn_to_virt(first_mfn); + first = mfn_to_virt(mfn_x(first_mfn)); } pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); @@ -891,11 +891,12 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) unsigned long nr_pages = (pe - ps) >> PAGE_SHIFT; unsigned long nr_pdxs = pfn_to_pdx(nr_pages); unsigned long frametable_size = nr_pdxs * sizeof(struct page_info); - unsigned long base_mfn; + mfn_t base_mfn; const unsigned long mapping_size = frametable_size < MB(32) ? MB(2) : MB(32); #ifdef CONFIG_ARM_64 lpae_t *second, pte; - unsigned long nr_second, second_base; + unsigned long nr_second; + mfn_t second_base; int i; #endif @@ -908,18 +909,19 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) /* Compute the number of second level pages. */ nr_second = ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT; second_base = alloc_boot_pages(nr_second, 1); - second = mfn_to_virt(second_base); + second = mfn_to_virt(mfn_x(second_base)); for ( i = 0; i < nr_second; i++ ) { - clear_page(mfn_to_virt(second_base + i)); - pte = mfn_to_xen_entry(_mfn(second_base + i), WRITEALLOC); + clear_page(mfn_to_virt(mfn_x(mfn_add(second_base, i)))); + pte = mfn_to_xen_entry(mfn_add(second_base, i), WRITEALLOC); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); } - create_mappings(second, 0, base_mfn, frametable_size >> PAGE_SHIFT, mapping_size); + create_mappings(second, 0, mfn_x(base_mfn), frametable_size >> PAGE_SHIFT, + mapping_size); #else - create_mappings(xen_second, FRAMETABLE_VIRT_START, - base_mfn, frametable_size >> PAGE_SHIFT, mapping_size); + create_mappings(xen_second, FRAMETABLE_VIRT_START, mfn_x(base_mfn), + frametable_size >> PAGE_SHIFT, mapping_size); #endif memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info)); diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 3b34855668..277b566b88 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -561,7 +561,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) init_boot_pages(pfn_to_paddr(boot_mfn_start), pfn_to_paddr(boot_mfn_end)); /* Copy the DTB. */ - fdt = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); + fdt = mfn_to_virt(mfn_x(alloc_boot_pages(dtb_pages, 1))); copy_from_paddr(fdt, dtb_paddr, dtb_size); device_tree_flattened = fdt; @@ -671,7 +671,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) dtb_pages = (dtb_size + PAGE_SIZE-1) >> PAGE_SHIFT; /* Copy the DTB. */ - fdt = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); + fdt = mfn_to_virt(mfn_x(alloc_boot_pages(dtb_pages, 1))); copy_from_paddr(fdt, dtb_paddr, dtb_size); device_tree_flattened = fdt; diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 66e337109d..dc54ebf2e6 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -200,7 +200,7 @@ static void __init init_frametable_chunk(void *start, void *end) */ while ( step && s + (step << PAGE_SHIFT) > e + (4 << PAGE_SHIFT) ) step >>= PAGETABLE_ORDER; - mfn = alloc_boot_pages(step, step); + mfn = mfn_x(alloc_boot_pages(step, step)); map_pages_to_xen(s, mfn, step, PAGE_HYPERVISOR); } @@ -5417,7 +5417,7 @@ void *alloc_xen_pagetable(void) return ptr; } - return mfn_to_virt(alloc_boot_pages(1, 1)); + return mfn_to_virt(mfn_x(alloc_boot_pages(1, 1))); } void free_xen_pagetable(void *v) diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index ffeba6e180..90422517b0 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -99,7 +99,7 @@ static int __init populate_memnodemap(const struct node *nodes, static int __init allocate_cachealigned_memnodemap(void) { unsigned long size = PFN_UP(memnodemapsize * sizeof(*memnodemap)); - unsigned long mfn = alloc_boot_pages(size, 1); + unsigned long mfn = mfn_x(alloc_boot_pages(size, 1)); memnodemap = mfn_to_virt(mfn); mfn <<= PAGE_SHIFT; diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index 95660a9bbc..5d38a9ac62 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -193,7 +193,7 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) "Not used.\n"); return; } - mfn = alloc_boot_pages(PFN_UP(slit->header.length), 1); + mfn = mfn_x(alloc_boot_pages(PFN_UP(slit->header.length), 1)); acpi_slit = mfn_to_virt(mfn); memcpy(acpi_slit, slit, slit->header.length); } diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 64fe951e8d..ecffac6a28 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -315,8 +315,7 @@ void __init init_boot_pages(paddr_t ps, paddr_t pe) } } -unsigned long __init alloc_boot_pages( - unsigned long nr_pfns, unsigned long pfn_align) +mfn_t __init alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align) { unsigned long pg, _e; unsigned int i = nr_bootmem_regions; @@ -345,14 +344,14 @@ unsigned long __init alloc_boot_pages( if ( pg + nr_pfns > PFN_DOWN(highmem_start) ) continue; r->s = pg + nr_pfns; - return pg; + return _mfn(pg); } #endif _e = r->e; r->e = pg; bootmem_region_add(pg + nr_pfns, _e); - return pg; + return _mfn(pg); } BUG(); diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 9881db19da..52c9b4ba9a 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -214,7 +214,7 @@ void *__init acpi_os_alloc_memory(size_t sz) void *ptr; if (system_state == SYS_STATE_early_boot) - return mfn_to_virt(alloc_boot_pages(PFN_UP(sz), 1)); + return mfn_to_virt(mfn_x(alloc_boot_pages(PFN_UP(sz), 1))); ptr = xmalloc_bytes(sz); ASSERT(!ptr || is_xmalloc_memory(ptr)); diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index eb0409d832..cf3f0fc396 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -157,8 +157,7 @@ struct domain *__must_check page_get_owner_and_reference(struct page_info *); /* Boot-time allocator. Turns into generic allocator after bootstrap. */ void init_boot_pages(paddr_t ps, paddr_t pe); -unsigned long alloc_boot_pages( - unsigned long nr_pfns, unsigned long pfn_align); +mfn_t alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align); void end_boot_allocator(void); /* Xen suballocator. These functions are interrupt-safe. */ From patchwork Mon Aug 14 14:23:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110024 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4282133obb; Mon, 14 Aug 2017 07:26:48 -0700 (PDT) X-Received: by 10.36.184.196 with SMTP id m187mr6527880ite.18.1502720808220; Mon, 14 Aug 2017 07:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720808; cv=none; d=google.com; s=arc-20160816; b=eY19vDmVekLkfOESRtQprQ8gIXiyZwvSDz8QgUkFRAiSKq+x/daEpE/dJfmnmj1WRd y/YHcykYCQ811vAc8mW3mWCNnmdW5aoCYaBQtBX0eoU3wPTSnRXqp9kEQUmUO8gksFLA xYNSLdqYMIF2RQ49daMhuOypJ77UFYhAKai3YQIOpzh1O1pNGNrsu03Cqc48fk8yoMXq /e6YudDhbNgKcL2VaUsre/NvgDRsObP7uW3jcUUj3vUhTc9EdndDo1YIOdMsxJf0qh7d eYh37+AmtGpbg36nMcIqfBM5JTABEfRtMw/Xrqo6tXyO4+BREE7mu+fLALaTUKz9cLWc Ys7Q== 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:arc-authentication-results; bh=PoxHdrXraAFqY7iC6LQR+No7FgK8pgMlpE7aIfJy/DI=; b=o4vNfaO/bdNtiQGUVe8grUBsqhobhlR3jFm6Lygz84TMf090l0IKMf5DvKBdG/9wTs ZNtWay3W89VXMR5LaIgDzbZc4+PWJZn41Vm0vwaLCAf7PoZpRdhrCnClrYyW+B4LHzWv qGhOr0kCq135yTt5AE0xysOc1DLL0F3e6VVJo2g62AZu67bBnTR69WoIYgdN+AHFcZAW tfqXd6wS4GtKK1J6Zfe/+c7dZTeUc29Mqua3M4le/BX2yVAVzwMXAiCj/xpF1XpBexi6 XTW79s0tbyrHL1im7yiIwAxZsLpjguoUWPLDfKyZ1fdD549XB5gMDvXdi9D9ZuklzW+3 hu0g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f202si5603071itb.121.2017.08.14.07.26.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:48 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIN-0000JN-Mp; Mon, 14 Aug 2017 14:24:43 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIN-0000IF-72 for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:43 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 88/9F-01994-AA2B1995; Mon, 14 Aug 2017 14:24:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXflpom RBnP+GVks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnzJrWyFEwUrri9oZe1gXGjQBcjJ4eQwGZG ibYz5V2MXED2aUaJoysvsIIk2AQ0Je58/sQEYosISEtc+3yZEaSIWeA1k8TnrduYQRLCAlES0 y/+BrNZBFQlDva+AWvgFbCUWLPiIjuILSEgL7Gr7SLYUE4BK4nOuztZIDZbSpxYPZttAiP3Ak aGVYwaxalFZalFukYWeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgR6uZ2Bg3MH Yt8rvEKMkB5OSKG+CT2+kEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQne1I0TI4UEi1LTUyvSMnOA oQaTluDgURLhnQWS5i0uSMwtzkyHSJ1i1OV4NeH/NyYhlrz8vFQpcd5ykCIBkKKM0jy4EbCwv 8QoKyXMy8jAwCDEU5BalJtZgir/ilGcg1FJmHczyBSezLwSuE2vgI5gAjqiD+R+3uKSRISUVA Pj9NV6TjsSWye9vXerKO6QZ+fNPd1H5gasVWjax7D12xZb0aZpp4PN16psMtM9pc6dM0nQvux pJZ/WwXkuPk+Lj+ud4g8x+fzm11G5O9tev332UlRg85qYXfWvtvjut2Hg/LJ+5cGGLR2NjC6b 97a9Oalqf8/ScE3NDu55nE57n+V8b9XaFyejrsRSnJFoqMVcVJwIAIMeOOJ2AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1502720681!86596146!1 X-Originating-IP: [217.140.101.70] 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 21556 invoked from network); 14 Aug 2017 14:24:41 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-206.messagelabs.com with SMTP; 14 Aug 2017 14:24:41 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0BB181688; Mon, 14 Aug 2017 07:24:41 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1B3BC3F483; Mon, 14 Aug 2017 07:24:38 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:57 +0100 Message-Id: <20170814142418.13267-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, Wei Liu , George Dunlap , andre.przywara@arm.com, Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 06/27] xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn 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" virt_to_mfn may by overridden by the source files, for improving locally typesafe. Therefore map_domain_page has to use __virt_to_mfn to prevent any compilation issue in sources files that override the helper. Signed-off-by: Julien Grall Acked-by: Jan Beulich --- Cc: Stefano Stabellini Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu --- xen/include/asm-arm/mm.h | 3 ++- xen/include/xen/domain_page.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 28bdcc900e..71d7d36992 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -253,7 +253,7 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags) /* Convert between Xen-heap virtual addresses and machine frame numbers. */ #define __virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT) -#define mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT)) +#define __mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT)) /* * We define non-underscored wrappers for above conversion functions. @@ -263,6 +263,7 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags) #define mfn_to_page(mfn) __mfn_to_page(mfn) #define page_to_mfn(pg) __page_to_mfn(pg) #define virt_to_mfn(va) __virt_to_mfn(va) +#define mfn_to_virt(mfn) __mfn_to_virt(mfn) /* Convert between Xen-heap virtual addresses and page-info structures. */ static inline struct page_info *virt_to_page(const void *v) diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h index 93f2a5aaf7..890bae5b9c 100644 --- a/xen/include/xen/domain_page.h +++ b/xen/include/xen/domain_page.h @@ -53,7 +53,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg) #else /* !CONFIG_DOMAIN_PAGE */ -#define map_domain_page(mfn) mfn_to_virt(mfn_x(mfn)) +#define map_domain_page(mfn) __mfn_to_virt(mfn_x(mfn)) #define __map_domain_page(pg) page_to_virt(pg) #define unmap_domain_page(va) ((void)(va)) #define domain_page_map_to_mfn(va) virt_to_mfn((unsigned long)(va)) From patchwork Mon Aug 14 14:23:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110014 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281800obb; Mon, 14 Aug 2017 07:26:29 -0700 (PDT) X-Received: by 10.107.55.198 with SMTP id e189mr22541398ioa.34.1502720789391; Mon, 14 Aug 2017 07:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720789; cv=none; d=google.com; s=arc-20160816; b=yiAhdeS4d5u1Cqef6a1vsZAvXOBcoNl8AeEIgBVMB0AA82NRGLA/dYzXLSgWUvDYLu k7PztqDUStwvBBYwXjGdgzhHCWDGZ59W8q1T2loOp9tSlmtFHKJOtbGR6aVBNdp3LMkS NbwYKi+TowN4p4riY1rq6BG4q0N4IrSrh4AWOLcN+t6VVRbpTB/A45HQiluoLN4Gareu cd46kE6FtedYtM2LccTkGfHKBmKv1dfYvE9Q3so+AaVuMg31wRcCQK8j0iAyarW38l53 P0IPqoX+lzp+3EA2rHskkGXne7tjjOhanlI15GQ8IdDzq+rP1WYbEMp5fk5tVXXmnmpD nwEg== 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:arc-authentication-results; bh=vf2ziABXSBzmwBm84TseW46GLyFOKN5BnMzsNR79UwY=; b=KFShX1HiR9VYINRTGp2RqHhW/cm26R5bkVglSHuVxVm2sk1TmSnvHRQo5hcMzHanmF d+4BsBixQ6QrLGhhhtTDltBulrv7j+gsZiZhvj+ehKLQTI7E1A051GFE3CNXQAXvvgwE Ocq7XQkxlg7LnuLgV7NXfni5teltQx5KA7noMwwbItGjdcK8mYluB6+gWInGj4UvAKpP yGVpejQG98P147OikauUq2gEWKnLVnN08odTc0cycVzdoy6jCqdfh+6At55DvEnkd/fF up+nO7AVTjiyu3gmLPOpLctDjma5dhNpLweV5kyfcEl6IZCOQ5JKjI3GEy8+Iczq1mPA I1HQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w8si7405797iow.24.2017.08.14.07.26.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:29 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIP-0000L6-1D; Mon, 14 Aug 2017 14:24:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIN-0000Fh-PC for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:43 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id BB/8E-03937-BA2B1995; Mon, 14 Aug 2017 14:24:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXfVpom RBlsmWlgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkLHp1nLJguUXHn6HPGBsbzQl2MXBxCApsZ Ja7uuMMK4ZxmlFgx+QJzFyMnB5uApsSdz5+YQGwRAWmJa58vM4LYzAKREoc//GAHsYUFPCTuH r4NZrMIqEp8vnwNrJdXwFLiy+y7YHEJAXmJXW0XWUFsTgEric67O1lAbCGgmhOrZ7NNYORewM iwilGjOLWoLLVI18hML6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMj0MMMQLCD8cy CwEOMkhxMSqK8CT69kUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeFM3TowUEixKTU+tSMvMAYYa TFqCg0dJhPcGSJq3uCAxtzgzHSJ1ilGX49WE/9+YhFjy8vNSpcR5y0GKBECKMkrz4EbAwv4So 6yUMC8j0FFCPAWpRbmZJajyrxjFORiVhHk3g0zhycwrgdv0CugIJqAj+kDu5y0uSURISTUwzj Y5pKei9uibtp2xi8WXicpr6o+ejNQ4faOKPzlZXv7H92kf5B/q7Lm08vRx78bix0uPe+4wdTF 4OCvUpEPIXEf3lhcbq86Og6ne11ac/Lyysrt6RfrluQ2P5lrvTOV1MvkYJZR3wlxTReqvRu6b uvLpVyMn36mKKNl+zPzs1Rk3v3Es2so8W4mlOCPRUIu5qDgRAEuQArN2AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1502720682!111835689!1 X-Originating-IP: [217.140.101.70] 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 57328 invoked from network); 14 Aug 2017 14:24:42 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-9.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:42 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 360C61713; Mon, 14 Aug 2017 07:24:42 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A6B33F483; Mon, 14 Aug 2017 07:24:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:58 +0100 Message-Id: <20170814142418.13267-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 07/27] xen/arm: mm: Redefine mfn_to_virt to use typesafe 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" This add a bit more safety in the memory subsystem code. Signed-off-by: Julien Grall --- xen/arch/arm/mm.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b3def63ed7..349ac58ffe 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -47,6 +47,8 @@ struct domain *dom_xen, *dom_io, *dom_cow; /* 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 mfn_to_virt +#define mfn_to_virt(mfn) __mfn_to_virt(mfn_x(mfn)) /* Static start-of-day pagetables that we use before the allocators * are up. These are used by all CPUs during bringup before switching @@ -837,7 +839,7 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, * Virtual address aligned to previous 1GB to match physical * address alignment done above. */ - vaddr = (vaddr_t)mfn_to_virt(base_mfn) & FIRST_MASK; + vaddr = (vaddr_t)__mfn_to_virt(base_mfn) & FIRST_MASK; while ( mfn < end_mfn ) { @@ -849,7 +851,7 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, /* mfn_to_virt is not valid on the 1st 1st mfn, since it * is not within the xenheap. */ first = slot == xenheap_first_first_slot ? - xenheap_first_first : mfn_to_virt(p->pt.base); + xenheap_first_first : __mfn_to_virt(p->pt.base); } else if ( xenheap_first_first_slot == -1) { @@ -866,11 +868,11 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, { mfn_t first_mfn = alloc_boot_pages(1, 1); - clear_page(mfn_to_virt(mfn_x(first_mfn))); + clear_page(mfn_to_virt(first_mfn)); pte = mfn_to_xen_entry(first_mfn, WRITEALLOC); pte.pt.table = 1; write_pte(p, pte); - first = mfn_to_virt(mfn_x(first_mfn)); + first = mfn_to_virt(first_mfn); } pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); @@ -909,10 +911,10 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) /* Compute the number of second level pages. */ nr_second = ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT; second_base = alloc_boot_pages(nr_second, 1); - second = mfn_to_virt(mfn_x(second_base)); + second = mfn_to_virt(second_base); for ( i = 0; i < nr_second; i++ ) { - clear_page(mfn_to_virt(mfn_x(mfn_add(second_base, i)))); + clear_page(mfn_to_virt(mfn_add(second_base, i))); pte = mfn_to_xen_entry(mfn_add(second_base, i), WRITEALLOC); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); @@ -1005,7 +1007,7 @@ static int create_xen_entries(enum xenmap_operation op, BUG_ON(!lpae_valid(*entry)); - third = mfn_to_virt(entry->pt.base); + third = __mfn_to_virt(entry->pt.base); entry = &third[third_table_offset(addr)]; switch ( op ) { From patchwork Mon Aug 14 14:23:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110016 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281821obb; Mon, 14 Aug 2017 07:26:30 -0700 (PDT) X-Received: by 10.36.127.145 with SMTP id r139mr5477438itc.13.1502720790418; Mon, 14 Aug 2017 07:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720790; cv=none; d=google.com; s=arc-20160816; b=bgsFeR4l5yrow7vKGID3PMENS5v+uFiwu2lPZaJEAPwYAMnjyHDkV0Rq55pBCcbN1I y3CxRDEPD1zStN8s8D9c6jRCZalevUVMM3RrDfPFZlsNRCuAGrpx2G9ZKfYsI3G+kVMw pHjXUdZpBGY0OEP+1Lp6UeHAJA6qXxDIeqIFtTfbkjD4HS1my5+W9cSpjETYkOxbLcAS 53Vg4x1umuzuWnMl8BHzTZp/3mc7fyFLNA3F7WwuZOU0mOI4g0pV8003lOGEeR1LbQJW Tsgk8Mo8Pn6a/SWnB/INfpiaiw46v5+NV+AXae+9u0fb7apd0wFF0n/ZkAqxaDQ+2CEe Jgzg== 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:arc-authentication-results; bh=2vSY2Fo2YsPcjxs943nmvS7NkhxSdBkLnQjEkQp/rP4=; b=K1fQSDUpE4c6mKGuq2qIRVzt9CyR7nViuB7JaH9rcZ3Z04HY0D7sIk/JpJYOwIC28l S35bPnJtb6wornrrxqC7Wt5dQ997NrZlxelVtma6JbhthXNn6H5jNeR2ltPwfk2BTmBd F9S5jrq9uA923frgOxJJCtblvgVZFa4cVtsRYPmqGm02M2HpwALR7iOHID72+qDHNhbL gaopnl0a+WRRH/AuZOvvYzRc2NCgnZf7UuybNJzW2unF0tge+yi+L/3ojklEpTQ+sOv+ FOnjEaoTt1+DQLm/E/UTJYsJvfd9FJTWqk9UAFWkU0BLnxAZL/TbkHUROStcFLV9s+dJ hq+A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w64si5515773itg.100.2017.08.14.07.26.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:30 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIR-0000Nd-83; Mon, 14 Aug 2017 14:24:47 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIP-0000Lk-Q3 for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:45 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 75/73-02176-DA2B1995; Mon, 14 Aug 2017 14:24:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRWlGSWpSXmKPExsVysyfVTXfNpom RBusmcFss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnnb3xmLLjIVrFw1imWBsaJrF2MXBxCApsZ JRoO97BBOKcZJeZ2LmPqYuTkYBPQlLjz+ROYLSIgLXHt82VGEJtZIFLi8Icf7CC2sICtxNPlN 5i7GDk4WARUJU4uYwUxeQUsJRpnO4JUSAjIS+xqu8gKYnMKWEl03t3JAmILAZWcWD2bbQIj9w JGhlWM6sWpRWWpRbpGeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgb5lAIIdjN/ /OB1ilORgUhLlTfDpjRTiS8pPqcxILM6ILyrNSS0+xKjBwSGwee3qC4xSLHn5ealKErypGydG CgkWpaanVqRl5gCDD6ZUgoNHSYR3Fkiat7ggMbc4Mx0idYrRmKPpw5YvTByvJvz/xiQENklKn PfVBqBSAZDSjNI8uEGwqLjEKCslzMsIdKYQT0FqUW5mCar8K0ZxDkYlYd5KkIU8mXklcPteAZ 3CBHRKH8hHvMUliQgpqQZG3+kaf07xB1jO11idcF2oqkErOFt2m73XuflJgldXLHOT3uixOO6 V6YnV97qOhMhEfNxZ+fD9lxWPOzqn3TBL3sHiU5CxiK1Ml4Ftb8KsTVVL5P7/T7huvPv7k7jY z3sv7T3yuUFJJ+C9p+u5ycWdaiIWASduPDy4163SuyBmpfFa731srAUPlViKMxINtZiLihMBR C6wEoUCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1502720683!107313505!1 X-Originating-IP: [217.140.101.70] 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 64823 invoked from network); 14 Aug 2017 14:24:44 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-9.tower-206.messagelabs.com with SMTP; 14 Aug 2017 14:24:44 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 605061991; Mon, 14 Aug 2017 07:24:43 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 74CB03F483; Mon, 14 Aug 2017 07:24:42 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:59 +0100 Message-Id: <20170814142418.13267-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 08/27] xen/arm: hsr_iabt: Document RES0 field 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" Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/processor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index ab5225fa6c..51645f08c0 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -505,9 +505,9 @@ union hsr { struct hsr_iabt { unsigned long ifsc:6; /* Instruction fault status code */ - unsigned long res0:1; + unsigned long res0:1; /* RES0 */ unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ - unsigned long res1:1; + unsigned long res1:1; /* RES0 */ unsigned long eat:1; /* External abort type */ unsigned long res2:15; unsigned long len:1; /* Instruction length */ From patchwork Mon Aug 14 14:24:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110021 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281882obb; Mon, 14 Aug 2017 07:26:34 -0700 (PDT) X-Received: by 10.36.146.11 with SMTP id l11mr6195811itd.159.1502720793989; Mon, 14 Aug 2017 07:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720793; cv=none; d=google.com; s=arc-20160816; b=rnNZ/7l1rXuIS/YHvDu+0EKcmiecxrxMdLXJ1b47SaRWtPzjIe6PbKwhgCJk/OkHQW rBHbxWgulqk1f2ou3GJJ4pdGWxkQ7ARQpi4/i2LVZyHXsJvkk3BOOu1XREqpy7Z7YfoX fkBHi5IL5qZXdLdC4/Y0/MyR/di96EDEieaIy7X/0ECe4t+JrQ5YkC++PR7TV0kSGzIg omG8kO34vyIpIO44kG2rQ/unB1GmG+WHKkt4Ov2rBK/QV72cBQQmXYxBRSXFi8IX5Peq 41fA4wFehXdYPq6UK1VN8IWlxohrSq6//AG6Zzw0RZIflYTIrx2m3T9zeNIVjH4RQDGu SW4g== 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:arc-authentication-results; bh=XkmVPCN13fb/VDSWit+e6FdctiMYqw5D5WSCXOePlHo=; b=S3l+31lpR+wiJo7BG+THl1nleyrnWkgg4yoHrBqs0yYvyX6Qeq1IMwj/VPhka1dT/Z ICMp2ClI8n83b+HRZn8R6N0D87kAt5iv4rNAdXd+SXbwrhkXEHROwzl3hlqGCYAOFATP yzNx7bqKX9w88VvhWsHjsJrixHlrEMRvLPYW1JMqPju0VW6tl+DnuJvvzeKiYTzdR5An KvkUT9DBsCP52lotR95qHc/DoLjc/ReJvCukgy8PNS3p2aASq6h/y+483HhMB5PYKYVt 74K30pWVzxcIIRCyVnrHmfcn75SrpiGuNqB5Hz6dWLAMXtk6sGdCDa5CcZjwY8jsT8G7 H+MQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 7si4909258iti.114.2017.08.14.07.26.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:33 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIR-0000O7-GF; Mon, 14 Aug 2017 14:24:47 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIQ-0000Ma-Es for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:46 +0000 Received: from [193.109.254.147] by server-11.bemta-6.messagelabs.com id A6/BA-03612-DA2B1995; Mon, 14 Aug 2017 14:24:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTXftpom RBstm8lss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmL/zWzF5zkqWha/I2lgXE3ZxcjF4eQwGZG iZWn25i6GDmBnNOMEmsnOYDYbAKaEnc+fwKLiwhIS1z7fJkRxGYWiJQ4/OEHO4gtLOAq8WLuC jYQm0VAVeLXug1gcV4BK4lpX6axgtgSAvISu9ougtmcQPHOuztZIHZZSpxYPZttAiP3AkaGVY waxalFZalFukameklFmekZJbmJmTm6hgZmermpxcWJ6ak5iUnFesn5uZsYgf5lAIIdjKsWBB5 ilORgUhLlTfDpjRTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwXtj48RIIcGi1PTUirTMHGCgwaQl OHiURHhFgMEmxFtckJhbnJkOkTrFqMvxasL/b0xCLHn5ealS4ryvNgAVCYAUZZTmwY2ABf0lR lkpYV5GoKOEeApSi3IzS1DlXzGKczAqCfNeXQ80hSczrwRu0yugI5iAjugDuZ+3uCQRISXVwM ihGTjdWrZzl/uGGblLUpllj0oEuJi6b14nevfpmQRdVv8pTUrrdK9Yae1OrHNct0SR1am56qq 1w4qlsV1KWZ9fP474Hsf/csoc0Z1MxzPfr6l+uMTr1PuSHyG3Zdvbfmp5MS+LWGs492uLoe6+ TxqH9vGselX/Qd35C+d8zdw3Ahn2V9Yd+KnEUpyRaKjFXFScCACI/ueudQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1502720684!106249368!1 X-Originating-IP: [217.140.101.70] 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 8774 invoked from network); 14 Aug 2017 14:24:45 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:45 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8AB0E1713; Mon, 14 Aug 2017 07:24:44 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9F1673F483; Mon, 14 Aug 2017 07:24:43 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:00 +0100 Message-Id: <20170814142418.13267-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 09/27] xen/arm: traps: Don't define FAR_EL2 for ARM32 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" Aliasing FAR_EL2 to HIFAR makes the code confusing because on ARMv8 FAR_EL2[31:0] is architecturally mapped to HDFAR and FAR_EL2[63:32] to FAR_EL2. See D7.2.30 in ARM DDI 0487B.a. Open-code the alias instead. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/traps.c | 8 +++++++- xen/include/asm-arm/cpregs.h | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index c07999b518..498d8c594a 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2560,11 +2560,17 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, const union hsr hsr) { int rc; - register_t gva = READ_SYSREG(FAR_EL2); + register_t gva; uint8_t fsc = hsr.iabt.ifsc & ~FSC_LL_MASK; paddr_t gpa; mfn_t mfn; +#ifdef CONFIG_ARM_32 + gva = READ_CP32(HIFAR); +#else + gva = READ_SYSREG64(FAR_EL2); +#endif + /* * If this bit has been set, it means that this instruction abort is caused * by a guest external abort. We can handle this instruction abort as guest diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/asm-arm/cpregs.h index af45ec7a65..1889d7cbfb 100644 --- a/xen/include/asm-arm/cpregs.h +++ b/xen/include/asm-arm/cpregs.h @@ -307,7 +307,6 @@ #define ESR_EL1 DFSR #define ESR_EL2 HSR #define FAR_EL1 HIFAR -#define FAR_EL2 HIFAR #define HCR_EL2 HCR #define HPFAR_EL2 HPFAR #define HSTR_EL2 HSTR From patchwork Mon Aug 14 14:24:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110020 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281881obb; Mon, 14 Aug 2017 07:26:34 -0700 (PDT) X-Received: by 10.107.154.75 with SMTP id c72mr19391323ioe.95.1502720793090; Mon, 14 Aug 2017 07:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720793; cv=none; d=google.com; s=arc-20160816; b=KdhAKb8k5n/dDwqJqcBJB0Hq/bkWS3EmnKQ3FRXhdAN7nMr8ReNZdPKuEdJJICBttE PZHjEcCPnB+aUSuxjt1+B7gyjX5qicdIggFjUrsSsKLlfszaxRYQBZN47ncPUwCOs0S/ 2EUJnU7iFnzVsMh867KEwIQXcFdcnJSq4qVEZoj43Yyohe1y5jDSz59QHVHUXBNcMww6 TcOIxwbMxCzKKVJxP/jUdv9dFhI8g06w+Sv2zZXcroYinJ5obIw8LSMAAISGUmpxiMMK PF+RNwfWsTYtFfy+KJIJfpJa6oJ3mVuqCTcLONIdVaWdUO62MaxuhicJu+s1v6FzB7pL 2zvw== 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:arc-authentication-results; bh=x5dyKJ+TZeTzZWYDZFP0xyPUeIGPRFXnOXATrD1+8YA=; b=BYDtl9rP457WZfpm2uH8s0vJJQfre0QyCP5uhPi29UrSv8H4WXgyBLoPrPxWldt4Mt Taimo15utsGp739EYia8lvP9H+FFR3W2bbVkoyySEe5UErDAdhLjcLaGES9g6Hzr/HSo OwIS9C5U667ZNL/u8CGCCMbgtSGtehU5U3BwGJZJWoF9nFIhthLpZP6mtmE7Pp5Z3P7C lfhpe+YfZjas0bzmg4dvOUbCVHpDBLyZIEXpWOr8HJOzKXxknGtWodi42NwjHZCCwjFs 2q8xqjT8J/rLijAtn7gcRXz3ABxJiKfTUETYC0cexYhnpeNlvzSXI2vXI6KhkKFrqdps hukQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id j25si5421261iti.201.2017.08.14.07.26.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:33 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIS-0000Pr-O0; Mon, 14 Aug 2017 14:24:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIR-0000NR-Gp for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:47 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 20/1A-03044-EA2B1995; Mon, 14 Aug 2017 14:24:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRWlGSWpSXmKPExsVysyfVTXfdpom RBnunSlks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkzTx9mL5jCVrF9/wSWBsbTLF2MnBxCApsZ JfZdN+hi5AKyTzNKzD23mBkkwSagKXHn8ycmEFtEQFri2ufLjCA2s0CkxOEPP9hBbGEBa4klv 4+xgdgsAqoSb7ddAKvnFbCS6D/0HywuISAvsavtIiuIzQkU77y7E2qxpcSJ1bPZJjByL2BkWM WoUZxaVJZapGtoqJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJEehfBiDYwfhpWcA hRkkOJiVR3gSf3kghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErypGydGCgkWpaanVqRl5gADDSYt wcGjJMI7CyTNW1yQmFucmQ6ROsVozNH0YcsXJo5XE/5/YxJiycvPS5US5y0HKRUAKc0ozYMbB IuAS4yyUsK8jECnCfEUpBblZpagyr9iFOdgVBLmPbIBaApPZl4J3L5XQKcwAZ3SB/IFb3FJIk JKqoFxtr1e9e57KvKMFbayL+psihbK2s50rHq10Z3nCrvcqcysJ087yiXmPPl+peCf9zKO+7e dfp6rdzT9xPh+QcKy7I8XxJQl35zp/9Z2bVcbU4TXu+QD0wt/z17xtP59/vOEXQ8UJ3xosTW4 4+Vr5afZ+7XZsvSD1Q2pL8b+0/pkir9Ydn74orlLiaU4I9FQi7moOBEADsxM6HsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1502720685!106249371!1 X-Originating-IP: [217.140.101.70] 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 8954 invoked from network); 14 Aug 2017 14:24:46 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:46 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B4E1E199B; Mon, 14 Aug 2017 07:24:45 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C961E3F483; Mon, 14 Aug 2017 07:24:44 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:01 +0100 Message-Id: <20170814142418.13267-11-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 10/27] xen/arm: arm32: Don't define FAR_EL1 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" Aliasing FAR_EL1 to IFAR is wrong because on ARMv8 FAR_EL1[31:0] is architecturally mapped to DFAR and FAR_EL1[63:32] to DFAR. As FAR_EL1 is not currently used in ARM32 code, remove it. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/cpregs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/asm-arm/cpregs.h index 1889d7cbfb..9e138489f0 100644 --- a/xen/include/asm-arm/cpregs.h +++ b/xen/include/asm-arm/cpregs.h @@ -306,7 +306,6 @@ #define DACR32_EL2 DACR #define ESR_EL1 DFSR #define ESR_EL2 HSR -#define FAR_EL1 HIFAR #define HCR_EL2 HCR #define HPFAR_EL2 HPFAR #define HSTR_EL2 HSTR From patchwork Mon Aug 14 14:24:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110000 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281382obb; Mon, 14 Aug 2017 07:26:04 -0700 (PDT) X-Received: by 10.36.125.11 with SMTP id b11mr6165026itc.47.1502720764892; Mon, 14 Aug 2017 07:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720764; cv=none; d=google.com; s=arc-20160816; b=uopGYfg/YY8fq56UO8Q4C/TPYZVI8s3qiDHg5v4/qzcH8Xd26lvqpzQXwJ6JvBx89m dU81CH9vwHGgsI792ALbcnIU0h4O6Zt1PVU8DNXo/uUCh9mPsFTTYtZ6PhqSaQSsPk3c e7lXS5hVPsf6wgUs3IlFQ3Y+QEtGhC3IDMsZf7Ae7zoepr6BOHIP5NMXgZvL3Xb8HZ9t fgE0sdPkvqJs8qVB0p4NyOAwGOuGzEKoua3ajrxpWn7o9NZqRObCkWQsO/ZdIX0XhMiq PjdB6RaJkDXOqPveUIa75mWUVh5LQ25Ztq1HNqBvo7rk1ip/JUIHIsp2flTwHvkjYJbo kW1g== 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:arc-authentication-results; bh=zmEND3D9v9yURw0wae5NJL34eBFUbI4d8al1nqMEEyc=; b=CPlaQnlRFSUVNVdHuU/jMk2rHMmKStBBQwWCAlJT7ZeKqmN7zqBUQq1+s/Rd/9Y1zq wb4A14yKsB+oxN5o5dBY1RoPGdF/T83mYdBmQnWN7a2uwHRroVuO381pAqTRdXuKa2Dt AkWlRkT9AePbDbroMJdPRK9yR2gMAwwQWzF3SO65wOo9ZgYnJF4DjrXG6uvlT+FpefOn n7W+xln2bf1IxWukbZjnly4uoZN4TijAIKIga55lMvk4xk3n0Ld5R3JVjbWtm17NCEk1 gXhqW8Ssoya/uPbpcM1lKmAf55a2T2evyColhuYtdtRiMIiTSkJzdR9iym4QjOgZWzNy CUkw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y14si7142457ioy.189.2017.08.14.07.26.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:04 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIT-0000RK-V6; Mon, 14 Aug 2017 14:24:49 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIS-0000PW-Tl for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:49 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id AA/58-03368-0B2B1995; Mon, 14 Aug 2017 14:24:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXf9pom RBu+Pqlos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnTHn9lKfjNXXFo2grGBsb/HF2MXBxCApsZ JQ49nMMC4ZxmlFj75C5TFyMnB5uApsSdz5/AbBEBaYlrny8zgtjMApEShz/8YAexhQUsJfouL gSLswioSqx8voUFxOYVsJKYsOk1mC0hIC+xq+0iK4jNCRTvvLsTLC4E1Hti9Wy2CYzcCxgZVj FqFKcWlaUW6Roa6yUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBHqYAQh2MH5ZFnC IUZKDSUmUN8GnN1KILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG/qxomRQoJFqempFWmZOcBQg0lL cPAoifDOAknzFhck5hZnpkOkTjHqcrya8P8bkxBLXn5eqpQ476sNQEUCIEUZpXlwI2Bhf4lRV kqYlxHoKCGegtSi3MwSVPlXjOIcjErCvE4gq3gy80rgNr0COoIJ6Ig+kPt5i0sSEVJSDYxhui ktFxiPsGhI6yVcUi9ldg8J2LGj8+jLWuHV3Q6dwnzPS9ckRi9XYYn9UPZ8w3L7EHultT1dZha ZSh8WvRbofll8RS/ghLPNnBzvy19Yj0x1ZDfdZTVzvsv7eUtOHG3gOVreu0ApJDNG7P3tt28k f9fbn71eNn1i1u7cKcm/g2bu0DeKjVJiKc5INNRiLipOBAB0cmrYdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1502720687!77838684!1 X-Originating-IP: [217.140.101.70] 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 60455 invoked from network); 14 Aug 2017 14:24:47 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-21.messagelabs.com with SMTP; 14 Aug 2017 14:24:47 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DF2B01713; Mon, 14 Aug 2017 07:24:46 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F39A53F483; Mon, 14 Aug 2017 07:24:45 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:02 +0100 Message-Id: <20170814142418.13267-12-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 11/27] xen/arm: Add FnV field in hsr_*abt 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" FnV (FAR not Valid) bit was introduced by ARMv8 in both AArch32 and AArch64 (See D7-2275, D7-2277, G6-4958, G6-4962 in ARM DDI 0487B.a). Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/processor.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 51645f08c0..3ef606c554 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -509,7 +509,8 @@ union hsr { unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ unsigned long res1:1; /* RES0 */ unsigned long eat:1; /* External abort type */ - unsigned long res2:15; + unsigned long fnv:1; /* FAR not Valid */ + unsigned long res2:14; unsigned long len:1; /* Instruction length */ unsigned long ec:6; /* Exception Class */ } iabt; /* HSR_EC_INSTR_ABORT_* */ @@ -520,10 +521,11 @@ union hsr { unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ unsigned long cache:1; /* Cache Maintenance */ unsigned long eat:1; /* External Abort Type */ + unsigned long fnv:1; /* FAR not Valid */ #ifdef CONFIG_ARM_32 - unsigned long sbzp0:6; + unsigned long sbzp0:5; #else - unsigned long sbzp0:4; + unsigned long sbzp0:3; unsigned long ar:1; /* Acquire Release */ unsigned long sf:1; /* Sixty Four bit register */ #endif From patchwork Mon Aug 14 14:24:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110027 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4282245obb; Mon, 14 Aug 2017 07:26:55 -0700 (PDT) X-Received: by 10.36.250.67 with SMTP id v64mr6508541ith.127.1502720814936; Mon, 14 Aug 2017 07:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720814; cv=none; d=google.com; s=arc-20160816; b=Ex2vvnXYLoHCSgkwLebY0p8wPkOGnWfZ05i+hhW7Jcopy0NCz36kVF3TFVLkl6A7qo hxWX97yhCeWiRfW6/2MoSC8idNU55mMabcygT+aHYeaNcCT1+Nf+ZU7pj8iMIUhAYRqN XEZxhRimmtN0f44cDB9Nb96rp4nbphdztxMJ4ciZrjfPh46kpVSzUpld5lj9/TIpJXlV OBlzVwDo38rJ1jiSqYfClfQU8Jj1LNCHb0PBCYXxK5AKTokclBva4rD7OIi8oNZaZfCa uvvdHGwdDMPgzKm4aOxqRWlszbgCMokvd6iSvVF+eTS5JtKIjSYcpl4infQyzph6yod1 S2Mw== 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:arc-authentication-results; bh=4mnDHPO8WAMaD0wTpdXXIFQYoM2kJKnTEzD9K9R9mqc=; b=hnb+yjTnTMx5wNdjRMboPyk0TN5psxTF8Pzqf20WkzFraahrBefHKJHqubQ2M7g4H+ 2OF+TT4rdegz32ZlTuTjC6qqS8lz0KiV6K+kNw4icjnMcFzhDsMhLuVFvTJc2Zid461B 3BMMDE0c2pdrqEFIcwFBR47/PFfdCajoao9NUdek+eQ11mpAeZ/sxsDoMMlnDmJsCuRv 8W6NP3czFD7kO5ehNEiryWKENY57fio6RG0sCeJDvsICWcqfup9CovWkyaWPS3vghX2e J5lr/QmDurMd7gyJwe0ATa9wZBiD1qK2rh0l0jAxuwMsKP0XxDN33viEnUOX/8LnTMyC ELBA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m133si5228655itg.157.2017.08.14.07.26.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:54 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIV-0000T1-6U; Mon, 14 Aug 2017 14:24:51 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIU-0000R3-4i for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:50 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 28/11-01732-1B2B1995; Mon, 14 Aug 2017 14:24:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRWlGSWpSXmKPExsVysyfVTXfDpom RBlvbTCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1owDtzezFFzjrLg29RNbA+M69i5GLg4hgc2M EiemP2eGcE4zSqydsIC1i5GTg01AU+LO509MILaIgLTEtc+XGUFsZoFIicMffrCD2MICsRIXu jexdDFycLAIqEoc6rYFCfMKWElM+LgBrFVCQF5iV9tFsJGcQPHOuztZQGwhAUuJE6tns01g5F 7AyLCKUb04tagstUjXQi+pKDM9oyQ3MTNH19DAWC83tbg4MT01JzGpWC85P3cTI9C7DECwg/F Cu/MhRkkOJiVR3gSf3kghvqT8lMqMxOKM+KLSnNTiQ4zqHBwCjRPfhkux5OXnpSpJ8KZunBgp JFiUmp5akZaZAww+mEoJDh4lEd5ZIGne4oLE3OLMdIjUKUZdjlcT/n9jEgKbISXOWw5SJABSl FGaBzcCFgmXGGWlhHkZge4T4ilILcrNLEGVf8UozsGoJMxbCTKFJzOvBG7TK6AjmICO6AN5hb e4JBEhJdXAuCDP6PHr3o8vw43kDZfJrJhfPWNC1fpXHW9q+bbf15W49P7X3D5zVS3ri4L2jYa uE8z8z7m7LU2x2LD8q9aViOSwSamfDR2+Xyvg3rngMov/o4+TE1au/Sby6tXiJY+ueZuXKAto vTtw/ZDolOMHuKVO/ji17aFw+eO2Px16AfsKFz5deLWILVOJpTgj0VCLuag4EQDUgXInfwIAA A== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-13.tower-31.messagelabs.com!1502720688!105373068!1 X-Originating-IP: [217.140.101.70] 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 5662 invoked from network); 14 Aug 2017 14:24:48 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-13.tower-31.messagelabs.com with SMTP; 14 Aug 2017 14:24:48 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 15534199B; Mon, 14 Aug 2017 07:24:48 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 29AFD3F483; Mon, 14 Aug 2017 07:24:47 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:03 +0100 Message-Id: <20170814142418.13267-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 12/27] xen/arm: Introduce hsr_xabt to gather common bits between hsr_dabt and 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" This will allow to consolidate some part of the data abort and prefetch abort handling in a single function later on. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/processor.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 3ef606c554..9964348189 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -537,6 +537,19 @@ union hsr { unsigned long ec:6; /* Exception Class */ } dabt; /* HSR_EC_DATA_ABORT_* */ + /* Contain the common bits between DABT and IABT */ + struct hsr_xabt { + unsigned long fsc:6; /* Fault status code */ + unsigned long pad1:1; + unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ + unsigned long pad2:1; + unsigned long eat:1; /* External abort type */ + unsigned long fnv:1; /* FAR not Valid */ + unsigned long pad3:14; + unsigned long len:1; /* Instruction length */ + unsigned long ec:6; /* Exception Class */ + } xabt; + #ifdef CONFIG_ARM_64 struct hsr_brk { unsigned long comment:16; /* Comment */ From patchwork Mon Aug 14 14:24: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: 110026 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4282162obb; Mon, 14 Aug 2017 07:26:49 -0700 (PDT) X-Received: by 10.107.132.233 with SMTP id o102mr22300579ioi.214.1502720809738; Mon, 14 Aug 2017 07:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720809; cv=none; d=google.com; s=arc-20160816; b=qFVSVCOvkARaYJu29MWyJtsPx0Ivy7Nt4PoYl1ASMy/5ZC2rP6YCGhViOtUkyDTMbi Qhxds78vF6lX3SnHm3YF6L9BdpbBLlVTwcd3J1c53peMQf/s2bPHALl0Es6pWIW8MImy +44ID21GL6SPDnXM6apU5Hh0x+rt3RPZgTJEAD9fOfJd5WkKBF+hKQJFSyU/mi9gLXyZ jefGRiERK7ilxoNxkyX8iOqD9fTTgIxQlZE06Pw9te0oo8eKvL37IOtwlkRXBGkyqRVm FCNbUR+pIT8TjKtXCs01PW3w5gArFlOXW9gnwpCPiHI+55DVeDyOV38iu1N8qUtl7slY Tm3A== 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:arc-authentication-results; bh=si/0J6OAeio+dBQ8noZePGwwmvW4kvOsB6+rcmOhX3Y=; b=WoKKnkgKVPJXxNzp7t/hj59fx/wgcFOKNamOaq5uWImhL5O8O6Pazz59zKALTLf3iP pwM/fDA/ZrsfDPVDtXRWprnu7UUtvXjS5Oz/uO8z79iNYsHbItG/Sqm2n5MXLEiiVCBz Llr6+4pLhQHPGNF93+SL0VN874SYefaLPwdDdlewCJBNBO2y3u6iyYdMiP7MdHKanQEP +65lKmZgNnOwMLijkzMIc5Hu+4hNBzGnNv3YWbqfXZdE8iuUzNLFIN3d1Vp3uIJlwoG7 LzZHWaI2fhUL1j2FYnt/dVDpILAUdZ5zQXEAJD1EkrVU6HbjC3g6lxEgOZw+a015CcBF Cu/Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r81si5425371itc.28.2017.08.14.07.26.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:49 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIW-0000Uz-Fx; Mon, 14 Aug 2017 14:24:52 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIV-0000Sa-6F for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:51 +0000 Received: from [85.158.143.35] by server-6.bemta-6.messagelabs.com id 68/EE-03937-2B2B1995; Mon, 14 Aug 2017 14:24:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTXfjpom RBot+WFos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnvFuxjKvjKX/H45zvmBsYXPF2MXBxCApsZ JSbcbWWFcE4zSpy51s/SxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s0CkxOEPP9hBbGGBeImD8 /cCNXNwsAioSsye7Q0S5hWwkni67wzYGAkBeYldbRdZQWxOoHjn3Z1gcSEBS4kTq2ezTWDkXs DIsIpRvTi1qCy1SNdIL6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMj0LsMQLCDcdl fp0OMkhxMSqK8CT69kUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeFM3TowUEixKTU+tSMvMAYYZ TFqCg0dJhHftBqA0b3FBYm5xZjpE6hSjLserCf+/MQmx5OXnpUqJ85aDzBAAKcoozYMbAQv5S 4yyUsK8jEBHCfEUpBblZpagyr9iFOdgVBLmdQKZwpOZVwK36RXQEUxAR/SB3M9bXJKIkJJqYC zoSFZz7c/wOM8l+Clna2D2Ve8FHC3C/sHt1xyPhQV8v7O06Tav39nEiq6t92tK5NLTPsVnPNx yfJf03U0ci/Qr2h+4M5+Ys2NPe47yn+ylf6647T+z6PSjVjuj6Bc39QI5tv7urvii4lKhc/n1 gcJ37x9t56+7/O7OKYMJKZuu75avXRvhr63EUpyRaKjFXFScCAAaWVtTdAIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1502720689!71982749!1 X-Originating-IP: [217.140.101.70] 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 29437 invoked from network); 14 Aug 2017 14:24:49 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-13.tower-21.messagelabs.com with SMTP; 14 Aug 2017 14:24:49 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FCEA1713; Mon, 14 Aug 2017 07:24:49 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 543503F483; Mon, 14 Aug 2017 07:24:48 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:04 +0100 Message-Id: <20170814142418.13267-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 13/27] xen/arm: traps: Introduce a helper to read the hypersivor fault register 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" While ARM32 has 2 distinct registers for the hypervisor fault register (one for prefetch abort, the other for data abort), AArch64 has only one. Currently, the logic is open-code but a follow-up patch will require to read it too. So move the logic in a separate helper and use it instead of open-coding it. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/traps.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 498d8c594a..819bdbc69e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2530,6 +2530,28 @@ done: if (first) unmap_domain_page(first); } +/* + * Return the value of the hypervisor fault address register. + * + * On ARM32, the register will be different depending whether the + * fault is a prefetch abort or data abort. + */ +static inline vaddr_t get_hfar(bool is_data) +{ + vaddr_t gva; + +#ifdef CONFIG_ARM_32 + if ( is_data ) + gva = READ_CP32(HDFAR); + else + gva = READ_CP32(HIFAR); +#else + gva = READ_SYSREG(FAR_EL2); +#endif + + return gva; +} + static inline paddr_t get_faulting_ipa(vaddr_t gva) { register_t hpfar = READ_SYSREG(HPFAR_EL2); @@ -2565,11 +2587,7 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, paddr_t gpa; mfn_t mfn; -#ifdef CONFIG_ARM_32 - gva = READ_CP32(HIFAR); -#else - gva = READ_SYSREG64(FAR_EL2); -#endif + gva = get_hfar(false /* is_data */); /* * If this bit has been set, it means that this instruction abort is caused @@ -2711,11 +2729,8 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, return __do_trap_serror(regs, true); info.dabt = dabt; -#ifdef CONFIG_ARM_32 - info.gva = READ_CP32(HDFAR); -#else - info.gva = READ_SYSREG64(FAR_EL2); -#endif + + info.gva = get_hfar(true /* is_data */); if ( hpfar_is_valid(dabt.s1ptw, fsc) ) info.gpa = get_faulting_ipa(info.gva); From patchwork Mon Aug 14 14:24:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110001 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281427obb; Mon, 14 Aug 2017 07:26:07 -0700 (PDT) X-Received: by 10.107.164.104 with SMTP id n101mr19091275ioe.42.1502720767651; Mon, 14 Aug 2017 07:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720767; cv=none; d=google.com; s=arc-20160816; b=ZihLq7X67tm4GV2PcIzN3KsY3K15ULRK+8Egzd4y6KA3RuuAYtQ5r3074P3qDVTEt5 uUxfsFcTYDnDY5La2PHYwfdOIIbaTqrqCZb9s7+R6YBUls/nvgwD6BotAcQKn7TKF8ed xcfmuBkfX10dfMTvuxHwn35sW5p6Ul0x/t1mcrMzaFPM/vJ7DZMRn81PsjkaPSy1Egwd RaULesP+CMZ9M1A2CNF5TX+4QvvYXetkuo9bYg3BktGM9xz0SYqS3Yc/497DkiPvfxAE 3NkeJTQlPNITmbeyROGo8Eev4X52EERxUMSXkZP9cWFom3RW/SiAnPiYcW+5N8qzSsni z0Fg== 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:arc-authentication-results; bh=hUGSR/l4Js+DShChiFucreLOZqqH2MnQLG/QlysAWGg=; b=hYcnixtvyBZgthpEiTk6CVvgn5Y2fxr6rAcpmFSgrlWAwhLBPXq3C4szQRBirn0SAs hiMauHdypXO6vUP68idzum9dctxc9Ffbf+H0fQpHFzJOjneQ4XEI5rGhDOO+hWVbIDhS ZajmU74KGF3wnB48jwkEwANpo6yKAbR2ZIXxCYY1PfFy7h2zbHSM2pwcJlVXy4c8Sp3y QEriq/Fh5nDFye6I/pSYV6dVZcZsKMjLW3SaBQomLRVLr/tmOgUA5c3BQ1CVQktn2GwY M5KAE5HBo54TPRURlPuc8eQ5tMCNb6NEP4IBs9RB72hQxzkOoET+sLCzeFbnmq7cVppF BZlQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id x21si5395075ita.34.2017.08.14.07.26.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:07 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIX-0000bD-QM; Mon, 14 Aug 2017 14:24:53 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIW-0000UI-BB for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:52 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id 24/75-03557-3B2B1995; Mon, 14 Aug 2017 14:24:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXfzpom RBj8fs1ss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlv5uxjKbjPVdFzeAVzA+Msji5GLg4hgc2M Emd7GtkgnNOMEi/PtzN2MXJysAloStz5/IkJxBYRkJa49vkyWJxZIFLi8Icf7CC2sECIRMuBY 2BxFgFViZ3zroDFeQWsJBY1tILFJQTkJXa1XWQFsTmB4p13d7KA2EIClhInVs9mm8DIvYCRYR WjRnFqUVlqka6xsV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRqCHGYBgB+PO9YG HGCU5mJREeRN8eiOF+JLyUyozEosz4otKc1KLDzHKcHAoSfCmbpwYKSRYlJqeWpGWmQMMNZi0 BAePkgjvLJA0b3FBYm5xZjpE6hSjLserCf+/MQmx5OXnpUqJ85aDFAmAFGWU5sGNgIX9JUZZK WFeRqCjhHgKUotyM0tQ5V8xinMwKgnzVoJM4cnMK4Hb9AroCCagI/pA7uctLklESEk1MJpv10 hvNrKeuKe4VHJm+/WbUzxfXZnx5E6SeKdSi1fbnbBpkWcPRihJzvvLqes7UWG55ZezjGyzNUO yY0uetofteNL/+gXzQodvz559ktOyzF3NkbwtmO35NtFN+69w9Bv8zz0xV7OUJyY+TPrpTo2Z FZP1TRlmxVvU9vwpj7todHxZ9Pm4TUosxRmJhlrMRcWJAIn1oaF2AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-21.messagelabs.com!1502720690!69857842!1 X-Originating-IP: [217.140.101.70] 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 53971 invoked from network); 14 Aug 2017 14:24:50 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-21.messagelabs.com with SMTP; 14 Aug 2017 14:24:50 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6A3761991; Mon, 14 Aug 2017 07:24:50 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7E80D3F483; Mon, 14 Aug 2017 07:24:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:05 +0100 Message-Id: <20170814142418.13267-15-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 14/27] xen/arm: traps: Improve logging for data/prefetch abort fault 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" Walk the hypervisor page table for data/prefetch abort fault to help diagnostics error in the page tables. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/traps.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 819bdbc69e..dac4e54fa7 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2967,7 +2967,26 @@ asmlinkage void do_trap_hyp_sync(struct cpu_user_regs *regs) do_trap_brk(regs, hsr); break; #endif + case HSR_EC_DATA_ABORT_CURR_EL: + case HSR_EC_INSTR_ABORT_CURR_EL: + { + bool is_data = (hsr.ec == HSR_EC_DATA_ABORT_CURR_EL); + const char *fault = (is_data) ? "Data Abort" : "Instruction Abort"; + + printk("%s Trap. Syndrome=%#x\n", fault, hsr.iss); + /* + * FAR may not be valid for a Synchronous External abort other + * than translation table walk. + */ + if ( hsr.xabt.fsc != FSC_SEA || !hsr.xabt.fnv ) + dump_hyp_walk(get_hfar(is_data)); + else + printk("Invalid FAR, don't walk the hypervisor tables\n"); + + do_unexpected_trap(fault, regs); + break; + } default: printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n", hsr.bits, hsr.ec, hsr.len, hsr.iss); From patchwork Mon Aug 14 14:24: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: 110022 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281905obb; Mon, 14 Aug 2017 07:26:35 -0700 (PDT) X-Received: by 10.36.252.69 with SMTP id b66mr5223531ith.97.1502720795177; Mon, 14 Aug 2017 07:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720795; cv=none; d=google.com; s=arc-20160816; b=a/SQ9JcBE6D9jBMS+iIdRvD7Azt2apc9rGDcST+FyIAqlt4WwAGZb60rZgG7nOaEDq HoX7civNrtwm1hDOO1RKEYP5XWXhHDGx56cN1vFdyh0L0ZjJglV/icT9ozWnSZqGqVqB py6dJh0n0a9Q80XTeJJFjHF4eniLV6EKvjo8TpslLWtPEHHjUQYtKe+ZUqCtEPBW3M4V FeiQ9ZkiYYPH46IeDSPRCyIds5KOuY1sZzUtg3mzVulfgWz3RJxvYvZl83GZc4r3W7D1 U5vUxj3E+S57kVvFCqxqaItnpVFum/TV76eRQWD0BnoKRrMk3p+bVNId3Tqnyqfr3ZIS XIIw== 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:arc-authentication-results; bh=ZPvwlLNdeLamugM7G3ch0qkDWM6C7z7RmM7KaRyrIu8=; b=tey3yPk5g76Xmvcs7Lh1MWZpaMkxAifs03xrjachDTDqb88jnZjHWII0vlFbDajAXc VYg1N7gBltEValnFBv1DUlXHI944ZEFnbTzejG82w30pqpsihRUDSPm1bpOtgD7KV8B4 bh+sB99BKk1jI0iA7M9nQiNv7wGyEiV9NwpAt+9nd+kdpldDIy5GY46cRShc1tZ5z5dj ozN0sl5QlfK90VIjHF0H3BRp/CA6QpjZu9sXaTEd8i/L2Az5inndSgHXosIU17ohwV8Y 8Wt79hDVlAvtOy8ROCA+4ibp5Og5NV2ue7mGWQEe9upAEFwnYMxhr1sC93nW07YkT14k lg2w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g192si5780066ita.78.2017.08.14.07.26.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26: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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIY-0000dV-1X; Mon, 14 Aug 2017 14:24:54 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIX-0000WJ-Fc for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:53 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id 55/0B-03612-4B2B1995; Mon, 14 Aug 2017 14:24:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTXfLpom RBpu/C1ks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnLz59mLGjjq/j/YCpLA+MG7i5GLg4hgc2M Eh9X72eGcE4zSry6/QHI4eRgE9CUuPP5ExOILSIgLXHt82VGEJtZIFLi8Icf7CC2sECqxP5Jp 8BsFgFVib4fC8BqeAWsJO6cXAFmSwjIS+xqu8gKYnMCxTvv7mQBsYUELCVOrJ7NNoGRewEjwy pGjeLUorLUIl0jY72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjEAPMwDBDsY/8wM PMUpyMCmJ8ib49EYK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuC9sXFipJBgUWp6akVaZg4w1GDS Ehw8SiK8s0DSvMUFibnFmekQqVOMxhyX+jZ8YeJ4NeH/NyYhlrz8vFQpcd5ykFIBkNKM0jy4Q bAYuMQoKyXMywh0mhBPQWpRbmYJqvwrRnEORiVh3k8gU3gy80rg9r0COoUJ6JQ+kC94i0sSEV JSDYyJ9yvc69bZ7tw8Vfvpq0cCX6OSqhlsv2zquXSUXU4g0PTkmeAbjm9nlT248J+/xeRj59N zy68FLfobxJVfkfGrfq7aiq2qQbxHHAIFqnxdXnOav2t2OPj01YUVi6WT5Vw3L7K8E/bQW0Xn kML0ixGBXJofujL8ODTnLua5d/rNedmPYjMCjqspsRRnJBpqMRcVJwIAG4A+PHwCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1502720691!74726637!1 X-Originating-IP: [217.140.101.70] 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 44148 invoked from network); 14 Aug 2017 14:24:52 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-21.messagelabs.com with SMTP; 14 Aug 2017 14:24:52 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 948371713; Mon, 14 Aug 2017 07:24:51 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A8DC83F483; Mon, 14 Aug 2017 07:24:50 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:06 +0100 Message-Id: <20170814142418.13267-16-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 15/27] xen/arm: Replace ioremap_attr(PAGE_HYPERVISOR_NOCACHE) call by ioremap_nocache 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" ioremap_cache is a wrapper of ioremap_attr(...). Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/platforms/exynos5.c | 2 +- xen/arch/arm/platforms/omap5.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c index 2ae5fa66e0..95d6581d33 100644 --- a/xen/arch/arm/platforms/exynos5.c +++ b/xen/arch/arm/platforms/exynos5.c @@ -62,7 +62,7 @@ static int exynos5_init_time(void) dprintk(XENLOG_INFO, "mct_base_addr: %016llx size: %016llx\n", mct_base_addr, size); - mct = ioremap_attr(mct_base_addr, size, PAGE_HYPERVISOR_NOCACHE); + mct = ioremap_nocache(mct_base_addr, size); if ( !mct ) { dprintk(XENLOG_ERR, "Unable to map MCT\n"); diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c index 1e1f9fa970..7dbba95756 100644 --- a/xen/arch/arm/platforms/omap5.c +++ b/xen/arch/arm/platforms/omap5.c @@ -51,8 +51,7 @@ static int omap5_init_time(void) unsigned int sys_clksel; unsigned int num, den, frac1, frac2; - ckgen_prm_base = ioremap_attr(OMAP5_CKGEN_PRM_BASE, - 0x20, PAGE_HYPERVISOR_NOCACHE); + ckgen_prm_base = ioremap_nocache(OMAP5_CKGEN_PRM_BASE, 0x20); if ( !ckgen_prm_base ) { dprintk(XENLOG_ERR, "%s: PRM_BASE ioremap failed\n", __func__); @@ -64,8 +63,7 @@ static int omap5_init_time(void) iounmap(ckgen_prm_base); - rt_ct_base = ioremap_attr(REALTIME_COUNTER_BASE, - 0x20, PAGE_HYPERVISOR_NOCACHE); + rt_ct_base = ioremap_nocache(REALTIME_COUNTER_BASE, 0x20); if ( !rt_ct_base ) { dprintk(XENLOG_ERR, "%s: REALTIME_COUNTER_BASE ioremap failed\n", __func__); From patchwork Mon Aug 14 14:24:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110002 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281462obb; Mon, 14 Aug 2017 07:26:10 -0700 (PDT) X-Received: by 10.107.44.197 with SMTP id s188mr19309354ios.180.1502720770037; Mon, 14 Aug 2017 07:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720770; cv=none; d=google.com; s=arc-20160816; b=k6tSGTg2iBssMkBVU6hgbIZgtd3B7z2gA7CcpSmJIUXqZzs0DUGdrWO+SXzkRtYiFC 8IyGarxtbRaUULf/YYbN110xSNrGjAxM1sqKrneeuf2ZkNRW5RlrGa76V9b7msSZSPEZ Ur678OvRRbslG1oh+zdvnzD6xz42AIRTln47nDxdQcXsSXtYkh7L5QcKQ3pyRdKr55ee 0gHZtDA0wC+u0sQ/Siic+EFtFH8TKMv5B0d6whQqW/B8VyE/K8IhOwJzbuF+ReABBEo9 q4CGQpCr05u/zaaBMs5rfnMaTQMy04/DhAZ6zl90YvzVDa8i5z/ACtvnmsPPXOM8V4kF SyeA== 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:arc-authentication-results; bh=cXX2RmhbpYpnamba4yDwFrAWihk7NJgOG8Z9gdhDQBY=; b=kuMr0IdiCAS4sjsZ5bJSjcM8V30Uws+E/uaFPMCldw8OOnCPIsQBGwjWinatp8J2OK wcg92gO1/lmUQtajys68CY0ZkD9NkBTzt/E9BblvPGuT2nRqWLgWNxKSMA9ZecbiC9YU 1nI14SZjBIb7xqNjfU+owFHECrvqgfauaSygmE2XwU1efNTukB1FUNWuxRvaPB0EDOdG d/aqAZij4q7BcMpsGa0ZscIT2es6Z7Js/bKW9IDaKyF1cHvnXsZapVXIY5QS7/TG5sMg Btm+sRW4blZr4gbbkGJXEIrcyNt+/jikCtq5i7HQrkjEaKVrvg8IAgnfxB/qhrGLPhY0 DPrw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 9si7218833iom.401.2017.08.14.07.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:10 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIb-0000kG-Gg; Mon, 14 Aug 2017 14:24:57 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIZ-0000fc-Rm for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:55 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 68/1A-01862-7B2B1995; Mon, 14 Aug 2017 14:24:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXfbpom RBstvKVgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkHts1mK9jEWzFvcjN7A+M+ri5GLg4hgc2M EsevPGKFcE4zSlzduompi5GTg01AU+LO509gtoiAtMS1z5cZQWxmgUiJwx9+sIPYwgLREg0H3 7KA2CwCqhKndv4As3kFrCTWzOgFq5EQkJfY1XaRFcTmBIp33t0JViMkYClxYvVstgmM3AsYGV YxahSnFpWlFukameslFWWmZ5TkJmbm6BoaGOvlphYXJ6an5iQmFesl5+duYgR6uJ6BgXEHY8t ev0OMkhxMSqK8CT69kUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeFM3TowUEixKTU+tSMvMAYYa TFqCg0dJhHftBqA0b3FBYm5xZjpE6hSjLserCf+/MQmx5OXnpUqJ874CKRIAKcoozYMbAQv7S 4yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeZ1ALuHJzCuB2/QK6AgmoCP6QO7nLS5JREhJNT CW5EQtKpmyJr5nwuGVzqevta1bpDe1w6d9a9mzc6Gl212F2jfN/TZJbe5BdYnVrZf2K8bE9M5 lcr3zcdJh30cLDlu4rLSNPCLhYaZxU2DVQy6r82WBZy3vxVkvXbM6g2WZmL5XhsrN1xvdatdO YW6Kevn8+yKGn8umFQZm3VrhWrV8XfobgXNsSizFGYmGWsxFxYkACSPpJnYCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1502720693!110025035!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6632 invoked from network); 14 Aug 2017 14:24:53 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-31.messagelabs.com with SMTP; 14 Aug 2017 14:24:53 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BEDC51991; Mon, 14 Aug 2017 07:24:52 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D33C03F483; Mon, 14 Aug 2017 07:24:51 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:07 +0100 Message-Id: <20170814142418.13267-17-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 16/27] xen/arm: page: Remove unused attributes DEV_NONSHARED and DEV_CACHED 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" They were imported from non-LPAE Linux, but Xen is LPAE only. It is time to do some clean-up in the memory attribute and keep only what make sense for Xen. Follow-up patch will do more clean-up. Also, update the comment saying our attribute matches Linux. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/page.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index cef2f28914..465300c6e5 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -21,9 +21,9 @@ #define LPAE_SH_OUTER 0x2 #define LPAE_SH_INNER 0x3 -/* LPAE Memory region attributes, to match Linux's (non-LPAE) choices. - * Indexed by the AttrIndex bits of a LPAE entry; - * the 8-bit fields are packed little-endian into MAIR0 and MAIR1 +/* + * LPAE Memory region attributes. Indexed by the AttrIndex bits of a + * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * * ai encoding * UNCACHED 000 0000 0000 -- Strongly Ordered @@ -35,9 +35,7 @@ * reserved 110 * WRITEALLOC 111 1111 1111 -- Write-back write-allocate * - * DEV_NONSHARED 100 (== DEV_SHARED) * DEV_WC 001 (== BUFFERABLE) - * DEV_CACHED 011 (== WRITEBACK) */ #define MAIR0VAL 0xeeaa4400 #define MAIR1VAL 0xff000004 @@ -57,9 +55,7 @@ #define WRITEBACK 0x3 #define DEV_SHARED 0x4 #define WRITEALLOC 0x7 -#define DEV_NONSHARED DEV_SHARED #define DEV_WC BUFFERABLE -#define DEV_CACHED WRITEBACK #define PAGE_HYPERVISOR (WRITEALLOC) #define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) From patchwork Mon Aug 14 14:24:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110003 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281474obb; Mon, 14 Aug 2017 07:26:10 -0700 (PDT) X-Received: by 10.36.67.81 with SMTP id s78mr6035833itb.101.1502720770852; Mon, 14 Aug 2017 07:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720770; cv=none; d=google.com; s=arc-20160816; b=qiPn2vu9DsJjPXCG0RukwKqSJFylSid5NQ4CiIB45Lzy5M1QzaK5JkOYWCSfGLea2P SIEdZmknJO1w7wXxkquOsJMcYaq9eBGFiAozhbK1y09O4uGocN44fkLhxFQBhV+piK92 HULlgFCdOfuyPnAbcEEj9nJKUM+jlFowrlV1Lpa52xawpP+YC7N/diEIBel7soZsC+9O QJuDN2X9anflhI3rCvqIdXLR8GELhwfMeLWoSYwPPfZJxAN3CbQjlBkgfcoI4S7SLJeQ UAfSxkAu/xbo89ETjGLocccSZrAJ90p4TDSXGq6gsUgLnDF4NlCluP9ZvH3WDr9CjW5e Cxcg== 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:arc-authentication-results; bh=l1KcEgdKj2u6I9ZY/QdYUXo9iBUTZdEnp+urjNAkVpM=; b=KeZGalq0uxNWonkYRO752MLdqUvxWp2wIVUHb1ox+QIPLc9pVqhtB8SZI/z9FhWW7p OqgjvgrfAciCt9Js8vP8qZg7K122edM7XELODVWKiG6GC8915isXkyUTYizaxTMlkMDy DLPdXAhaXU4erCQPW6O+r6cqqghubhFn/PEYvdnfuIuOAyTHcEjCgw6ZhUdgJ7oamDZn rCThhMT6kBpOQ1244SNgLc+PDYA0MztMxXBhzrxn5hKEvfr9QicYmy0ZEi/ZTQe+G3On WZCcoWIu/tHk1wmrAPuODHVP+e68VOhjkYPcYJjRhC5KgxQEdYWclbCT7kgDOp9X6XI1 jZ8A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y31si7066588ioi.281.2017.08.14.07.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:10 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIa-0000gw-91; Mon, 14 Aug 2017 14:24:56 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIZ-0000fZ-Od for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:55 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id DD/A8-03368-7B2B1995; Mon, 14 Aug 2017 14:24:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRWlGSWpSXmKPExsVysyfVTXfbpom RBrc2qVss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmHG86zF6xgq5gw8wBzA+Nc1i5GLg4hgc2M Ep1/57JDOKcZJfrntjF2MXJysAloStz5/IkJxBYRkJa49vkyWJxZIFLi8Icf7CC2sICvxO8Xv cxdjBwcLAKqEhN2uIOEeQWsJFYvuQJWLiEgL7Gr7SIriM0JFO+8u5MFxBYSsJQ4sXo22wRG7g WMDKsYNYpTi8pSi3QNDfSSijLTM0pyEzNzgDwzvdzU4uLE9NScxKRiveT83E2MQP8yAMEOxuP v4w4xSnIwKYnyJvj0RgrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4E3dODFSSLAoNT21Ii0zBxho MGkJDh4lEd5ZIGne4oLE3OLMdIjUKUZjjqYPW74wcbya8P8bkxBLXn5eqpQ4bzlIqQBIaUZpH twgWARcYpSVEuZlBDpNiKcgtSg3swRV/hWjOAejkjDvZpApPJl5JXD7XgGdwgR0Sh/IF7zFJY kIKakGxkalOxwV+1ukg5X2iGWvPWjxkm2drV/SPEOn7k0l9vwfMnofzxNO321+59rVUJkuqYz C535iH4S++nunyfnu3Hlct/p4tqPb8rTKLz8mXrBxFSydGPbtdcepO8FR3jKOGyUOXf6kq7Cd Y/Fufy4eh7+aa5m9WCfa/RO8rvRPI+59nOuNGWaXlViKMxINtZiLihMBiCQPDHsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1502720694!52177981!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37622 invoked from network); 14 Aug 2017 14:24:54 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:54 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E91E01713; Mon, 14 Aug 2017 07:24:53 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 096343F483; Mon, 14 Aug 2017 07:24:52 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:08 +0100 Message-Id: <20170814142418.13267-18-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 17/27] xen/arm: page: Use directly BUFFERABLE and drop DEV_WC 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" DEV_WC is only used for PAGE_HYPERVISOR_WC and does not bring much improvement. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/page.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 465300c6e5..660e1779c5 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -55,11 +55,10 @@ #define WRITEBACK 0x3 #define DEV_SHARED 0x4 #define WRITEALLOC 0x7 -#define DEV_WC BUFFERABLE #define PAGE_HYPERVISOR (WRITEALLOC) #define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) -#define PAGE_HYPERVISOR_WC (DEV_WC) +#define PAGE_HYPERVISOR_WC (BUFFERABLE) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Mon Aug 14 14:24:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110012 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281678obb; Mon, 14 Aug 2017 07:26:23 -0700 (PDT) X-Received: by 10.107.166.203 with SMTP id p194mr19624953ioe.48.1502720783242; Mon, 14 Aug 2017 07:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720783; cv=none; d=google.com; s=arc-20160816; b=kxCBUG4JHbDLYhcFRXDMIISKDcrVc137Tp3BKvXZfalLuQ3ZlvEV+C2xB8yxqwB7kg ggnXy0aHaPLQkrLVBdYT5Zla3Fje78lAi+VTyje0MNK/p1dKFKiSKeGloRJXAnPZSUSJ WgiTsKAB2bqhF7kyw/k2EqzwMhQeusqXzKcSiQZGVA5TZFhxrB38YKzlPm2rmqq/U8tm 7zPZtp79KlZKV6RZ4m4/ZX7hmnjjniFRXNmFd7NDHQZHsctmH9/E1CV8MWumNtPwY0Ns kn7xtv/blAZ3ISwtsGyklN/al7jejpZlr7C2Lrwa+emqZTTs6vA2CvrdLwqx/3IhmLT1 G1mA== 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:arc-authentication-results; bh=KbHu5TQmDA8amR44wJ8illWwPhasNe9UxUwLFdjB3cI=; b=e2/yD09HJ/oHbTV9gyGp4iJztXdkV97v5qYvycIWhfXo2niF99Ic+h5i0kJu0FS5p2 XGSvoUeGS0kkbZHXGFnkeup/0lP5eXxBh6RAuwEfHkj2k6kYXAaf+dpR6Ly5MnsaPjHT SZUlEdzpnuDQ0sCbFo/h0Bl37y+9FlWCw4t1uCXtORrZ6Vrfjow6yZlztGPP58A/1lAB IY+HNSa2dQ2w3V4VTiJYLGHEaz4ci2hgVPnt4JWp6C1t0bVkEwoz07RUPD+PWZuAbNdz wJi8Tu2eh8vyCaUoYJX2wImYtWIAd8UlLVtTrQ7qHU7puyOce30+w9h4iWyjh15mFp96 sBxg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g63si5489807ita.145.2017.08.14.07.26.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:23 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGId-0000nl-PW; Mon, 14 Aug 2017 14:24:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIc-0000iU-Gm for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:58 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id AC/7B-02962-8B2B1995; Mon, 14 Aug 2017 14:24:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTXfHpom RBjv+cVss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkbJ55lLLjmUfFyZQ9zA+Nl8y5GLg4hgc2M EptnfmGFcE4zSsz89J6li5GTg01AU+LO509MILaIgLTEtc+XGUFsZoFIicMffrCD2MICThLXm g+D1bMIqErsadgHVs8rYCUxYe8NNhBbQkBeYlfbRVYQmxMo3nl3J1i9kIClxInVs9kmMHIvYG RYxahRnFpUllqka2iil1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kR6GEGINjBeH1 jwCFGSQ4mJVHeBJ/eSCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvKkbJ0YKCRalpqdWpGXmAEMN Ji3BwaMkwnsDJM1bXJCYW5yZDpE6xWjM0THj5zcmjlcT/n9jEmLJy89LlRLnLQcpFQApzSjNg xsEi4FLjLJSwryMQKcJ8RSkFuVmlqDKv2IU52BUEubdDDKFJzOvBG7fK6BTmIBO6QP5gre4JB EhJdXAuN7jahHn2sMXTxqGyaz6YvrWnf/n28LynYvtS/m3zskoL+kW/LC3fatu5EvJBpVX+cs Xe+s6RAY9OXH/6leniNvuvBYKGUJHSpb/+mm76NSy4GDmsI0te6TVbEJ+cOxe+UGXOehx/abu BQazVY0WbxRLeKmgwrh5rmShk5ncQ1PZhw97XnyaqcRSnJFoqMVcVJwIAAps8fV8AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1502720695!102211476!1 X-Originating-IP: [217.140.101.70] 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 3735 invoked from network); 14 Aug 2017 14:24:55 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-13.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:24:55 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42AE81713; Mon, 14 Aug 2017 07:24:55 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 33A6C3F483; Mon, 14 Aug 2017 07:24:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:09 +0100 Message-Id: <20170814142418.13267-19-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 18/27] xen/arm: page: Prefix memory types with MT_ 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" This will avoid confusion in the code when using them. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mm.c | 28 +++++++++++++-------------- xen/arch/arm/platforms/vexpress.c | 2 +- xen/drivers/video/arm_hdlcd.c | 2 +- xen/include/asm-arm/page.h | 40 +++++++++++++++++++-------------------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 7403ec0c0e..9c183f96da 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -54,7 +54,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) s = paddr & (PAGE_SIZE-1); l = min(PAGE_SIZE - s, len); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), BUFFERABLE); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_BUFFERABLE); memcpy(dst, src + s, l); clean_dcache_va_range(dst, l); diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 349ac58ffe..45974846a9 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -290,7 +290,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) switch ( attr ) { - case BUFFERABLE: + case MT_BUFFERABLE: /* * ARM ARM: Overlaying the shareability attribute (DDI * 0406C.b B3-1376 to 1377) @@ -305,8 +305,8 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) */ e.pt.sh = LPAE_SH_OUTER; break; - case UNCACHED: - case DEV_SHARED: + case MT_UNCACHED: + case MT_DEV_SHARED: /* * Shareability is ignored for non-Normal memory, Outer is as * good as anything. @@ -369,7 +369,7 @@ static void __init create_mappings(lpae_t *second, count = nr_mfns / LPAE_ENTRIES; p = second + second_linear_offset(virt_offset); - pte = mfn_to_xen_entry(_mfn(base_mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(base_mfn), MT_WRITEALLOC); if ( granularity == 16 * LPAE_ENTRIES ) pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ for ( i = 0; i < count; i++ ) @@ -422,7 +422,7 @@ void *map_domain_page(mfn_t mfn) else if ( map[slot].pt.avail == 0 ) { /* Commandeer this 2MB slot */ - pte = mfn_to_xen_entry(_mfn(slot_mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_WRITEALLOC); pte.pt.avail = 1; write_pte(map + slot, pte); break; @@ -543,7 +543,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va) { paddr_t ma = va + phys_offset; - return mfn_to_xen_entry(maddr_to_mfn(ma), WRITEALLOC); + return mfn_to_xen_entry(maddr_to_mfn(ma), MT_WRITEALLOC); } /* Map the FDT in the early boot page table */ @@ -652,7 +652,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Initialise xen second level entries ... */ /* ... Xen's text etc */ - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); pte.pt.xn = 0;/* Contains our text mapping! */ xen_second[second_table_offset(XEN_VIRT_START)] = pte; @@ -669,7 +669,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* ... Boot Misc area for xen relocation */ dest_va = BOOT_RELOC_VIRT_START; - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); /* Map the destination in xen_second. */ xen_second[second_table_offset(dest_va)] = pte; /* Map the destination in boot_second. */ @@ -700,7 +700,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT); if ( !is_kernel(va) ) break; - pte = mfn_to_xen_entry(mfn, WRITEALLOC); + pte = mfn_to_xen_entry(mfn, MT_WRITEALLOC); pte.pt.table = 1; /* 4k mappings always have this bit set */ if ( is_kernel_text(va) || is_kernel_inittext(va) ) { @@ -771,7 +771,7 @@ int init_secondary_pagetables(int cpu) for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ ) { pte = mfn_to_xen_entry(virt_to_mfn(domheap+i*LPAE_ENTRIES), - WRITEALLOC); + MT_WRITEALLOC); pte.pt.table = 1; write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte); } @@ -869,13 +869,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, mfn_t first_mfn = alloc_boot_pages(1, 1); clear_page(mfn_to_virt(first_mfn)); - pte = mfn_to_xen_entry(first_mfn, WRITEALLOC); + pte = mfn_to_xen_entry(first_mfn, MT_WRITEALLOC); pte.pt.table = 1; write_pte(p, pte); first = mfn_to_virt(first_mfn); } - pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(mfn), MT_WRITEALLOC); /* TODO: Set pte.pt.contig when appropriate. */ write_pte(&first[first_table_offset(vaddr)], pte); @@ -915,7 +915,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) for ( i = 0; i < nr_second; i++ ) { clear_page(mfn_to_virt(mfn_add(second_base, i))); - pte = mfn_to_xen_entry(mfn_add(second_base, i), WRITEALLOC); + pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_WRITEALLOC); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); } @@ -969,7 +969,7 @@ static int create_xen_table(lpae_t *entry) if ( p == NULL ) return -ENOMEM; clear_page(p); - pte = mfn_to_xen_entry(virt_to_mfn(p), WRITEALLOC); + pte = mfn_to_xen_entry(virt_to_mfn(p), MT_WRITEALLOC); pte.pt.table = 1; write_pte(entry, pte); return 0; diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index a26ac324ba..9badbc079d 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -65,7 +65,7 @@ int vexpress_syscfg(int write, int function, int device, uint32_t *data) uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); int ret = -1; - set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEV_SHARED); if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START ) goto out; diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c index 3915f731f5..5fa7f518b1 100644 --- a/xen/drivers/video/arm_hdlcd.c +++ b/xen/drivers/video/arm_hdlcd.c @@ -227,7 +227,7 @@ void __init video_init(void) /* uses FIXMAP_MISC */ set_pixclock(videomode->pixclock); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEV_SHARED); HDLCD[HDLCD_COMMAND] = 0; HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 660e1779c5..d7a048b64d 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -25,17 +25,17 @@ * LPAE Memory region attributes. Indexed by the AttrIndex bits of a * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * - * ai encoding - * UNCACHED 000 0000 0000 -- Strongly Ordered - * BUFFERABLE 001 0100 0100 -- Non-Cacheable - * WRITETHROUGH 010 1010 1010 -- Write-through - * WRITEBACK 011 1110 1110 -- Write-back - * DEV_SHARED 100 0000 0100 -- Device - * ?? 101 - * reserved 110 - * WRITEALLOC 111 1111 1111 -- Write-back write-allocate + * ai encoding + * MT_UNCACHED 000 0000 0000 -- Strongly Ordered + * MT_BUFFERABLE 001 0100 0100 -- Non-Cacheable + * MT_WRITETHROUGH 010 1010 1010 -- Write-through + * MT_WRITEBACK 011 1110 1110 -- Write-back + * MT_DEV_SHARED 100 0000 0100 -- Device + * ?? 101 + * reserved 110 + * MT_WRITEALLOC 111 1111 1111 -- Write-back write-allocate * - * DEV_WC 001 (== BUFFERABLE) + * MT_DEV_WC 001 (== BUFFERABLE) */ #define MAIR0VAL 0xeeaa4400 #define MAIR1VAL 0xff000004 @@ -49,16 +49,16 @@ * registers, as defined above. * */ -#define UNCACHED 0x0 -#define BUFFERABLE 0x1 -#define WRITETHROUGH 0x2 -#define WRITEBACK 0x3 -#define DEV_SHARED 0x4 -#define WRITEALLOC 0x7 - -#define PAGE_HYPERVISOR (WRITEALLOC) -#define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) -#define PAGE_HYPERVISOR_WC (BUFFERABLE) +#define MT_UNCACHED 0x0 +#define MT_BUFFERABLE 0x1 +#define MT_WRITETHROUGH 0x2 +#define MT_WRITEBACK 0x3 +#define MT_DEV_SHARED 0x4 +#define MT_WRITEALLOC 0x7 + +#define PAGE_HYPERVISOR (MT_WRITEALLOC) +#define PAGE_HYPERVISOR_NOCACHE (MT_DEV_SHARED) +#define PAGE_HYPERVISOR_WC (MT_BUFFERABLE) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Mon Aug 14 14:24:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110006 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281587obb; Mon, 14 Aug 2017 07:26:17 -0700 (PDT) X-Received: by 10.107.137.15 with SMTP id l15mr18734886iod.13.1502720777901; Mon, 14 Aug 2017 07:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720777; cv=none; d=google.com; s=arc-20160816; b=fPBA/IO8dpZqBlMo5ZTz31AKRWezz/BHPmnAQtL7PDheB7zgTb19X7Fbz8nO6zZLv1 hzfBGmBSYeDZJGykB0O9ZjePGfgwUKeKzVlMdab1an520Zi4lks3LZzSkWCtXsFezLLr iOV6ju8LY1lZibSjZSbXUgU9WL915O+LtUySyyPU6ht+lrGNKDN/e4QZglG3owPWWwQ2 cd0tLjouvgCbsN3Ic0rjNoeFAL4pwEK3hb+KLdqbKQgidHNoKb1+wOJQaRFCNkRJwU6O IeGuAKV/9q4OxC7wKV4QZPoeFUB07QreiUJhiJkNTp3tojkthKHx11NGNZx4uJpV62/K P9Xg== 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:arc-authentication-results; bh=3xMU6oyVBfh+8+IZKWexvdNjm10AdIZQvxrMeQQE6bc=; b=n+gdb7RAlt6AImaRUqO968EG11qv0wTtK1bhawgW7HWS1g77wEsejmnWC2+ROuKErJ t9xG2k5gtOzDndH9L9/2HI6fWqxQdimqlOED+I6SEtkQ2tPImxWT2h5VycTiY60jhsP1 3gIWFWHZdZnvtWFfm/sIvPmBR3+ZgRHhAO4nWLLjTxj9CyZcCVFP+1HuQ2Z6YXlKT0v8 7Atr00piGtc1LzacHO6hTqHZD1QgvbsAHTeDSb0NTU6WQnaH42L2Xm5+Odk/cNLIKH/m bS6VIoDGIfK5M4UFBbBCA1Mg/KlLfPRVWhpFRheo/vMVioS8JcL1YOCBo4vaGlaMQ+A7 Lcdw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e64si5357849ith.193.2017.08.14.07.26.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:17 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIg-0000vB-O8; Mon, 14 Aug 2017 14:25:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIf-0000q5-Ae for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:01 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 9B/DA-01729-CB2B1995; Mon, 14 Aug 2017 14:25:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTXfnpom RBnu38Vgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBl7bv9nKfgoVHH09ir2BsZnfF2MnBxCApsZ JZqPSHQxcgHZpxkl3tx+wQqSYBPQlLjz+RMTiC0iIC1x7fNlRhCbWSBS4vCHH+wgtrCAh8Tah fvZQGwWAVWJnr1tYL28AlYSc1cfZwGxJQTkJXa1XQSLcwLFO+/uZIFYbClxYvVstgmM3AsYGV YxahSnFpWlFukaWeolFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQmFesl5+duYgT6t56BgXEH4+U tfocYJTmYlER5E3x6I4X4kvJTKjMSizPii0pzUosPMcpwcChJ8N7YODFSSLAoNT21Ii0zBxho MGkJDh4lEYg0b3FBYm5xZjpE6hSjLserCf+/MQmx5OXnpUqJ85aDFAmAFGWU5sGNgAX9JUZZK WFeRgYGBiGegtSi3MwSVPlXjOIcjErCvKIbgKbwZOaVwG16BXQEE9ARfSD38xaXJCKkpBoYbV hWM63YbmZ299ipm7l+6YoqTZ+s2bfy7Mxye7Qg/szb2MoPH/f0SVjc43+xTsvs7M8dnbv81qS 3vX0SqlHXfMlankcnrV/U/ZWOduZDp+INxV6CN49daj5WKpTzY5nz4ipXRXFjTZGDZ3dJmZyc MvfBY0buz6p2aUKCdh3XlXl2X2YMM9qjxFKckWioxVxUnAgA5PB7nHUCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1502720696!104364661!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16781 invoked from network); 14 Aug 2017 14:24:57 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-206.messagelabs.com with SMTP; 14 Aug 2017 14:24:57 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D0AD1991; Mon, 14 Aug 2017 07:24:56 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8173F3F483; Mon, 14 Aug 2017 07:24:55 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:10 +0100 Message-Id: <20170814142418.13267-20-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 19/27] xen/arm: page: Clean-up the definition of MAIRVAL 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" Currently MAIRVAL is defined in term of MAIR0VAL and MAIR1VAL which are both hardcoded value. This makes quite difficult to understand the value written in both registers. Rework the definition by using value of each attribute shifted by their associated index. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/page.h | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index d7a048b64d..86b227c291 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -22,6 +22,21 @@ #define LPAE_SH_INNER 0x3 /* + * Attribute Indexes. + * + * These are valid in the AttrIndx[2:0] field of an LPAE stage 1 page + * table entry. They are indexes into the bytes of the MAIR* + * registers, as defined above. + * + */ +#define MT_UNCACHED 0x0 +#define MT_BUFFERABLE 0x1 +#define MT_WRITETHROUGH 0x2 +#define MT_WRITEBACK 0x3 +#define MT_DEV_SHARED 0x4 +#define MT_WRITEALLOC 0x7 + +/* * LPAE Memory region attributes. Indexed by the AttrIndex bits of a * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * @@ -35,26 +50,18 @@ * reserved 110 * MT_WRITEALLOC 111 1111 1111 -- Write-back write-allocate * - * MT_DEV_WC 001 (== BUFFERABLE) */ -#define MAIR0VAL 0xeeaa4400 -#define MAIR1VAL 0xff000004 -#define MAIRVAL (MAIR0VAL|MAIR1VAL<<32) +#define MAIR(attr, mt) (_AC(attr, ULL) << ((mt) * 8)) -/* - * Attribute Indexes. - * - * These are valid in the AttrIndx[2:0] field of an LPAE stage 1 page - * table entry. They are indexes into the bytes of the MAIR* - * registers, as defined above. - * - */ -#define MT_UNCACHED 0x0 -#define MT_BUFFERABLE 0x1 -#define MT_WRITETHROUGH 0x2 -#define MT_WRITEBACK 0x3 -#define MT_DEV_SHARED 0x4 -#define MT_WRITEALLOC 0x7 +#define MAIRVAL (MAIR(0x00, MT_UNCACHED) | \ + MAIR(0x44, MT_BUFFERABLE) | \ + MAIR(0xaa, MT_WRITETHROUGH) | \ + MAIR(0xee, MT_WRITEBACK) | \ + MAIR(0x04, MT_DEV_SHARED) | \ + MAIR(0xff, MT_WRITEALLOC)) + +#define MAIR0VAL (MAIRVAL & 0xffffffff) +#define MAIR1VAL (MAIRVAL >> 32) #define PAGE_HYPERVISOR (MT_WRITEALLOC) #define PAGE_HYPERVISOR_NOCACHE (MT_DEV_SHARED) From patchwork Mon Aug 14 14:24:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110015 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281811obb; Mon, 14 Aug 2017 07:26:29 -0700 (PDT) X-Received: by 10.107.142.81 with SMTP id q78mr21723377iod.213.1502720789860; Mon, 14 Aug 2017 07:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720789; cv=none; d=google.com; s=arc-20160816; b=lVeZwtDbeqPZFWauIUYL+eaSCqYoD/cRLva6ldt8lQxFW+GBrFfEm6IWm+xpM2SIJH jCzXniesBWNRXnM7gGdGFCbpsrcrHZ0ASrdMS9Je+byOJw0wAUDpTgE65uW98VBsmTL+ n8Uz/stTwtbhZp/XLT7yhyOQFLbD6bK4BZ7Anfolv2FKfJfkAnurvZ8TFMbreruRy112 xdZOSxpjSRzFqXf8kY6rLJ7VZX3XEX6VQytKVw7aX2vbAJ0aTRaDQp26bLt6ryS1aV84 n6lNEnfmTSP6QMgma2IdrRBvl45U5cHhp+susyv4wmBBdrPXA9xQvoKl5lgzKc6eqZpa wiFA== 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:arc-authentication-results; bh=JxTATy1jkMOqEsR+Uu3gyMNDV3FAbwZ3n1naA28NWDw=; b=N5X41ml4L+xPUhi8bo0d+wmrHkckVoCiy7ts0jrvLljTCM/HocUfjrZa7RQr67MK12 pomg6ShxVp4Tc/kbfnocB9Qyy1R0+//XjXlUCV0rBmUnOn7mRt3Kc048s5wej/F2ljnK pT+5CmTbxRe6ol0pDXumjZgNWkTIAwD4DEmluKUc463LRnVeml+JWxKI04TiX+BMe92z 5iGbSb6UodFShI5IUf/Zs5Miu8v0Sf8gdhj1RTc0cm0fSY/jyIDfYCffaXpj9YKt4akL ZEHv5BUB19iGebrAMiKdPZRXEx/kmFSt1Gw/82mzAJWj7rYJYOT6gUai/FflK9J3N1Yz XQwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p71si5336670itg.23.2017.08.14.07.26.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:29 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIg-0000st-1p; Mon, 14 Aug 2017 14:25:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIe-0000nj-8L for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:00 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 29/E9-01736-BB2B1995; Mon, 14 Aug 2017 14:24:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTXfXpom RBlM2aVgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkLvn1nLGj1q7i0voWtgXGvdRcjF4eQwGZG icY5+5kgnNOMEksf3mHuYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWSBS4vCHH+wgtrCAr8TcO 6/AalgEVCUuv/wHVsMrYCWxr6cXbI6EgLzErraLrCA2J1C88+5OFhBbSMBS4sTq2WwTGLkXMD KsYtQoTi0qSy3SNTTRSyrKTM8oyU3MzNE1NDDVy00tLk5MT81JTCrWS87P3cQI9DADEOxgPHv a8xCjJAeTkihvgk9vpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3tSNEyOFBItS01Mr0jJzgKEG k5bg4FES4Z0FkuYtLkjMLc5Mh0idYjTm6Jjx8xsTx6sJ/78xCbHk5eelSonzloOUCoCUZpTmw Q2CxcAlRlkpYV5GoNOEeApSi3IzS1DlXzGKczAqCfNWgkzhycwrgdv3CugUJqBT+kC+4C0uSU RISTUwumxZuyaxLtF/f0PMvMnGL7Zei3MrXczzKPWTb+cfn++ONhvKdq2U/5uuF3FKaNlaA5v Gc+5X2k9XuBSEvnsY6T9X+2Uyh8Va9RQhTZeHWsyPbCssSz4ccb1nNlP817spTCsDU6zyPXmm dW0suflsambClC8Wbys2HD4suOCC5deJgtoT567aq8RSnJFoqMVcVJwIAEMipsJ8AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1502720697!104315680!1 X-Originating-IP: [217.140.101.70] 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 2609 invoked from network); 14 Aug 2017 14:24:58 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-206.messagelabs.com with SMTP; 14 Aug 2017 14:24:58 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 978541713; Mon, 14 Aug 2017 07:24:57 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ABD2A3F483; Mon, 14 Aug 2017 07:24:56 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:11 +0100 Message-Id: <20170814142418.13267-21-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 20/27] xen/arm: page: Use ARMv8 naming to improve readability 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" This is based on the Linux ARMv8 naming scheme (see arch/arm64/mm/proc.S). Each type will contain "NORMAL" or "DEVICE" to make clear whether each attribute targets device or normal memory. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mm.c | 28 +++++++++++++------------- xen/arch/arm/platforms/vexpress.c | 2 +- xen/drivers/video/arm_hdlcd.c | 2 +- xen/include/asm-arm/page.h | 42 +++++++++++++++++++-------------------- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 9c183f96da..a12baa86e7 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -54,7 +54,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) s = paddr & (PAGE_SIZE-1); l = min(PAGE_SIZE - s, len); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_BUFFERABLE); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_NORMAL_NC); memcpy(dst, src + s, l); clean_dcache_va_range(dst, l); diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 45974846a9..ce1858fbf3 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -290,7 +290,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) switch ( attr ) { - case MT_BUFFERABLE: + case MT_NORMAL_NC: /* * ARM ARM: Overlaying the shareability attribute (DDI * 0406C.b B3-1376 to 1377) @@ -305,8 +305,8 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) */ e.pt.sh = LPAE_SH_OUTER; break; - case MT_UNCACHED: - case MT_DEV_SHARED: + case MT_DEVICE_nGnRnE: + case MT_DEVICE_nGnRE: /* * Shareability is ignored for non-Normal memory, Outer is as * good as anything. @@ -369,7 +369,7 @@ static void __init create_mappings(lpae_t *second, count = nr_mfns / LPAE_ENTRIES; p = second + second_linear_offset(virt_offset); - pte = mfn_to_xen_entry(_mfn(base_mfn), MT_WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(base_mfn), MT_NORMAL); if ( granularity == 16 * LPAE_ENTRIES ) pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ for ( i = 0; i < count; i++ ) @@ -422,7 +422,7 @@ void *map_domain_page(mfn_t mfn) else if ( map[slot].pt.avail == 0 ) { /* Commandeer this 2MB slot */ - pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL); pte.pt.avail = 1; write_pte(map + slot, pte); break; @@ -543,7 +543,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va) { paddr_t ma = va + phys_offset; - return mfn_to_xen_entry(maddr_to_mfn(ma), MT_WRITEALLOC); + return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL); } /* Map the FDT in the early boot page table */ @@ -652,7 +652,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Initialise xen second level entries ... */ /* ... Xen's text etc */ - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_NORMAL); pte.pt.xn = 0;/* Contains our text mapping! */ xen_second[second_table_offset(XEN_VIRT_START)] = pte; @@ -669,7 +669,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* ... Boot Misc area for xen relocation */ dest_va = BOOT_RELOC_VIRT_START; - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_NORMAL); /* Map the destination in xen_second. */ xen_second[second_table_offset(dest_va)] = pte; /* Map the destination in boot_second. */ @@ -700,7 +700,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT); if ( !is_kernel(va) ) break; - pte = mfn_to_xen_entry(mfn, MT_WRITEALLOC); + pte = mfn_to_xen_entry(mfn, MT_NORMAL); pte.pt.table = 1; /* 4k mappings always have this bit set */ if ( is_kernel_text(va) || is_kernel_inittext(va) ) { @@ -771,7 +771,7 @@ int init_secondary_pagetables(int cpu) for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ ) { pte = mfn_to_xen_entry(virt_to_mfn(domheap+i*LPAE_ENTRIES), - MT_WRITEALLOC); + MT_NORMAL); pte.pt.table = 1; write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte); } @@ -869,13 +869,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, mfn_t first_mfn = alloc_boot_pages(1, 1); clear_page(mfn_to_virt(first_mfn)); - pte = mfn_to_xen_entry(first_mfn, MT_WRITEALLOC); + pte = mfn_to_xen_entry(first_mfn, MT_NORMAL); pte.pt.table = 1; write_pte(p, pte); first = mfn_to_virt(first_mfn); } - pte = mfn_to_xen_entry(_mfn(mfn), MT_WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(mfn), MT_NORMAL); /* TODO: Set pte.pt.contig when appropriate. */ write_pte(&first[first_table_offset(vaddr)], pte); @@ -915,7 +915,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) for ( i = 0; i < nr_second; i++ ) { clear_page(mfn_to_virt(mfn_add(second_base, i))); - pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_WRITEALLOC); + pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_NORMAL); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); } @@ -969,7 +969,7 @@ static int create_xen_table(lpae_t *entry) if ( p == NULL ) return -ENOMEM; clear_page(p); - pte = mfn_to_xen_entry(virt_to_mfn(p), MT_WRITEALLOC); + pte = mfn_to_xen_entry(virt_to_mfn(p), MT_NORMAL); pte.pt.table = 1; write_pte(entry, pte); return 0; diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index 9badbc079d..df2c4b5bec 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -65,7 +65,7 @@ int vexpress_syscfg(int write, int function, int device, uint32_t *data) uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); int ret = -1; - set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEVICE_nGnRE); if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START ) goto out; diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c index 5fa7f518b1..1175399dbc 100644 --- a/xen/drivers/video/arm_hdlcd.c +++ b/xen/drivers/video/arm_hdlcd.c @@ -227,7 +227,7 @@ void __init video_init(void) /* uses FIXMAP_MISC */ set_pixclock(videomode->pixclock); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEVICE_nGnRE); HDLCD[HDLCD_COMMAND] = 0; HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 86b227c291..d9dac92e73 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -29,43 +29,43 @@ * registers, as defined above. * */ -#define MT_UNCACHED 0x0 -#define MT_BUFFERABLE 0x1 -#define MT_WRITETHROUGH 0x2 -#define MT_WRITEBACK 0x3 -#define MT_DEV_SHARED 0x4 -#define MT_WRITEALLOC 0x7 +#define MT_DEVICE_nGnRnE 0x0 +#define MT_NORMAL_NC 0x1 +#define MT_NORMAL_WT 0x2 +#define MT_NORMAL_WB 0x3 +#define MT_DEVICE_nGnRE 0x4 +#define MT_NORMAL 0x7 /* * LPAE Memory region attributes. Indexed by the AttrIndex bits of a * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * * ai encoding - * MT_UNCACHED 000 0000 0000 -- Strongly Ordered - * MT_BUFFERABLE 001 0100 0100 -- Non-Cacheable - * MT_WRITETHROUGH 010 1010 1010 -- Write-through - * MT_WRITEBACK 011 1110 1110 -- Write-back - * MT_DEV_SHARED 100 0000 0100 -- Device + * MT_DEVICE_nGnRE 000 0000 0000 -- Strongly Ordered/Device nGnRnE + * MT_NORMAL_NC 001 0100 0100 -- Non-Cacheable + * MT_NORMAL_WT 010 1010 1010 -- Write-through + * MT_NORMAL_WB 011 1110 1110 -- Write-back + * MT_DEVICE_nGnRE 100 0000 0100 -- Device nGnRE * ?? 101 * reserved 110 - * MT_WRITEALLOC 111 1111 1111 -- Write-back write-allocate + * MT_NORMAL 111 1111 1111 -- Write-back write-allocate * */ #define MAIR(attr, mt) (_AC(attr, ULL) << ((mt) * 8)) -#define MAIRVAL (MAIR(0x00, MT_UNCACHED) | \ - MAIR(0x44, MT_BUFFERABLE) | \ - MAIR(0xaa, MT_WRITETHROUGH) | \ - MAIR(0xee, MT_WRITEBACK) | \ - MAIR(0x04, MT_DEV_SHARED) | \ - MAIR(0xff, MT_WRITEALLOC)) +#define MAIRVAL (MAIR(0x00, MT_DEVICE_nGnRnE)| \ + MAIR(0x44, MT_NORMAL_NC) | \ + MAIR(0xaa, MT_NORMAL_WT) | \ + MAIR(0xee, MT_NORMAL_WB) | \ + MAIR(0x04, MT_DEVICE_nGnRE) | \ + MAIR(0xff, MT_NORMAL)) #define MAIR0VAL (MAIRVAL & 0xffffffff) #define MAIR1VAL (MAIRVAL >> 32) -#define PAGE_HYPERVISOR (MT_WRITEALLOC) -#define PAGE_HYPERVISOR_NOCACHE (MT_DEV_SHARED) -#define PAGE_HYPERVISOR_WC (MT_BUFFERABLE) +#define PAGE_HYPERVISOR (MT_NORMAL) +#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) +#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Mon Aug 14 14:24:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110004 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281570obb; Mon, 14 Aug 2017 07:26:17 -0700 (PDT) X-Received: by 10.107.3.143 with SMTP id e15mr21505633ioi.308.1502720777082; Mon, 14 Aug 2017 07:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720777; cv=none; d=google.com; s=arc-20160816; b=gfZp9yfbP4aPOSZonjae3E9CEuboOYo4H6VR2fkEhxACUQj2R6knna93ExBWtNSRg5 mNLNdhuL5RbtSdWZDVbmdNvYhoJA180e9fysoNj9LdTcfQhf53kBGkh0213JPtgVnH9f PTjcL94gbe01bvtVKzyIErDHdPqmEkW+s7EhesoRALNSsdjf4qqRPo4Bm4Frsmk9X0xv LSdngGX6gZD61F58xtmAml2boSCxYrpA+qIPkVLqgm++oA2Zze+YyiZuzEIKLEwg1weE 8X+p8E41pubJCA9QLu2d/0aAbw9dvLx/6DXFQni4tF7rCULCvun6rgTaBqfouEakWaOm n3bA== 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:arc-authentication-results; bh=5pKfDoMOjdhF+eq7Q1+jI/QOrBf95mggZEVoYszUKvI=; b=DJs3gFqymgJ89PC0IQeq1cw7noqS/8GtlFchFcD/cUEBRgWRyz9+BLHqdpZZooUPn1 XPakjxACCDsyaDYA2ces+vUOdUo/F0IRrk6OUjSSIaSyHl7NSbcn7jA+axY1S8Mu4UAY 0Baxj6Wdt+KeFZ2l6nbicIVI0BFZVcUz6rZB4+j0uVbyRyEgVSlsNXQ4pYXhvr6Yw1x3 MZ++N6wMfF5S2Jc9mvVAXOgsuei5hSA7CtUMaiBUJ3StNMK7UFnYIiqTnqSo0K7gbN+e cApRaI2cEqEufUmZfaj6x5/vxRmEhYoSYnLLKtfjcXwld33uLLGogXXbjGLzevd8K5zl QAyw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e190si5448991itg.50.2017.08.14.07.26.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:17 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIg-0000ta-Ab; Mon, 14 Aug 2017 14:25:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIe-0000pI-SI for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:00 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 59/30-01994-CB2B1995; Mon, 14 Aug 2017 14:25:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXf3pom RBpdmKlss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBm7f7xiKfguXHHoykHmBsY+vi5GLg4hgc2M Em/XPmOBcE4zSuyaeYmxi5GTg01AU+LO509MILaIgLTEtc+XweLMApEShz/8YAexhQXCJE7ve MMGYrMIqEpsevEULM4rYCXxf+0tsHoJAXmJXW0XWUFsTqB4592dLCC2kIClxInVs9kmMHIvYG RYxahRnFpUllqka2Shl1SUmZ5RkpuYmaNraGCql5taXJyYnpqTmFSsl5yfu4kR6OF6BgbGHYx 9q/wOMUpyMCmJ8ib49EYK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuBN3TgxUkiwKDU9tSItMwcY ajBpCQ4eJRHeWSBp3uKCxNzizHSI1ClGXY5XE/5/YxJiycvPS5US5y0HKRIAKcoozYMbAQv7S 4yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeTeDTOHJzCuB2/QK6AgmoCP6QO7nLS5JREhJNT CG9Bwrj5ern7fw5qy3xwo7Ltf/93ojvWHr1EmHlI/GP70785H+3lXrrdUaGXSc1aeolQW3s21 xfSNrvMDq7WqJyuUWPI8y4ue1fzOPTbrAJr1tfqNy5lr1NtPbtrymyv4bv9lt5s2YZfYwYmXe dhPelKCHsufWcDQFPvzFcnL2JZFsXv6CD85KLMUZiYZazEXFiQDi1kFfdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1502720699!105578703!1 X-Originating-IP: [217.140.101.70] 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 62508 invoked from network); 14 Aug 2017 14:24:59 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-206.messagelabs.com with SMTP; 14 Aug 2017 14:24:59 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C255A1991; Mon, 14 Aug 2017 07:24:58 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D6CA33F483; Mon, 14 Aug 2017 07:24:57 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:12 +0100 Message-Id: <20170814142418.13267-22-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 21/27] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table 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" The description of AP[1] in Xen is based on testing rather than the ARM ARM. Per the ARM ARM, on EL2 stage-1 page table, AP[1] is RES1 as the translation regime applies to only one exception level (see D4.4.4 and G4.6.1 in ARM DDI 0487B.a). Update the comment and also rename the field to match the description in the ARM ARM. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/mm.c | 10 +++++----- xen/include/asm-arm/lpae.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index ce1858fbf3..c0d5fda269 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -273,7 +273,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) .table = 0, /* Set to 1 for links and 4k maps */ .ai = attr, .ns = 1, /* Hyp mode is in the non-secure world */ - .user = 1, /* See below */ + .up = 1, /* See below */ .ro = 0, /* Assume read-write */ .af = 1, /* No need for access tracking */ .ng = 1, /* Makes TLB flushes easier */ @@ -282,10 +282,10 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) .avail = 0, /* Reference count for domheap mapping */ }}; /* - * Setting the User bit is strange, but the ATS1H[RW] instructions - * don't seem to work otherwise, and since we never run on Xen - * pagetables in User mode it's OK. If this changes, remember - * to update the hard-coded values in head.S too. + * For EL2 stage-1 page table, up (aka AP[1]) is RES1 as the translation + * regime applies to only one exception level (see D4.4.4 and G4.6.1 + * in ARM DDI 0487B.a). If this changes, remember to update the + * hard-coded values in head.S too. */ switch ( attr ) diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index a62b118630..9402434c1e 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -33,7 +33,7 @@ typedef struct __packed { */ unsigned long ai:3; /* Attribute Index */ unsigned long ns:1; /* Not-Secure */ - unsigned long user:1; /* User-visible */ + unsigned long up:1; /* Unpriviledged access */ unsigned long ro:1; /* Read-Only */ unsigned long sh:2; /* Shareability */ unsigned long af:1; /* Access Flag */ From patchwork Mon Aug 14 14:24: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: 110009 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281633obb; Mon, 14 Aug 2017 07:26:20 -0700 (PDT) X-Received: by 10.107.201.150 with SMTP id z144mr18268538iof.132.1502720780696; Mon, 14 Aug 2017 07:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720780; cv=none; d=google.com; s=arc-20160816; b=g1e4/wf2zocG33OR21vEAaa0S5KD72xweLM7nS6nZkB7HlhxX4HCx8yo5Na4XXeN60 PpCHo/4BPly76gpgmhiMa+pDk7kNhuWl/6Ghh1204ZvkK9JnoC4u5cR6MdEfvl5Zmr2T ndCYKhku0C2xkjo1RANSu5tjGR16gRnvE9CBl6ZQqAL9H5ANdD1p82zxtQaH429wfALn Lm+V2Z7tj5+EmATdtEPiDmeb6qkMhrgZ1N2eQOxSTpB39TbRGAHYQrLwRObT8pBj+rh5 dUwsuQePsxpyyv8bQQgo1gddKOp/dsyNnIisTxiHTRoEnqe89GfM/fh8gFahjjzMJQPy UgHQ== 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:arc-authentication-results; bh=hRQu9Fg2AufwddR8jW14QnxIb4HSaovdPJDxBRamlc4=; b=ZNf6F8qGNj4vSAd0Lk0XcPRM6n2txyV+8KDTheX+oblsUGwqgvXuimXq5r/3yefrt+ BqkE8TUmLaPO4TdzP9YubLCsCEROM9yxBO+Pj0qGr1u1io3lZYx+ukk6svBPt0/dQlbN iREp+OOeSo6fnrdsRYZUU0fToKcQl3Tl62skqd7FwDhQt1VxRzOksbswOkRRsn3gBEeD 6KjhuJRrUAKDhEAC47HHsDq9Qk4IfQ7G56hkRHbxXO91+vils4kIlCnDUU4a/duFNb9G YzjBZJ4XAqHCHM5P4/1i7kHMbd/A+hG91EpRYNERoEgw6DoQ7SOHu0+iNnvWLRlL7nuK yrjw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id c75si7901894ioa.256.2017.08.14.07.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:20 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIh-0000wF-0u; Mon, 14 Aug 2017 14:25:03 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIf-0000qm-OZ for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:01 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id AE/E9-09901-DB2B1995; Mon, 14 Aug 2017 14:25:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTXfPpom RBl8uqFss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnbNn1jLGjlqJjzaCFLA+M+ti5GLg4hgc2M Er8uPmKBcE4zSiw6uxXI4eRgE9CUuPP5ExOILSIgLXHt82VGEJtZIFLi8Icf7CC2sECExIpNM 8BsFgFViQM3j7GC2LwCVhIHrt8G65UQkJfY1XYRLM4JFO+8uxNsvpCApcSJ1bPZJjByL2BkWM WoXpxaVJZapGupl1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kR6F8GINjBeHdTwCF GSQ4mJVHeBJ/eSCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvKkbJ0YKCRalpqdWpGXmAAMNJi3B waMkwjsLJM1bXJCYW5yZDpE6xajL8WrC/29MQix5+XmpUuK85SBFAiBFGaV5cCNgQX+JUVZKm JcR6CghnoLUotzMElT5V4ziHIxKwryVIFN4MvNK4Da9AjqCCeiIPpD7eYtLEhFSUg2MOmctz0 oaSKdGTd9Xuqase8HXMz8ud3A7/d9QniNicNLS/O8f9iWTvqjPNI1M9vI+tr7w4trP9guCPc/ nHfrMPzv5ywFdrqaVsTdavnm2BBpoqeotOX3EsSUnotA/5/s3e7fpiUs//ynp2v+I45fbzNn5 6v73VV4Kpy5aIfZB3t3a7esvvnITJZbijERDLeai4kQABh6ZGHUCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1502720700!111407837!1 X-Originating-IP: [217.140.101.70] 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 19353 invoked from network); 14 Aug 2017 14:25:00 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:25:00 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ECA161713; Mon, 14 Aug 2017 07:24:59 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0CE2E3F483; Mon, 14 Aug 2017 07:24:58 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:13 +0100 Message-Id: <20170814142418.13267-23-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 22/27] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator() 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" We should consider the early boot period to end when we stop using the boot allocator. This is inline with x86 and will be helpful to know whether we should allocate memory from the boot allocator or xenheap. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/setup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 277b566b88..46737a2eca 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -757,6 +757,12 @@ void __init start_xen(unsigned long boot_phys_offset, end_boot_allocator(); + /* + * The memory subsystem has been initialized, we can now switch from + * early_boot -> boot. + */ + system_state = SYS_STATE_boot; + vm_init(); if ( acpi_disabled ) @@ -779,8 +785,6 @@ void __init start_xen(unsigned long boot_phys_offset, console_init_preirq(); console_init_ring(); - system_state = SYS_STATE_boot; - processor_id(); smp_init_cpus(); From patchwork Mon Aug 14 14:24: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: 110010 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281648obb; Mon, 14 Aug 2017 07:26:22 -0700 (PDT) X-Received: by 10.107.163.9 with SMTP id m9mr8949850ioe.194.1502720782086; Mon, 14 Aug 2017 07:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720782; cv=none; d=google.com; s=arc-20160816; b=B+gMROI1JJToeQ7VVWMlnpXB904mI0DzzWxsx31wj+y00HF6Jc7ungilj9Dx0LSLhv mMcu6kcdMp6ScAoutGcjM14t7hNlQ4zW4le7fdbM/HnDMP8KyrysR/t1nWUCSABwlk9k HrMQGMjqzB2JfQGD/i8yMke7U/PYmsNSfUrtCxSoCIRlLnBV5OYYn/vdTU8Exg6zNbcM UD//GZ42KHeBVCWLPjtQK3Rtbzy93gh/uhDdBk5BA2pHiWj5WOs8THXuyXSNVK8FFFuO Xl8ppgLt2W1l/c0agQifh9hFca9oWMsfpCBjBHpKBs/Fs/wOU35+XhFYZ31m3XzXjkAm ff2w== 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:arc-authentication-results; bh=Vm4GJ8Bodth7i8WLT7Bv3tUhaNXPYy0/ydlqhXVZtVE=; b=ThnsscJstJj+M9cC33MpBNYtV128xQv/1TnnSa31iZBDm6fMw0uNdkWz/R39Bfm167 ZDHe0wgcGwiVg8YCm2VFWjYVfjfsb71UBPJgK9Yu8L7BYcIeYtQSr+48CV9SasmF2hCN mfnQzFbkitcuZaXuMqZvLoldVYgxMij4gqSmkeEuiWsF5TaeQgACVl1Bl28RG1V/kkPg t1xU/RrbzCtQM+0rW1fzszBDctCUPfqTJzSFtKAx2ZdKkYGEIoyOBcJg0cIFDnqUS1pY bvaGFgW/lUjbrmpRcbn4VXcsoobPoX06eFOwMh9lGpPRrH3P/i9zNRkyxlcMs4hmKw5e wLSw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 202si5325302itu.136.2017.08.14.07.26.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:22 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIj-00011a-8Q; Mon, 14 Aug 2017 14:25:05 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIh-0000xh-Sm for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:03 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id 62/09-03368-FB2B1995; Mon, 14 Aug 2017 14:25:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXfvpom RBgsmGFks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBm7v71lL7jBWzHreCdzA+M2ji5GLg4hgc2M EldWzmeBcE4zStx7PIeti5GTg01AU+LO509MILaIgLTEtc+XGUFsZoFIicMffrCD2MICQRLfO rYzg9gsAqoSfxbsAuvlFbCSeHF+KiuILSEgL7Gr7SKYzQkU77y7kwXEFhKwlDixejbbBEbuBY wMqxg1ilOLylKLdA2N9ZKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAj3MAAQ7GL8 sCzjEKMnBpCTKm+DTGynEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgjd148RIIcGi1PTUirTMHGCo waQlOHiURHhngaR5iwsSc4sz0yFSpxh1OV5N+P+NSYglLz8vVUqc99UGoCIBkKKM0jy4EbCwv 8QoKyXMywh0lBBPQWpRbmYJqvwrRnEORiVhXieQVTyZeSVwm14BHcEEdEQfyP28xSWJCCmpBs b9mVonNT4w8RpNzuILrHoU73g4oEQgKkfnYsFn27oy7hO2ujMu7bM4HVvTdO9bVWiMCMep+K4 HUQs9VK9v2/rUtCvtWMzBlQqR313X5mpuXHHAzcBv73+nG8HFAlsD3vps8n+2SmqyOfPcQynL SlmXrxDQO6ciu7Rlz7vVavFGvvp+MYZ/Y5VYijMSDbWYi4oTAXWQEYJ2AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1502720701!77719551!1 X-Originating-IP: [217.140.101.70] 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 10167 invoked from network); 14 Aug 2017 14:25:01 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-9.tower-21.messagelabs.com with SMTP; 14 Aug 2017 14:25:01 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 22C91199B; Mon, 14 Aug 2017 07:25:01 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 372973F483; Mon, 14 Aug 2017 07:25:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:14 +0100 Message-Id: <20170814142418.13267-24-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 23/27] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries 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" The parameter 'ai' is used either for attribute index or for permissions. Follow-up patch will rework that parameters to carry more information. So rename the parameter to 'flags'. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/mm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index c0d5fda269..411fe02842 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -986,7 +986,7 @@ static int create_xen_entries(enum xenmap_operation op, unsigned long virt, mfn_t mfn, unsigned long nr_mfns, - unsigned int ai) + unsigned int flags) { int rc; unsigned long addr = virt, addr_end = addr + nr_mfns * PAGE_SIZE; @@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op, } if ( op == RESERVE ) break; - pte = mfn_to_xen_entry(mfn, ai); + pte = mfn_to_xen_entry(mfn, flags); pte.pt.table = 1; write_pte(entry, pte); break; @@ -1038,8 +1038,8 @@ static int create_xen_entries(enum xenmap_operation op, else { pte = *entry; - pte.pt.ro = PTE_RO_MASK(ai); - pte.pt.xn = PTE_NX_MASK(ai); + pte.pt.ro = PTE_RO_MASK(flags); + pte.pt.xn = PTE_NX_MASK(flags); if ( !pte.pt.ro && !pte.pt.xn ) { printk("%s: Incorrect combination for addr=%lx\n", From patchwork Mon Aug 14 14:24:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110005 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281581obb; Mon, 14 Aug 2017 07:26:17 -0700 (PDT) X-Received: by 10.107.11.205 with SMTP id 74mr19905028iol.303.1502720777718; Mon, 14 Aug 2017 07:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720777; cv=none; d=google.com; s=arc-20160816; b=wjxUcxRa6oaWZucXYQpljjs6wVpsplAzfLIVwEo1R/gVCHKzueoLOM280qxMGzL9Yk Oy5xMGOc2qWwkzCD2BQMvajJ6BPeWcCL3XkTXUtHLIGfe/9EKz2khfeZyGGI5lQsAlCA LoNSyNjlNbfYq7/+4vVG2mn26jc84/pucdA6f1lgwJbUr6AdI2ZXvKvC2qRQEN4dKNdP +j8sJqZqEItAczy8KCpSytXKP/seeWA5Ihp/n7cx6wF2/khFDgPW4ABQf+VyZvTxafn/ bltsHmAvdaVXkNCR+tcB5zuTfqeAnyXuSsL70vDgOn9g9tq98JXfVUaduA9fX/YtgdRE rSIA== 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:arc-authentication-results; bh=l1GEE3Ytr5FB8ra+3RSMN4kVuB1lXomWJ1QMI1WJwfc=; b=YLBKFHeR9t8pvMvms5GmyFqx/thu2m+JxM7jfXLLY/D7eZyWABwvQmcZEpGQg6lU9L OhIAc5VzqGXsq6DqpiW6xR2MBYxUYM+c9XPKMA1Aqu6se8Eg+ueY2WMBKbQI50fqltmk bzAM6uncQo7VvKzim8AkvRi2O3jnw07gfSwITiI+xeJtMmZ4ledscUbGlybB21oFqtXM EJDgx0wW2cHeiontr9oT41x3/PXWOffiXGUPdqnJ9OGHx8ZmBDxXfNVYiPeRTIz8xIKK XHpPyLRIYkZThAGZjpw0TU+9jQNYd+reDff7c3qlH0pT5s/MgQybXsmZZrBaLFkBW5Pu 9glg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z65si5317583itd.155.2017.08.14.07.26.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:17 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIj-00012S-G7; Mon, 14 Aug 2017 14:25:05 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIi-0000yF-8L for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:04 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id FD/12-22472-FB2B1995; Mon, 14 Aug 2017 14:25:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXf/pom RBkdPMVss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkHd75nKvjCXdF97gxLA+MCzi5GLg4hgU2M Ek+ObWaDcE4zSpybeIe5i5GTg01AU+LO509MILaIgLTEtc+XGUFsZoFIicMffrCD2MICsRK/J u0Di7MIqEo0fTnLAmLzClhJPFv1CiwuISAvsavtIiuIzQkU77y7E6xGSMBS4sTq2WwTGLkXMD KsYtQoTi0qSy3SNTTSSyrKTM8oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQI9DADEOxgfNX tfIhRkoNJSZQ3wac3UogvKT+lMiOxOCO+qDQntfgQowwHh5IEb+rGiZFCgkWp6akVaZk5wFCD SUtw8CiJ8M4CSfMWFyTmFmemQ6ROMepyvJrw/xuTEEtefl6qlDhvOUiRAEhRRmke3AhY2F9il JUS5mUEOkqIpyC1KDezBFX+FaM4B6OSMO9mkCk8mXklcJteAR3BBHREH8j9vMUliQgpqQZGyU sXMt/Jvexm/mWzxlP3kMEsvi2SNvUuVyZGi/MYvFZmc/9y79JkG+sNKp13o2OXSWvXbgvUuiD LOU2jZnpQNju/F0O2QFV6l/mnLPbCO5Z/9l3fN0PhVHpkimma4aObe3j/sj3Ui0nJ9eh0WfXA auWE33NL1GvvTJbtWfv7PlNF1a9D28WVWIozEg21mIuKEwF1eKMLdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1502720702!102389843!1 X-Originating-IP: [217.140.101.70] 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 57337 invoked from network); 14 Aug 2017 14:25:02 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-31.messagelabs.com with SMTP; 14 Aug 2017 14:25:02 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4D4AE80D; Mon, 14 Aug 2017 07:25:02 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 61A113F483; Mon, 14 Aug 2017 07:25:01 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:15 +0100 Message-Id: <20170814142418.13267-25-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 24/27] xen/arm: page: Describe the layout of flags used to update page tables 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" Currently, the flags used to update page tables (i.e PAGE_HYPERVISOR_*) only contains the memory attribute index. Follow-up patches will add more information in it. At the same time introduce PAGE_AI_MASK to get the memory attribute index easily. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/mm.c | 2 +- xen/include/asm-arm/page.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 411fe02842..cd7bcf7aca 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op, } if ( op == RESERVE ) break; - pte = mfn_to_xen_entry(mfn, flags); + pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); pte.pt.table = 1; write_pte(entry, pte); break; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index d9dac92e73..1bf8e9d012 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -63,6 +63,13 @@ #define MAIR0VAL (MAIRVAL & 0xffffffff) #define MAIR1VAL (MAIRVAL >> 32) +/* + * Layout of the flags used for updating the hypervisor page tables + * + * [0:2] Memory Attribute Index + */ +#define PAGE_AI_MASK(x) ((x) & 0x7U) + #define PAGE_HYPERVISOR (MT_NORMAL) #define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) #define PAGE_HYPERVISOR_WC (MT_NORMAL_NC) From patchwork Mon Aug 14 14:24:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110007 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281617obb; Mon, 14 Aug 2017 07:26:19 -0700 (PDT) X-Received: by 10.36.118.80 with SMTP id z77mr5495843itb.53.1502720779503; Mon, 14 Aug 2017 07:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720779; cv=none; d=google.com; s=arc-20160816; b=HWZK8yTx8wKxoUjZNtTb3A/vhNzZscgJImSTh+OEDMxZ9Ys8IZkwL6w19Tw3wGZ7Oq kdDPq0/n5UtvjEkQKcxo1JsKTfwbNAdOSCPjwuI+3IgIKHHvkqcvJU2k8sOZnuEtKq6Y dAeQ2bWkQzQRchr0rxjKbYBIqc3Du7RsfVF7GlBaN3yGlhRuKuQZuO692+lo6TQUIiub XqocuZyx+Kgby0molyQ/fF75J51r9zKO0d9DviE9f2Jn8ffM1WMZOKqKpvjLmIh6Bzsf F5+h+vcREshbmbE33OCQjBYa5Dv6xgVVrMuEMxLs/aMdYml07mijUyua8j7jIk5u0X+D yFdA== 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:arc-authentication-results; bh=hl+q87xBT2jfLYIgo+tZVzXfROsq0QeifgOgv/WyFdA=; b=KCG8aTzQm7kCLrTpF3f8HDeclvGEhdMJkvIPsovP5ApsVKlWADZZAXN+kEKkYjPkQo AKYq3WjgHRXVyiknvqWa94UsvHDHwcon3kzFWus5BPPtjImAadviAj4j+tVIqrimzU3D WGMO4w82YH32GXRzCezxDEYIZEqOPVQXGLh5B3aIugbYwviDzDg7Nvi1Ta4ebbii4tnl zsJx4wp5jyraMzDO/1pmWv5T4JmQvvBM0Eh3+IlxiOA1ND5DOCBcL+nr0hTeDksYXQkP sOHX6YUeBy7KaaaEn3rBsRf6jX6gRbIkmBNZunBqUKl9oCWHKfU1YrymTXR8Wsue0n5H 3JFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r2si7029180iod.280.2017.08.14.07.26.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:19 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIj-00013b-Q7; Mon, 14 Aug 2017 14:25:05 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIj-0000qm-2u for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:05 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id 2A/1A-09901-0C2B1995; Mon, 14 Aug 2017 14:25:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTffApom RBrMXc1ss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmXb71gLZjHX7HszE3GBsb3PF2MnBxCApsZ JU635ncxcgHZpxklbky9ygSSYBPQlLjz+ROYLSIgLXHt82VGEJtZIFLi8Icf7CC2sICjxKrb3 WwgNouAqsSG7XPBbF4BK4nXr/aA2RIC8hK72i6ygticQPHOuztZIBZbSpxYPZttAiP3AkaGVY waxalFZalFuobmeklFmekZJbmJmTm6hgZmermpxcWJ6ak5iUnFesn5uZsYgf5lAIIdjLc3Bhx ilORgUhLlTfDpjRTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwZu6cWKkkGBRanpqRVpmDjDQYNIS HDxKIryzQNK8xQWJucWZ6RCpU4y6HK8m/P/GJMSSl5+XKiXO+2oDUJEASFFGaR7cCFjQX2KUl RLmZQQ6SoinILUoN7MEVf4VozgHo5Iw72aQVTyZeSVwm14BHcEEdEQfyP28xSWJCCmpBkaOZZ vLnbNVtB86BvY7fwsJiFf6vKOgXNc47My+BVIx8jXHZcUf7ckLFFn59znj96pZiTrfJMruNx1 ukfN9WNR3NShCWXezcNtV/T1iGTzxGy6/mf8/fOv13d84ljZuK+acYFb6x9H5b9sZhYTeB4vy uHZ81xa4uyas7WphbGtG8Oq8yp5ocyWW4oxEQy3mouJEAJoGXXV1AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1502720703!100827991!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18124 invoked from network); 14 Aug 2017 14:25:04 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:25:04 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 777C315A2; Mon, 14 Aug 2017 07:25:03 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8BEF23F483; Mon, 14 Aug 2017 07:25:02 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:16 +0100 Message-Id: <20170814142418.13267-26-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 25/27] xen/arm: mm: Embed permission in the flags 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" Currently, it is not possible to specify the permission of a new mapping. It would be necessary to use the function modify_xen_mappings with a different set of flags. Add introduce a couple of new flags for the permissions (Non-eXecutable, Read-Only) and also provides define that combine the memory attribute and permission for common combination. A follow-up patch will change modify_xen_mappings to use the new flags. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/include/asm-arm/page.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 1bf8e9d012..047220f86b 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -67,12 +67,28 @@ * Layout of the flags used for updating the hypervisor page tables * * [0:2] Memory Attribute Index + * [3:4] Permission flags */ #define PAGE_AI_MASK(x) ((x) & 0x7U) -#define PAGE_HYPERVISOR (MT_NORMAL) -#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) -#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC) +#define _PAGE_XN_BIT 3 +#define _PAGE_RO_BIT 4 +#define _PAGE_XN (1U << _PAGE_XN_BIT) +#define _PAGE_RO (1U << _PAGE_RO_BIT) +#define PAGE_XN_MASK(x) (((x) >> _PAGE_XN_BIT) & 0x1U) +#define PAGE_RO_MASK(x) (((x) >> _PAGE_RO_BIT) & 0x1U) + +/* Device memory will always be mapped read-write non-executable. */ +#define _PAGE_DEVICE _PAGE_XN +#define _PAGE_NORMAL MT_NORMAL + +#define PAGE_HYPERVISOR_RO (_PAGE_NORMAL|_PAGE_RO|_PAGE_XN) +#define PAGE_HYPERVISOR_RX (_PAGE_NORMAL|_PAGE_RO) +#define PAGE_HYPERVISOR_RW (_PAGE_NORMAL|_PAGE_XN) + +#define PAGE_HYPERVISOR PAGE_HYPERVISOR_RW +#define PAGE_HYPERVISOR_NOCACHE (_PAGE_DEVICE|MT_DEVICE_nGnRE) +#define PAGE_HYPERVISOR_WC (_PAGE_DEVICE|MT_NORMAL_NC) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Mon Aug 14 14:24:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110011 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281673obb; Mon, 14 Aug 2017 07:26:23 -0700 (PDT) X-Received: by 10.107.153.141 with SMTP id b135mr19677911ioe.247.1502720783075; Mon, 14 Aug 2017 07:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720783; cv=none; d=google.com; s=arc-20160816; b=ad0O/BbYGrMFuseiTvasUn9d3bnnHsh8NxfL4QR9zYFOrsnE+GZv9P6k3x4V5+TdFg rP5uX4R6QuTtb6ZbpQLt3eUUsL3dx4Rea9LUnVOGSwjZHS+5jZ3sG+7o4a2DHHpNjYgB iDtggqe9eJbcNElKFIq2SarmbEAqyx9n9kLh+KlBuoZuHmPqAcoIC3BD3ndf3WCu4bJH mWQtH/597U1YxI/V8YLEZTKUiz76ZZEN8jwrkgqcCYc/ERhCbJFbfr7ic/XIWHqrgaON XOSMs52FcAHakELramcEPSlpOF9IHNugUxtjgFoNX/dr2/8fFkx3wcs0ksOKNsSDtqPF 1zHw== 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:arc-authentication-results; bh=FuRdgwFbjSR6om4q2GPtlIrF6Eeplyoc9+S3HhowyMQ=; b=DFcVTfM17XaoCpTLGc7i2rgi305P/1P9MaDFSg/iutMUfQ+O8gGxcvQrQGgCEmWe3K Galgm5kf2Pe4W1Vj2O0YIGSYFRRQ70FNyPTUKWUo+1Y/GphzToOeZ7Qsok0LuTQOPeI3 Bc+ye24iowhWmK3OgMY096mU7Hj/66Geq5sCMhfouDqGp9oriiLqshq5kI2gSvj/KC9T IfvvWNYRxDdTkk7l8Ew+KIOsczo8QygpOb65/x4XfYMa0Cm0uuehxDJoZvKNTWMhMYT8 tqJudPCpiz+llSOBGx9/Mneb2FVvw3ARocga8ch/FYfaV0IFfyp827nerBWKMR96kihs giFg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id k185si7235147ioe.241.2017.08.14.07.26.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:23 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIl-00016r-2O; Mon, 14 Aug 2017 14:25:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIj-0000qm-W9 for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:06 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id E4/2A-09901-1C2B1995; Mon, 14 Aug 2017 14:25:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRWlGSWpSXmKPExsVysyfVTffgpom RBseuiFos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBn9K9kKOjgqzq50bmBcwdrFyMUhJLCJUeLg ktMsEM5pRomlrycydjFycrAJaErc+fyJCcQWEZCWuPb5MlicWSBS4vCHH+wgtrBAuMSUFc1gN ouAqkTLnJ3MXYwcHLwCVhKrJyqChCUE5CV2tV1kBbE5gcKdd3eygNhCApYSJ1bPZpvAyL2AkW EVo0ZxalFZapGukYFeUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrFecn7uJkagbxmAYAfjr2U BhxglOZiURHkTfHojhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwpm6cGCkkWJSanlqRlpkDDDKY tAQHj5II79oNQGne4oLE3OLMdIjUKUZdjlcT/n9jEmLJy89LlRLnfQVSJABSlFGaBzcCFvCXG GWlhHkZgY4S4ilILcrNLEGVf8UozsGoJMxbCXIJT2ZeCdymV0BHMAEd0QdyP29xSSJCSqqBMd H7d31m2Ky+5JJ3ntkOU37+3V2+ItBk3+2NHk1P0+NTZiw63RQzUeiG8drXT/4qbGpf8v/sjJ3 FlllhTMluFmvWLPh94FL/4SlRP298iEs8HzD5bOrdzOhTXffNpbNM9P+uLjMWiL/hzHosy6Hg 5qMFksmnbHjb7p3w/WLNrPmPZ/KKc/Jfw5RYijMSDbWYi4oTARLhFFhzAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1502720704!106249436!1 X-Originating-IP: [217.140.101.70] 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 11758 invoked from network); 14 Aug 2017 14:25:05 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:25:05 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A18C480D; Mon, 14 Aug 2017 07:25:04 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B60483F483; Mon, 14 Aug 2017 07:25:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:17 +0100 Message-Id: <20170814142418.13267-27-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 26/27] xen/arm: mm: Handling permission flags when adding a new mapping 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" Currently, all the new mappings will be read-write non-executable. Allow the caller to use other permissions. Signed-off-by: Julien Grall --- xen/arch/arm/mm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index cd7bcf7aca..fe0646002e 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1022,6 +1022,14 @@ static int create_xen_entries(enum xenmap_operation op, if ( op == RESERVE ) break; pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); + pte.pt.ro = PAGE_RO_MASK(flags); + pte.pt.xn = PAGE_XN_MASK(flags); + if ( !pte.pt.ro && !pte.pt.xn ) + { + printk("%s: Incorrect combination for addr=%lx\n", + __func__, addr); + return -EINVAL; + } pte.pt.table = 1; write_pte(entry, pte); break; From patchwork Mon Aug 14 14:24:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110018 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281846obb; Mon, 14 Aug 2017 07:26:31 -0700 (PDT) X-Received: by 10.36.214.79 with SMTP id o76mr5638951itg.62.1502720791523; Mon, 14 Aug 2017 07:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720791; cv=none; d=google.com; s=arc-20160816; b=TmbuLYGIMCEmLkct6JtjtVFYJnJQn4blKwe36cNUqDaGzEZCMd73j0gqWRD9nN3rZZ 5/hYs1bJw8lv/8IXWkvimbXuD9Y0nLvighuYgxUm/FHNaT7rPoSYsBsviVOruAHyXqMm M21PXjfSTznmOTdqrVSonLvAoEaaPT7qkNMit+0x+I45Wy16V73Ddh6C7QLsf+X4Zxl0 81L4vUNBfy5snaXdVeFqjmgL/BA5H9rbMFNEJnPEMXvRFEIHkBGxp3S7lVHoQQPD5Z29 I6ErQtC0goqHxZXsSJIl3wRhawhapYOl8s86PyvtZFZ0BYLg4xKK+UHQhEShOVPnC6dW Cntw== 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:arc-authentication-results; bh=9wMrDxf7AvXiNmCAa0B8SlW4vtpUueHZk73MFqE60x8=; b=k9CpfaJGifON01+PYN+vbNlr9rDORhipRgdcdWroFkCwneYuP82XdQQOD44b/2MNBZ f7nqRrOliRiP2vuqq7mPu2JX5E9NFR2avDlnCLsGl693dbf9sA5UvoA/1ot7NHj9mTYA B3XK8XpaQO4Yb35QhIMPnfw8u/JCn6oy+0DRdKYsVRGB8HjaqiFZtN/QBgGIaoJrNLB2 KD4Gl5nDcC0IXlJGqx9Z/0laww7s4Obdi8uKa4V56iRnatBUbl+QAO+n1TSHWVCjcpha VSmFAoPQL9sEAKz6Go5S6KMC3SjaiwRlQO8K15wRByL9H2K/p5eZTZDIxgkh1a2OERbg emvw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w19si5415891ite.55.2017.08.14.07.26.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:31 -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; 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIq-0001JT-E4; Mon, 14 Aug 2017 14:25:12 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIp-0001Fi-7x for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:11 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 9D/7A-01996-6C2B1995; Mon, 14 Aug 2017 14:25:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTffQpom RBi9Pmlks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnXbkxkLDglXrHmwH7WBsbjgl2MXBxCApsY JSZdb2GEcE4zSrxatZSpi5GTg01AU+LO509gtoiAtMS1z5fBipgFtjNKnJ/7mx0kISyQLHFg0 3Mgm4ODRUBV4sWqCJAwr4CVxK+OX4wgtoSAvMSutousIDYnULzz7k4WEFtIwFLixOrZbBMYuR cwMqxi1ChOLSpLLdI1NNFLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAj0MAMQ7GA 8e9rzEKMkB5OSKG+CT2+kEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQne1I0TI4UEi1LTUyvSMnOA oQaTluDgURLhnQWS5i0uSMwtzkyHSJ1i1OV4NeH/NyYhlrz8vFQpcd5ykCIBkKKM0jy4EbCwv 8QoKyXMywh0lBBPQWpRbmYJqvwrRnEORiVh3kqQKTyZeSVwm14BHcEEdEQfyP28xSWJCCmpBk b+vFvii7KPLDh7dcE/r+rdjUfDM/kULn+zP/6tfr5CnTbHE22BGvVDy1wi/byi1vgwMLuzV6S fNmzOZMkTYVG6Zdy3OPRvjdjTszk8LR63rkVZ5IarbT57s2xhy/VbL1+KxXi+OMEygWN+dJPh +7tWJ9K3pd/6Jqe+PTb27yy5OmXPE9m7liuxFGckGmoxFxUnAgCjrPf5dgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-206.messagelabs.com!1502720706!103619332!1 X-Originating-IP: [217.140.101.70] 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 29093 invoked from network); 14 Aug 2017 14:25:06 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-206.messagelabs.com with SMTP; 14 Aug 2017 14:25:06 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2015C80D; Mon, 14 Aug 2017 07:25:06 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0BC33F483; Mon, 14 Aug 2017 07:25:04 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:18 +0100 Message-Id: <20170814142418.13267-28-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Ross Lagerwall Subject: [Xen-devel] [PATCH 27/27] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one 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" This will help to consolidate the page-table code and avoid different path depending on the action to perform. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Cc: Konrad Rzeszutek Wilk Cc: Ross Lagerwall arch_livepatch_secure is now the same as on x86. It might be possible to combine both, but I left that alone for now. --- xen/arch/arm/livepatch.c | 6 +++--- xen/arch/arm/mm.c | 5 ++--- xen/include/asm-arm/page.h | 11 ----------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c index 3e53524365..279d52cc6c 100644 --- a/xen/arch/arm/livepatch.c +++ b/xen/arch/arm/livepatch.c @@ -146,15 +146,15 @@ int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type type) switch ( type ) { case LIVEPATCH_VA_RX: - flags = PTE_RO; /* R set, NX clear */ + flags = PAGE_HYPERVISOR_RX; break; case LIVEPATCH_VA_RW: - flags = PTE_NX; /* R clear, NX set */ + flags = PAGE_HYPERVISOR_RW; break; case LIVEPATCH_VA_RO: - flags = PTE_NX | PTE_RO; /* R set, NX set */ + flags = PAGE_HYPERVISOR_RO; break; default: diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index fe0646002e..c2fd4baef9 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1046,8 +1046,8 @@ static int create_xen_entries(enum xenmap_operation op, else { pte = *entry; - pte.pt.ro = PTE_RO_MASK(flags); - pte.pt.xn = PTE_NX_MASK(flags); + pte.pt.ro = PAGE_RO_MASK(flags); + pte.pt.xn = PAGE_XN_MASK(flags); if ( !pte.pt.ro && !pte.pt.xn ) { printk("%s: Incorrect combination for addr=%lx\n", @@ -1090,7 +1090,6 @@ int destroy_xen_mappings(unsigned long v, unsigned long e) int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags) { - ASSERT((flags & (PTE_NX | PTE_RO)) == flags); return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); } diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 047220f86b..079097d429 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -91,17 +91,6 @@ #define PAGE_HYPERVISOR_WC (_PAGE_DEVICE|MT_NORMAL_NC) /* - * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be - * used with modify_xen_mappings. - */ -#define _PTE_NX_BIT 0U -#define _PTE_RO_BIT 1U -#define PTE_NX (1U << _PTE_NX_BIT) -#define PTE_RO (1U << _PTE_RO_BIT) -#define PTE_NX_MASK(x) (((x) >> _PTE_NX_BIT) & 0x1U) -#define PTE_RO_MASK(x) (((x) >> _PTE_RO_BIT) & 0x1U) - -/* * Stage 2 Memory Type. * * These are valid in the MemAttr[3:0] field of an LPAE stage 2 page