From patchwork Wed Oct 4 18:15:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114784 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3428394qgn; Wed, 4 Oct 2017 11:17:26 -0700 (PDT) X-Received: by 10.36.67.75 with SMTP id s72mr29508151itb.12.1507141046123; Wed, 04 Oct 2017 11:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507141046; cv=none; d=google.com; s=arc-20160816; b=Jz5HjRq1k2+USXKCCoUt8uoDFYIn0CW0fAUKMtDVvH5krKrPuu7wGchDKToaBtUTK7 rRbHI0bGS1gTd6zLrSGFfVEs4v7Cy5VgJ74UjPSe2KJsFurVAhBqQEvoxjuHw9zv/JsI KyAJkxXJDgtUq1JkD+1Un9oU3cwA8ol0uHFg+BwZaa6JRsTR6NE0f2UaA/MfYONHrNMo xwJEe+MERN2jTkHR4OlJQiVXppA4YK9oH1SgvHRR9eGVq8DeGR61e8insv5/OWDtsZtO WM03Cr83IbSieWtTuH2b+AV6w4o49wdHajtZxhi9GVW/vdYhPXRXB+R9OfupKk6cJmdr h75g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=mxVIMOls87t1XhIehbUTQejD98csvA1XDfx3RQrgdIw=; b=fqoRcRig7WqcpxzDc1igKLPSln7Mot8Hbhr5REby0LWlyMRZ4j3wF9APCmX9GYI6JD GQAlPbsn7jsC0xRoNXIt3HhNAtYV0X+z0SP9CQMg+JOi/X5GYRpzw8RJ+wVrSupi/Z0M Teb66R7wUKNA35sILNat7mIIQwskWgSpcileRtTxpYkYJCr406CQsu+tGCsrg8EKLFQ8 zB+Y3WqPDZYKn7luFonJ197dMFo23A4kpnl6qEYBpa3THro/TyIPd8x6LeGYdVVD4GNY WPchVZsHJJlfWraagO4SPSzrGX5ujLBAOjO52sfKSfQTAyYTUP1GAg/3/bhjGHn/SPeW dOvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PdOaXisM; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r7si13201373iti.176.2017.10.04.11.17.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:17:26 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PdOaXisM; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCo-0001zF-1G; Wed, 04 Oct 2017 18:15:38 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCn-0001yn-6w for xen-devel@lists.xen.org; Wed, 04 Oct 2017 18:15:37 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 16/64-30688-84525D95; Wed, 04 Oct 2017 18:15:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRWlGSWpSXmKPExsVyMfTGVl131au RBlcOWFks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlf/19mKbjAXXF1Zy9bA+MJji5GLg4hgUmM EjP3bmcFcVgE5jFLvG09y9jFyMkhIdDPKtF3Q6yLkQPIzpP4t7cAIpwmcXfVfnYIu0pi5sO9L CAlQgJqEmveREHM7GeSeP7uNxNInE1AR2LdjFqQchEBaYlrny+DTWcWiJA4/+EgG4gtLOAsMb V9KzOIzSKgKrF4bxdYDa+AtcTnA99ZIFbJS+xqu8gKYnMK2EjMmtIOViMEVNPXfpp1AqPgAka GVYwaxalFZalFuobmeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgcHGAAQ7GC+e 9jzEKMnBpCTKO0v+aqQQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd4gFaCcYFFqempFWmYOMOxh0 hIcPEoivCkgad7igsTc4sx0iNQpRkuOC3cu/WHiOLDnFpDsuHn3D5MQS15+XqqUOG8rSIMASE NGaR7cOFhsXmKUlRLmZQQ6UIinILUoN7MEVf4VozgHo5IwrynIFJ7MvBK4ra+ADmICOmhO0xW Qg0oSEVJSDYxh4btXnjrNdM5/X66xYZ7quvtThK+XNYiIsDirnv1itbh18i7ZG9Fu7foljPma M2VrBHrs7xX0FiUFaS3+2R4nfGwel0bfH03VdAcf6XzTHjOGl/3/1ry6MkF+v63hFa7tMzIyL 84rDZO+atm8Tn/X72XFTm5TSydMc3JzZNsu1VGxevWmMCWW4oxEQy3mouJEAP704SzIAgAA X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-4.tower-206.messagelabs.com!1507140935!114565025!1 X-Originating-IP: [209.85.216.181] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32056 invoked from network); 4 Oct 2017 18:15:35 -0000 Received: from mail-qt0-f181.google.com (HELO mail-qt0-f181.google.com) (209.85.216.181) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Oct 2017 18:15:35 -0000 Received: by mail-qt0-f181.google.com with SMTP id z50so15876085qtj.4 for ; Wed, 04 Oct 2017 11:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MEmYS6IxTegIzPJbXZAp4NTTSK3vZuMuwzS7cLxF3h0=; b=PdOaXisM8ukbIf2OeyFam0TPCyU14UMoQ/CkcVxqqIF2Y8h3rg6MLEAeoPpK7EkyIm Dsx/SKwi0GmEJUMnC8vl0jMuy9AOv3z7UIxe4yMfeU5wjYOffzUJBfV95ILNa+7Cj5xb T0byx94DhTF1NzLupb6GJDISrR1cUfoQMc1Ts= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MEmYS6IxTegIzPJbXZAp4NTTSK3vZuMuwzS7cLxF3h0=; b=ZhkhHYEUvOpNHuc17fmK0SStDkuhPoG1c75VCRYwhyY/kbvQp4oV9Se0AcuzxFuzbX 3v7dkKRyM5m06fIXD3GG3qknx6VALfmYyVuGE/hI5ApjyrJ5XjxRsXc6va5sgHa/NtFE KoZIKNb2pjcKsJuRmTI00bhVYt/j4YvuHc7AediSXcSMtd4w+rWM1asAu0cv74uenAw2 /eq2J/mvkGMdwpK/KHYyO+Nghe/SjCyT2R+dlNq7YYTmZR1iYBDCWE5OvtcgOSg5M5Oq yJXCStCYsXOQmEpxsXWQ5DtlfmG8wLrGHte3wqmHECArSE2+nC6brPcL7ScBOJBfzGri rr9Q== X-Gm-Message-State: AMCzsaWwvMmIDDo/sgMGzlv7NoYChCYEc+VBLvKTdsHlDMDI54sn1NEh Yg+nO796zmWiSyJ1Pr8+mlSsBUzL2To= X-Google-Smtp-Source: AOwi7QA+9j9N/aScmFq/8SBxyQ225+SYBaufTPQoXJ+zVUrI8mNiDJao/8vHEVJKPJhNzDNhybKYEQ== X-Received: by 10.200.38.35 with SMTP id u32mr11937197qtu.312.1507140934795; Wed, 04 Oct 2017 11:15:34 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id l188sm10210622qkd.43.2017.10.04.11.15.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:15:34 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 4 Oct 2017 19:15:20 +0100 Message-Id: <20171004181526.9405-2-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004181526.9405-1-julien.grall@linaro.org> References: <20171004181526.9405-1-julien.grall@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 1/7] xen/arm: domain_build: Clean-up insert_11_bank X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" - Remove spurious () - Add missing spaces - Turn 1 << to 1UL << Signed-off-by: Julien Grall --- Cc: Stefano Stabellini --- xen/arch/arm/domain_build.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 3723dc3f78..093ebf1a8e 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -109,11 +109,11 @@ static bool insert_11_bank(struct domain *d, spfn = page_to_mfn(pg); start = pfn_to_paddr(spfn); - size = pfn_to_paddr((1 << order)); + size = pfn_to_paddr(1UL << order); D11PRINT("Allocated %#"PRIpaddr"-%#"PRIpaddr" (%ldMB/%ldMB, order %d)\n", start, start + size, - 1UL << (order+PAGE_SHIFT-20), + 1UL << (order + PAGE_SHIFT - 20), /* Don't want format this as PRIpaddr (16 digit hex) */ (unsigned long)(kinfo->unassigned_mem >> 20), order); @@ -167,7 +167,8 @@ static bool insert_11_bank(struct domain *d, */ if ( start + size < bank->start && kinfo->mem.nr_banks < NR_MEM_BANKS ) { - memmove(bank + 1, bank, sizeof(*bank)*(kinfo->mem.nr_banks - i)); + memmove(bank + 1, bank, + sizeof(*bank) * (kinfo->mem.nr_banks - i)); kinfo->mem.nr_banks++; bank->start = start; bank->size = size; From patchwork Wed Oct 4 18:15:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114783 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3428388qgn; Wed, 4 Oct 2017 11:17:25 -0700 (PDT) X-Received: by 10.107.182.137 with SMTP id g131mr34774671iof.84.1507141045458; Wed, 04 Oct 2017 11:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507141045; cv=none; d=google.com; s=arc-20160816; b=HjCtE4FZD4lerlegqpSdrgMoL25W6Js/lcYHsRtVzGZDAHbeBUVUnLsfwMbotKr0HW W4pF57svI+mbx6WM47ZzVUamVYhoJsrIkiKY0j7iMLYPEUWm9LeQfE2kSBooUEGPdRCm O98cMLfvBVeteZcryR5ccjbFE74XjFBfOnF4SW0aXTW11DqqxC6bAxBi+FaPysdxOwgZ xHHzSNdRXIaE3OCfYZSwwhDGm8aZ+So98Or0JFNUDGrFMSGgOIe83Gl4dC4SLzIsRbBM HJK2RKVtz9dNKu58eSdmxLIVe6BpSuYmv0PjrZ81LmmLqK2D2D68VY/BhcYh6sQ1stvQ cvFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=XHPlRvEYkjWZvuur66BnMpTjUaEKPHe54K3/PYmW4mQ=; b=yMB8ans6sMu0mfyvKXZTKt/H2UjbZC6IdhoaaRqa8KiByC99fMx1mbbUgMqar44m8L JBpTz4U5VIWgIdife2Qd1qMAJpkynozQlh83rTnhlHzxCei8mgdAwbQSYZcIrUgUOkqY siJMlgtmPKbK4zQU78TcsxRHjL2KHwIAWKgOXWIMBzGT0laZfASiSe6W0SeazN7ALEcj 0U0Hzln5eFmXXT8Im/JNVvExnI0CHndQO9kOiBQa2HU6bAcoBv6NwIiZgoIUIyhvEu++ juLJ9xyLgxrgHJ0g5T7KMdDVubctfi3H0ja2NPkCMovD3xkWqRdJ3Qnmigdd5KphBAjf Xeug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XyazK7rq; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 200si13592390iou.349.2017.10.04.11.17.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:17:25 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XyazK7rq; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCp-0001zn-8Z; Wed, 04 Oct 2017 18:15:39 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCo-0001z7-Dv for xen-devel@lists.xen.org; Wed, 04 Oct 2017 18:15:38 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id C3/ED-09852-94525D95; Wed, 04 Oct 2017 18:15:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRWlGSWpSXmKPExsVyMfTGRl1P1au RBrdvMVos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnnG2YyF+zkqmj7M4OxgfEYexcjF4eQwCRG icWTprGAOCwC85glbm1ez9jFyMkhIdDPKnFopT+EnSfRdq6XFcJOk3hz6QxQAweQXSXx7Z8gi CkkoCax5k0UxMx+Jok365eygsTZBHQk1s2oBekUEZCWuPb5Mth0ZoEIifMfDrKBlAgL+EmsXc YOEmYRUJW4924CmM0rYC3RfmYm1DHyErvaLoIdwClgIzFrSjtYXAiopq/9NOsERsEFjAyrGDW KU4vKUot0Dc30kooy0zNKchMzc3QNDUz1clOLixPTU3MSk4r1kvNzNzECQ40BCHYwTn0fd4hR koNJSZR3lvzVSCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvEEqQDnBotT01Iq0zBxg0MOkJTh4l ER4U0DSvMUFibnFmekQqVOM9hwX7lz6w8RxbNNlIHlgzy0g2XHz7h8mIZa8/LxUKXHeVpA2AZ C2jNI8uKGwKL3EKCslzMsIdKYQT0FqUW5mCar8K0ZxDkYlYV5TkCk8mXklcLtfAZ3FBHTWnKY rIGeVJCKkpBoYjTYWG0hdY76lJjwpYiY/r6ejaebfPQ/Em99PT/ulzXvldPCupZL91XxfTQ0a b4dt116xNyH4qvyEsrBIpjvF1U1SM0rbmCOtRF1Yki6qPbzdGv/dVHl343yVM3f2LRc6OVXEq Pll1J3m62Il4RHHtT7c8dYVZdTlf9/PeH/3rMguZhndBEklluKMREMt5qLiRABctmFzzQIAAA == X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-13.tower-206.messagelabs.com!1507140936!99092057!1 X-Originating-IP: [209.85.216.177] 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 47167 invoked from network); 4 Oct 2017 18:15:36 -0000 Received: from mail-qt0-f177.google.com (HELO mail-qt0-f177.google.com) (209.85.216.177) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Oct 2017 18:15:36 -0000 Received: by mail-qt0-f177.google.com with SMTP id f15so20916039qtf.7 for ; Wed, 04 Oct 2017 11:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+k2UxqB0X1AeCLQscuVEzKPYeWpws8w3xDjv/fTOxJ0=; b=XyazK7rqzEmYbc6frl7rJTC71BSoDaB4zU+EHoxNKcPHPhXSdx2m8B3cIBUjZQq76i jhrOyRFvByimD+0WmgRjgSfDnxhcH9nL4MsFhCsuYrhPbA8rkJy94u/2PFsFBh2NExSz mK/le9jL5mH8cgh644v502jcCRf3/26LxeQpI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+k2UxqB0X1AeCLQscuVEzKPYeWpws8w3xDjv/fTOxJ0=; b=RmUEAvHbiwVE06TOj775+SHRjw1BKevdJRODkGZehplejxOvow3Nucmf0VsuFKXK4g Y4xkDN2oCZZ8HbpCRkjYZrELI8EonnqVcGmbxXUiYswqao2E3MOHDqX3ZaMM4OZu0NI4 i11c3dv/oupU+UuFgTo7V1PbOhWHVJUl8Do/tDnmZSWrPXtbSBxR6sO2MCS/HvaBceNf cjo9q3t+FSx9T4eFmeiZ5rkWzq70jfK5eIdHcN29T6/gXVSDtc0mH/warihtp9mbcthI u5L9YCkPyFfs2LXD2Cjfz/zBx2kD+PxzyrAXjiT6bj9/xJE/SEgtpcOW5ZAU/4ytdjvH xdKw== X-Gm-Message-State: AMCzsaXP/JxhaUHf9PlR3iGpA+tUfPcPIITtakUiPUr24qydTkMLTuMd W57qvIEvFD7M/720OIu6JiMAFhhvsIk= X-Google-Smtp-Source: AOwi7QAtHGnvPzO4Pz3IgPnh+3tNe9dU79JZIBFzALHsS2Or1zlnrtvQeZN2Qxl33INmZFf8/4e/uw== X-Received: by 10.200.33.235 with SMTP id 40mr29700782qtz.185.1507140935857; Wed, 04 Oct 2017 11:15:35 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id l188sm10210622qkd.43.2017.10.04.11.15.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:15:35 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 4 Oct 2017 19:15:21 +0100 Message-Id: <20171004181526.9405-3-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004181526.9405-1-julien.grall@linaro.org> References: <20171004181526.9405-1-julien.grall@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 2/7] xen/arm32: mm: Rework is_xen_heap_page to avoid nameclash 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 arm32 version of the function is_xen_heap_page currently define a variable _mfn. This will lead to a compiler when use typesafe MFN in a folow-up patch: called object '_mfn' is not a function or function pointer Fix it by renaming the local variable _mfn to mfn_. Signed-off-by: Julien Grall --- Cc: Stefano Stabellini --- xen/include/asm-arm/mm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index cd6dfb54b9..737a429409 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -140,9 +140,9 @@ extern vaddr_t xenheap_virt_start; #ifdef CONFIG_ARM_32 #define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page)) #define is_xen_heap_mfn(mfn) ({ \ - unsigned long _mfn = (mfn); \ - (_mfn >= mfn_x(xenheap_mfn_start) && \ - _mfn < mfn_x(xenheap_mfn_end)); \ + unsigned long mfn_ = (mfn); \ + (mfn_ >= mfn_x(xenheap_mfn_start) && \ + mfn_ < mfn_x(xenheap_mfn_end)); \ }) #else #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap) From patchwork Wed Oct 4 18:15:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114788 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3428500qgn; Wed, 4 Oct 2017 11:17:34 -0700 (PDT) X-Received: by 10.36.86.205 with SMTP id o196mr29175285itb.149.1507141053981; Wed, 04 Oct 2017 11:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507141053; cv=none; d=google.com; s=arc-20160816; b=T4w9dA0inWinNZ44JLyOooUClHXOZAZUjPHX2H5jbhIFQeOuFr3HO1RsQsbGDiXHBR ZCXTupE04nr4Kiz/HIWpET+DOrhzLUwCruNetjU/o1pCzuxcvfnxBrOjiWcL0MKXzLY4 o8dCFbCIEVvbEgm1/zaGKmOUVao73HgNqg+M7Jw8hCvb9shqxAVfLK+TWJBOJRMq6Ddb BISczIiIhicF/byNTklYvNrv/S4apcr01UFEiG63hDn2XtleddylUGsMnOMo+p9Jm8hI ZXP8M878QTXUMTO9FTCX5Cbx2Y9nfZTrC7MXWaChFpCzKAsVdj/srIEHQngN6El3qsuU nnyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=Kbyl9IknoXJ7HE3xn635r/4Ap9ZYnopryjeX3xroLN4=; b=XQituP9kyLbIokXm/sqrOycKDJ2VmFBDDl9x3cnSTBxF/hby/rmda5RprUhhgUUVsp /Kp32Y18EJwCk79dIslOk/GVlZq/8hZnsijzSm08C5QyqRCAMqajUqF9C0lpzQwmdANx HydWcL4sx9xyiT5oG9G0d2Hw6XFwNXl0z7vvinsdo0ko5Keu7R9qmWK25CKDr3Ntr7+U DAkQ8EKMSORNXH/Hu7bfqxivW6P1THilrs942KlH93hTe2XGxMpJiQLfly8EnE1nNtdx 0C9dTqyDCNSCnAw1MABMQ8KH+fPxIY9a/WYNjxlWEcOa+AdPdYGg4lzYlASO3LVUgYu5 ZdOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HbNr78Q8; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n68si427847ioe.50.2017.10.04.11.17.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:17: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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HbNr78Q8; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCt-00022D-NI; Wed, 04 Oct 2017 18:15:43 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCr-000219-U2 for xen-devel@lists.xen.org; Wed, 04 Oct 2017 18:15:42 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id DC/72-03093-D4525D95; Wed, 04 Oct 2017 18:15:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVyMfTGBl0v1au RBu+PqVss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmr96xkLLgoU3Hw+wPWBsZW8S5GLg4hgUmM Els3/WYDcVgE5jFL7PuzhRHEkRDoZ5VYcnkykMMJ5ORJtNy8xgJhp0msnfkVyi6T6Hn9EKiGA 2iUmsSaN1EQU/uZJO7dXwgWZxPQkVg3oxakXERAWuLa58tgI5kFPjBKPH0jDlIiLJAkcfizDk iYRUBV4uvHHewgNq+AtcSjBUuZITbJS+xqu8gKYnMK2EjMmtIONkYIqKav/TTrBEbBBYwMqxg 1ilOLylKLdI0N9JKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAsONAQh2MP5dG3iI UZKDSUmUd5b81UghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErxBKkA5waLU9NSKtMwcYODDpCU4e JREeB+ApHmLCxJzizPTIVKnGC05Lty59IeJ48CeW0Cy4+bdP0xCLHn5ealS4rytIA0CIA0ZpX lw42DReYlRVkqYlxHoQCGegtSi3MwSVPlXjOIcjErCvKYgU3gy80rgtr4COogJ6KA5TVdADip JREhJNTAm1TzePlk41/TnhOK/U9/8Om5wsnOapvryy22d8QWX63P5nMIvqP1qWuH5wHCr4BWV Vx0Rwo+ED3Zo2u+xn9HG8Xtxn/ZiD76MW2v2Z9pG7qtf4/lNUPyhuJtGvy7D2kebQ/r/lGgkr 7KyYpX/aqARt37f87erRJRUnx/9tE/TnSujoHLPfW8lluKMREMt5qLiRAAnxAtfyQIAAA== X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1507140937!69687595!1 X-Originating-IP: [209.85.216.176] 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 46441 invoked from network); 4 Oct 2017 18:15:38 -0000 Received: from mail-qt0-f176.google.com (HELO mail-qt0-f176.google.com) (209.85.216.176) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Oct 2017 18:15:38 -0000 Received: by mail-qt0-f176.google.com with SMTP id v28so12067152qtv.1 for ; Wed, 04 Oct 2017 11:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aRdFrwiTD4UX5v5ltXe1CpiEqn4ogsYcz2iO7snB93w=; b=HbNr78Q8f3tRS7LL9EUlZW6z2Lg46Y+thBY2NgIuq/J/PH0BqTJhHMaaUhaO/e6kpD olxr6QZAU5XcgZFQJFIwkbYEX64fXJ4wT8x9e0Tfap66RZxu2lJNlbBJt7EROgBbKXeX 2PCOI/MRn+wOWgL4tSCTbWicB/J25+8/dzDiA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aRdFrwiTD4UX5v5ltXe1CpiEqn4ogsYcz2iO7snB93w=; b=WBCjaQ+aqcnTyjJrS4bQDe/Rue9Nn9dCXZPNgbDz59hd0IoGAjxJWwXFUrOZVbZTOK iHw9x3Rg9b1+zspPA1eK89XEJ5isJ0CZYoK79KosIyfxLqOr0fjLn8d+9DJjH/+MJqdi 7jnZaE7WLvvW7Cq3DB9QEVYsylQ70hNkpvUULJJfHQ784OWFXUVg5gl0zQy+s/uy4w04 6g7dQop4aO6RFmcxnvP83Ux/4mfTM3lTQl19i9S6FNcaCaKuF0St/popeASA4woAlPvo nsB2YiZxiwm7MatYwexKoP5ljC59UENIYIfuF8k+5H3yDTwSv/PYmw043pkiorYQv8yo BuXA== X-Gm-Message-State: AMCzsaXMC3Wgm4P9KDA0ur6V+pxxL9DKUrXzu3NazhpLA79eX7DZRz1l QvIZnFoiVPvIQM1fGl67rSSsavDD6Zc= X-Google-Smtp-Source: AOwi7QBvkLB7KVOdCthGGBLLPtr/j5TO1b1cXCqxo/fdaY8RyUXuUYZoBAUhUUPSZ2/nafYvCRs7Dg== X-Received: by 10.200.37.8 with SMTP id 8mr30026905qtm.77.1507140937464; Wed, 04 Oct 2017 11:15:37 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id l188sm10210622qkd.43.2017.10.04.11.15.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:15:37 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 4 Oct 2017 19:15:22 +0100 Message-Id: <20171004181526.9405-4-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004181526.9405-1-julien.grall@linaro.org> References: <20171004181526.9405-1-julien.grall@linaro.org> Cc: Elena Ufimtseva , George Dunlap , Andrew Cooper , Julien Grall , Tim Deegan , Jan Beulich Subject: [Xen-devel] [PATCH 3/7] xen/x86: Use maddr_to_page and maddr_to_mfn to avoid open-coded >> PAGE_SHIFT 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 constructions _mfn(... > PAGE_SHIFT) and mfn_to_page(... >> PAGE_SHIFT) could respectively be replaced by maddr_to_mfn(...) and maddr_to_page(...). Signed-off-by: Julien Grall Reviewed-by: Andrew Cooper --- Cc: Elena Ufimtseva Cc: Jan Beulich Cc: Andrew Cooper Cc: Tim Deegan Cc: George Dunlap --- xen/arch/x86/debug.c | 2 +- xen/arch/x86/mm/shadow/common.c | 2 +- xen/arch/x86/mm/shadow/multi.c | 6 +++--- xen/common/kimage.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c index 1c10b84a16..9159f32db4 100644 --- a/xen/arch/x86/debug.c +++ b/xen/arch/x86/debug.c @@ -98,7 +98,7 @@ dbg_pv_va2mfn(dbgva_t vaddr, struct domain *dp, uint64_t pgd3val) l2_pgentry_t l2e, *l2t; l1_pgentry_t l1e, *l1t; unsigned long cr3 = (pgd3val ? pgd3val : dp->vcpu[0]->arch.cr3); - mfn_t mfn = _mfn(cr3 >> PAGE_SHIFT); + mfn_t mfn = maddr_to_mfn(cr3); DBGP2("vaddr:%lx domid:%d cr3:%lx pgd3:%lx\n", vaddr, dp->domain_id, cr3, pgd3val); diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 86186cccdf..f65d2a6523 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2640,7 +2640,7 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn) ASSERT(sh_type_has_up_pointer(d, sp->u.sh.type)); if (sp->up == 0) return 0; - pmfn = _mfn(sp->up >> PAGE_SHIFT); + pmfn = maddr_to_mfn(sp->up); ASSERT(mfn_valid(pmfn)); vaddr = map_domain_page(pmfn); ASSERT(vaddr); diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index 28030acbf6..1e42e1d8ab 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -2425,7 +2425,7 @@ int sh_safe_not_to_sync(struct vcpu *v, mfn_t gl1mfn) sp = mfn_to_page(smfn); if ( sp->u.sh.count != 1 || !sp->up ) return 0; - smfn = _mfn(sp->up >> PAGE_SHIFT); + smfn = maddr_to_mfn(sp->up); ASSERT(mfn_valid(smfn)); #if (SHADOW_PAGING_LEVELS == 4) @@ -2434,7 +2434,7 @@ int sh_safe_not_to_sync(struct vcpu *v, mfn_t gl1mfn) ASSERT(sh_type_has_up_pointer(d, SH_type_l2_shadow)); if ( sp->u.sh.count != 1 || !sp->up ) return 0; - smfn = _mfn(sp->up >> PAGE_SHIFT); + smfn = maddr_to_mfn(sp->up); ASSERT(mfn_valid(smfn)); /* up to l4 */ @@ -2442,7 +2442,7 @@ int sh_safe_not_to_sync(struct vcpu *v, mfn_t gl1mfn) if ( sp->u.sh.count != 1 || !sh_type_has_up_pointer(d, SH_type_l3_64_shadow) || !sp->up ) return 0; - smfn = _mfn(sp->up >> PAGE_SHIFT); + smfn = maddr_to_mfn(sp->up); ASSERT(mfn_valid(smfn)); #endif diff --git a/xen/common/kimage.c b/xen/common/kimage.c index cf624d10fd..ebc71affd1 100644 --- a/xen/common/kimage.c +++ b/xen/common/kimage.c @@ -504,7 +504,7 @@ static void kimage_free_entry(kimage_entry_t entry) { struct page_info *page; - page = mfn_to_page(entry >> PAGE_SHIFT); + page = maddr_to_page(entry); free_domheap_page(page); } @@ -636,8 +636,8 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image, if ( old ) { /* If so move it. */ - mfn_t old_mfn = _mfn(*old >> PAGE_SHIFT); - mfn_t mfn = _mfn(addr >> PAGE_SHIFT); + mfn_t old_mfn = maddr_to_mfn(*old); + mfn_t mfn = maddr_to_mfn(addr); copy_domain_page(mfn, old_mfn); clear_domain_page(old_mfn); From patchwork Wed Oct 4 18:15:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114787 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3428476qgn; Wed, 4 Oct 2017 11:17:32 -0700 (PDT) X-Received: by 10.107.7.166 with SMTP id g38mr3393447ioi.173.1507141052769; Wed, 04 Oct 2017 11:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507141052; cv=none; d=google.com; s=arc-20160816; b=jaRcFEGdyUHKHGrdYjBrF6G0LUxL3eDVvVqZ4G/eJSUUOs2o9PTpoyAupKoWbysoHE z7VC+Lxr3/ValGBRnVis8Vfa1e5ZDki2UJlUqunoXpBJS62C2vKDivW1qI+BF7bY2J/h EhFISi3o34smyCxWLwVs9ekkZxQp5MzIQgPeYngQtVftxQNONPdMpgBDAL+sbPs2tUx9 9P8pHIeNzvp5GMk+vsvvNpp5b2iLyUfNJ9wlikGxbD9tbzytpI8n6XuyHAqtb5V6hz1Z bDXyB9ngLquey20VxGGOyFc22sPAWRAdA6WSboXUGjzDzDF63wRMLVq46yFQLtvie+HA C/YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=jhHyP/zBHDhfnL3x1KeKbl/xdVe5GK19z1vR/w6bg7s=; b=hCKGXZYq/brs4LREprr54MEPmJ4A51SMyLActGP89d8rIEZrBt7PhWSSlNk+qDszpx Lo7/VPc/AbYfBCdLceRG9D9549EKArQOM0tvIGuS5P/+0E50ZAE1HI8J6HZd93JG7PNB hCjzuaq+GjiC1OhUv96S2qkQ0Dh/J74f0qIpaT98w5QSXE5q6fzxcf5WpNXDaisSEHes Og/0Nws66VlGNT/IrmIm4k3s+ca1mu7JOSJw5qIygw985j4yFaXN+ZLyqmwoxqgPPNPm y4Sr5gxvq4XxMjTOJcnRJFHe6OAe06zuB4xlhgQKO9r6Ofci/3t+00dxcAkx4ix6U8gs Ou9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PmvtRuYk; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p7si3725617ioi.25.2017.10.04.11.17.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:17: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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PmvtRuYk; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCs-00021a-Fl; Wed, 04 Oct 2017 18:15:42 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCq-00020e-W0 for xen-devel@lists.xen.org; Wed, 04 Oct 2017 18:15:41 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 1B/6E-02223-C4525D95; Wed, 04 Oct 2017 18:15:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsVyMfTOGl1v1au RBu27tCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oyDf66wFCxkr1gxdQt7A+MR1i5GLg4hgcmM Ej833mIEcVgE5jFLfN51jxnEkRDoZ5WY82ceWxcjJ5CTJ7HzwiSgFg4gO03i+BdtiHCVxOm7K xlBwkICahJr3kRBDO1nkvhyahcTSJxNQEdi3YxakHIRAWmJa58vM4LYzAJhEgcfn2AGsYUFXC Ru7z0LFmcRUJWY9O8kK4jNK2AtcfrsBxaIVfISu9ougsU5BWwkZk1pB6sXAqrpaz/NOoFRcAE jwypGjeLUorLUIl0jQ72kosz0jJLcxMwcXUMDU73c1OLixPTUnMSkYr3k/NxNjMBwq2dgYNzB eHey3yFGSQ4mJVHeWfJXI4X4kvJTKjMSizPii0pzUosPMcpwcChJ8AapAOUEi1LTUyvSMnOAg Q+TluDgURLhTQFJ8xYXJOYWZ6ZDpE4x2nNcuHPpDxPHjYfXgeSBPbeAZMfNu3+YhFjy8vNSpc R53ysDtQmAtGWU5sENhUXqJUZZKWFeRgYGBiGegtSi3MwSVPlXjOIcjErCvF9BpvBk5pXA7X4 FdBYT0Flzmq6AnFWSiJCSamBcdGVxyPGJP7kmti1ePndHQhnzJV2p1y7d326+djrXrra658iN yYILE0N3JmV7HS9fVrPAsCfVpDE8/n3cobktCVemZr9/mda6+NaennVqznLnBR8ujGvvDv61/ d+kE49KVvj0CLHxXnE4O9G7SEys/LqnwJnYhJSUCLWVXX914zV/zxKYErpWiaU4I9FQi7moOB EAoA7SSM8CAAA= X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-13.tower-206.messagelabs.com!1507140938!99092063!1 X-Originating-IP: [209.85.220.172] 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 47344 invoked from network); 4 Oct 2017 18:15:39 -0000 Received: from mail-qk0-f172.google.com (HELO mail-qk0-f172.google.com) (209.85.220.172) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Oct 2017 18:15:39 -0000 Received: by mail-qk0-f172.google.com with SMTP id w134so12405176qkb.0 for ; Wed, 04 Oct 2017 11:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WAFpBzJLsbd7GlL8m2OyDwss76024u1o4TA8VJkZ71g=; b=PmvtRuYkQw4kXw4nbYbjW5D2o1hALQ4NGvORRB7All1xt4GaUQoR0lK4xzEm9WFwUv JMB9GtIi9bM0N6CH6w1OViqt6AQzu3EsbFmSQqY4wu+ZrP1zn0AS7LcsR6eAN9VjMz7M zWbPi5eWbVLb6EbgvbNtqWF5u5MkwxCvn0WBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WAFpBzJLsbd7GlL8m2OyDwss76024u1o4TA8VJkZ71g=; b=bOKL7CR5nsF6/9gj4hZsRAns9zee8nNzhZzYP+rKgT8OedOLOo9rx+IodsFtJmKCs8 aVIj2A+RZ4dM7De7AyGHtapThaj56ruQvte47cj0eQ8vJfYLHRFOoO2DZwkm6hX3kjWo EKRPDS5LfYkJ8NvMi9ULda1eIZovJTRLCCKllAbsBGuqYMgvzxViSzmYuqASZcIj1yc6 Me6r0cXH4TGXqan6Y7US4IYw+E+KlPkUNByN8CjBsJIPZyNVGi6gqfruQs1A0GdIQUdk g0rz7B5J6jxFO2KJwZki+8XVyoXwvBHCZmukaNJs+sf+bOr/gEhNfmZ9gdFXBQVYsHPa rOGQ== X-Gm-Message-State: AMCzsaWl1CmhThkB2CVBGSbU79AvHdS3mGplWikVO4+QsPWCBhe6kQtC ghrAtVq85aFMW46Qhufqp919uTeuel8= X-Google-Smtp-Source: AOwi7QCMTbHbt19N0PvhNt3JRUBtzbiRt3EfIqGzHaOwWouO4N0YTmGwryDj0gqdOs+z7VqFPUisPQ== X-Received: by 10.55.76.150 with SMTP id z144mr9127875qka.351.1507140938554; Wed, 04 Oct 2017 11:15:38 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id l188sm10210622qkd.43.2017.10.04.11.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:15:38 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 4 Oct 2017 19:15:23 +0100 Message-Id: <20171004181526.9405-5-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004181526.9405-1-julien.grall@linaro.org> References: <20171004181526.9405-1-julien.grall@linaro.org> Cc: Andrew Cooper , Julien Grall Subject: [Xen-devel] [PATCH 4/7] xen/kimage: Remove defined but unused variables 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" In the function kimage_alloc_normal_control_page, the variables mfn and emfn are defined but not used. Remove them. Signed-off-by: Julien Grall Reviewed-by: Andrew Cooper --- Cc: Andrew Cooper --- xen/common/kimage.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/xen/common/kimage.c b/xen/common/kimage.c index ebc71affd1..07587896a4 100644 --- a/xen/common/kimage.c +++ b/xen/common/kimage.c @@ -310,14 +310,11 @@ static struct page_info *kimage_alloc_normal_control_page( * destination page. */ do { - unsigned long mfn, emfn; paddr_t addr, eaddr; page = kimage_alloc_zeroed_page(memflags); if ( !page ) break; - mfn = page_to_mfn(page); - emfn = mfn + 1; addr = page_to_maddr(page); eaddr = addr + PAGE_SIZE; if ( kimage_is_destination_range(image, addr, eaddr) ) From patchwork Wed Oct 4 18:15:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114785 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3428439qgn; Wed, 4 Oct 2017 11:17:29 -0700 (PDT) X-Received: by 10.36.173.78 with SMTP id a14mr27844879itj.4.1507141049801; Wed, 04 Oct 2017 11:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507141049; cv=none; d=google.com; s=arc-20160816; b=LNAPKixLubb+fEtG67Q+zxpSeA9Dw/QhDLTjO+z2TiKa8ly+d6R21XA+sYjq37J5iW TEJkKpoNqeMPzl3YOT7SMVgRacjINDwMzkTO32bJrNi1i4CJH9hBdEMzVfTFHwc3dgSi uRAuwYH+1EatLvv4kF0H6FUnrytvpyJBdwGiKUJ3D2p7cZxKQOS7eUN51iSFSaCJgSJA McoOPFtYQ6V6nL3Dc0DJGC9AssD71DX9o6nAZoA+bbhWEovjY9rayn7zCfDoRifuJGXg Zd2R3L9iadTS4ph2KD48aJBttI8mbs1UUhovw+mgPtMVHR/6o6DNZr+Wk7qyLQzpA0Co iggg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=IGSxNRCX4JEyBpcRvZx44oiag8AvK8UiGhfD6tVLJgA=; b=zp1AeEhmCXo2oHhM0Gi4VMwkyAQWQHW3A7Q1BoVBsASa2PhZG8zgAjdM3zY8N4dduI rIJjWdZJuNPTgxjG9IqQzVTlRk6+W6B2q5e4JD7zm+XI3qQhAvLtt6gdlhuSVolikWSV NscagIAh77zuu2sdft4DjLcdjg4GuwxakMmlFCthmwRSmROK/VgCphF6Dqquu6t42fGF 2wntqeKVw/1RAB3VX8xrXjIqgW1lAetRsC3kbHemlVzni3o30KvfLhEqh0InlmNjX277 Ixz+5Dx0Fm45aPWgvz8uAuAnd499GoB75sIuM3x/mzyfP+lS/1iW5QULp0XVnUNtVI00 c/UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fk+npxgw; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 79si6285412itf.46.2017.10.04.11.17.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:17: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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fk+npxgw; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCw-00024b-6S; Wed, 04 Oct 2017 18:15:46 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCv-00023L-A0 for xen-devel@lists.xen.org; Wed, 04 Oct 2017 18:15:45 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 56/77-03642-05525D95; Wed, 04 Oct 2017 18:15:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVyMfTOGl0/1au RBnduM1os+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmH9x1kLNgmVnF02zrWBsbLgl2MnBxCApMY JdqfsXcxcnGwCMxjllj4bSIriCMh0M8qsbZxNXMXIweQkydxd6M/SIOEQJrEhKUfWCHsaolnK x+wgZQICahJrHkTBdIqJNDPJNG4YAErSJxNQEdi3YxakHIRAWmJa58vM4LUMAu8YpJofb6AHS QhLOAuce3BdUYQm0VAVeJK1w+wOK+AtcT2jXuYIXbJS+xquwi2l1PARmLWlHZGiAesJfraT7N OYBRcwMiwilGjOLWoLLVI19BQL6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMjMNwY gGAH46dlAYcYJTmYlER5Z8lfjRTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwXtFBSgnWJSanlqRl pkDDHyYtAQHj5II7wOQNG9xQWJucWY6ROoUoyXHhTuX/jBxHNhzC0h23Lz7h0mIJS8/L1VKnL cVpEEApCGjNA9uHCw6LzHKSgnzMgIdKMRTkFqUm1mCKv+KUZyDUUmY1xRkCk9mXgnc1ldABzE BHTSn6QrIQSWJCCmpBka3qJcK7bxpGWu0ppjNM52T/G5WEmdRzMz8qq3BQScin/GfWbD488Yb drtDxTrtXid0VRoJrzzkVS6trWYtKbtZeUnZ43m19nvnbLuvrPTm6S3bWsca0SJZx41rLjilS V6qsGVecpbh66ndx+dG7ukv4tn0wtM8yttlaWif52/Wn57OgW+WZSmxFGckGmoxFxUnAgBspN NLyQIAAA== X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-21.messagelabs.com!1507140941!64405399!1 X-Originating-IP: [209.85.220.172] 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 62712 invoked from network); 4 Oct 2017 18:15:41 -0000 Received: from mail-qk0-f172.google.com (HELO mail-qk0-f172.google.com) (209.85.220.172) by server-16.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Oct 2017 18:15:41 -0000 Received: by mail-qk0-f172.google.com with SMTP id u67so12398661qkg.6 for ; Wed, 04 Oct 2017 11:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GWzPyfooDUJpVZ3QwpsioFkJz/D+fNR5Z/Li220Dzt0=; b=fk+npxgwzLUtjXx4xNSoMUUhazR7c6uNh6CXbo0a4uULOGQI6w9Gz+BcuN12J7KUtB 8bW3gBLwRM+faix7kelUGvHG6Gspxi5nSCzllCz7aPCoRWVdv2JLNtBuagszfoyKfVQv VMdYwbDNl9WhKeZ3z0eOqzsrwZPcirAV7INzI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GWzPyfooDUJpVZ3QwpsioFkJz/D+fNR5Z/Li220Dzt0=; b=QdjOaK+QUMumu3pVJK8TJyyVpviF9cKZQmmoZgM0iX50mlXWw1xaB0Gk/k4t8XtMCt 5y7nFQIs2EcA2lJci+/PEwChvs5KZOxm9BFrdHNst/yDBI2DpGUxy3xLBuUD9kiyTtE6 qY5MjSIQdmQcp2+gF9SS7CZsz7OgTuBVeH0gctfWoRzAc55JQgpu/4TJLsuuW/Cjnm8a jHjaSWTyVSMd/JwnIkeujfTfC57MuBqbKt4cbHvRNHjHZnG7Rh+u8BadPlIQicNkbt1p rRLcnWYmY28KfBP62mlN7B7a9K6mlJUT5TQemmVtEaf9zkiFNYKR+gRt3195cAYcwjHt bXHA== X-Gm-Message-State: AMCzsaXQNFncWkfAQPX6OLxYJzSIKki9tFmhje/m+sVCcqgAXtz2uSj1 cCFzTi4riEIXpbBgZpIQC6kcx+qYtzY= X-Google-Smtp-Source: AOwi7QDMA6iS0KT+Qpxo14tvzBO1fh7A35kkxPirWu2HZMrZOxwWCN65lQD4S/xL2jubTpg/Mb+ANw== X-Received: by 10.55.187.133 with SMTP id l127mr24739245qkf.94.1507140940776; Wed, 04 Oct 2017 11:15:40 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id l188sm10210622qkd.43.2017.10.04.11.15.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:15:40 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 4 Oct 2017 19:15:24 +0100 Message-Id: <20171004181526.9405-6-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004181526.9405-1-julien.grall@linaro.org> References: <20171004181526.9405-1-julien.grall@linaro.org> Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Julien Grall , Ian Jackson , Tim Deegan , Jan Beulich Subject: [Xen-devel] [PATCH 5/7] xen/xenoprof: Convert the file to use typesafe 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" The file common/xenoprof.c is now converted to use typesafe. This is requiring to override the macros virt_to_mfn and mfn_to_page to make them work with mfn_t. Signed-off-by: Julien Grall --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu --- xen/common/xenoprof.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index a5fe6204a5..98937c9ac6 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -19,6 +19,12 @@ #include #include +/* 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_page +#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) + /* Limit amount of pages used for shared buffer (per domain) */ #define MAX_OPROF_SHARED_PAGES 32 @@ -134,25 +140,26 @@ static void xenoprof_reset_buf(struct domain *d) } static int -share_xenoprof_page_with_guest(struct domain *d, unsigned long mfn, int npages) +share_xenoprof_page_with_guest(struct domain *d, mfn_t mfn, int npages) { int i; /* Check if previous page owner has released the page. */ for ( i = 0; i < npages; i++ ) { - struct page_info *page = mfn_to_page(mfn + i); + struct page_info *page = mfn_to_page(mfn_add(mfn, i)); if ( (page->count_info & (PGC_allocated|PGC_count_mask)) != 0 ) { printk(XENLOG_G_INFO "dom%d mfn %#lx page->count_info %#lx\n", - d->domain_id, mfn + i, page->count_info); + d->domain_id, mfn_x(mfn_add(mfn, i)), page->count_info); return -EBUSY; } page_set_owner(page, NULL); } for ( i = 0; i < npages; i++ ) - share_xen_page_with_guest(mfn_to_page(mfn + i), d, XENSHARE_writable); + share_xen_page_with_guest(mfn_to_page(mfn_add(mfn, i)), + d, XENSHARE_writable); return 0; } @@ -161,11 +168,11 @@ static void unshare_xenoprof_page_with_guest(struct xenoprof *x) { int i, npages = x->npages; - unsigned long mfn = virt_to_mfn(x->rawbuf); + mfn_t mfn = virt_to_mfn(x->rawbuf); for ( i = 0; i < npages; i++ ) { - struct page_info *page = mfn_to_page(mfn + i); + struct page_info *page = mfn_to_page(mfn_add(mfn, i)); BUG_ON(page_get_owner(page) != current->domain); if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) put_page(page); From patchwork Wed Oct 4 18:15:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114786 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3428453qgn; Wed, 4 Oct 2017 11:17:30 -0700 (PDT) X-Received: by 10.36.122.68 with SMTP id a65mr28082569itc.97.1507141050500; Wed, 04 Oct 2017 11:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507141050; cv=none; d=google.com; s=arc-20160816; b=NECQ24Yyc6gmUDeSyQRo0cWCdl4dAKCtio6P3j5gJfFnuSxcN1ke8M9Y8ai7bUqP/x 5jz8UQgvfzKvZdwsMj/boY3PRJXcS6JEpg3PdNFYRtLeKPU3Gs5qCQxPte92C0YzzHP3 3yOgpyJWKaacy5hslkAmwH47YlUWaDTJVchnr8DgoJM/T1E19gUbI7Hk+8b4B1mjbGbj 0Fbk7Ojn8bgTHXC3qPtloxyXQd17muu7tT7Oip/Leuld+waESqBxSZ0rG9qhbbGUfGbm SLi8qqnF4NQML+ImOZ7BG7DAd9YFdwjUvheqB/6VfqqTMHIxVsQIdHYFvfBTykP4e1NN jpCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=knnjqN+UKnJGgbQcQ6HU0W3CRBEdQuBE3AfHL8KxKA4=; b=yQrt50Xh6CTNYF8M88gxv7T0CP18F7UDJps1Pt39sw5v+zwYu9xhGPHryIMjgk8/my Ja2KLCmmI0XOUL5kR5dTeIDnq7del0RqMKqjqo6S/82ffrcnkHRVmOPgT9eIB6WCAW9Y qr0Xz8na6gJKYpBtyKqiBYIvD8pQ+uA0lK4fhzSfeXB70BB0fGQvbOkfYZvC1YkTE4hN IE9PKq16CCvwxkJjR9C899Uy5JuNfT0/f3KxE6kGmpUCh342EKk45lUu+xzTdw5Rp8DG xoNLssziWV7cclB1iQGSikWXLUAG8SEd4jjfz/zPhFPSN0MCdA83gitzFioQSAUgS4IQ VsYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=g2Uj8ujE; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id l134si12926016itc.168.2017.10.04.11.17.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:17: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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=g2Uj8ujE; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCv-000245-VB; Wed, 04 Oct 2017 18:15:45 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoCu-00022u-Ow for xen-devel@lists.xen.org; Wed, 04 Oct 2017 18:15:44 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 9C/F8-02220-05525D95; Wed, 04 Oct 2017 18:15:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfTGJl1/1au RBsfmSlgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnzJy9nKfipUjF56mzWBsaLMl2MXBxCAhMY JSYtamYCcVgE5jFLvLn4gBXEkRDoZ5VYtuwiSxcjJ5CTJ/Hv2QpWCDtNYsPkXnYIu0ri0bPDQ N0cQKPUJNa8iYKY2s8kceDwXlaQOJuAjsS6GbUg5SIC0hLXPl9mBLGZBaIlrv0+xARiCwuESv x+fwDMZhFQlfi+eBlYDa+AtcSGbeeh1spL7Gq7CGZzCthIzJrSDlYjBFTT136adQKj4AJGhlW MGsWpRWWpRbpGBnpJRZnpGSW5iZk5uoYGpnq5qcXFiempOYlJxXrJ+bmbGIEBV8/AwLiDsXG2 3yFGSQ4mJVHeWfJXI4X4kvJTKjMSizPii0pzUosPMcpwcChJ8N5UBsoJFqWmp1akZeYAQx8mL cHBoyTCuxUkzVtckJhbnJkOkTrFaMlx4c6lP0wcB/bcApIdN+/+YRJiycvPS5US530P0iAA0p BRmgc3DhaflxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ85qqAE3hycwrgdv6CuggJqCD5jR dATmoJBEhJdXAyOmvc9TgedZCJSETTY+G5NXfY3l+RWhMb5H9flz+4NMj4aVaMTER0bsOy4t8 SJmtwvikwDGudKK+huzilAxfr4eHVl6cp/m8nWGe9EEJV87K10u+WK2Iy85gkP7uphhV5ng3g 70x2l+6TXqPyKfCPfIai4UEd9R15bywYLoxj09M+n539B4lluKMREMt5qLiRACblmIwygIAAA == X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-15.tower-206.messagelabs.com!1507140942!100574630!1 X-Originating-IP: [209.85.216.178] 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 20228 invoked from network); 4 Oct 2017 18:15:43 -0000 Received: from mail-qt0-f178.google.com (HELO mail-qt0-f178.google.com) (209.85.216.178) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Oct 2017 18:15:43 -0000 Received: by mail-qt0-f178.google.com with SMTP id k1so9909815qti.2 for ; Wed, 04 Oct 2017 11:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cUNVyTHnL8NP0V5d0jARUJ1tCxz1AQjzcvO2htXzJ10=; b=g2Uj8ujEM1VoUo6jMc/I5OWTuXDy+2FgJsIg1cINRa2Gv6A5JJKTA9lgKU1Cw9NVDi Zh+ZL+li7RHe+3q6ztb2mtoXTqUTPFoqSjzPcYG7tElDxFld6Wl1kE96vVEWvJAJSeKg JBrXjsCosxAN6c1oSxWYVYK937f953wLJNfD0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cUNVyTHnL8NP0V5d0jARUJ1tCxz1AQjzcvO2htXzJ10=; b=QyjrmHFB9qvuIn5j9ewmJeLFRA20RwTWVoWlsM/cvwog0PnXWcFEnEoBdhIytIDK07 33h6cJcD1E2G9I7MXbpYxv5U5dZmAOgRkSUQqy7B2AWAJMXu1D6UXz7ftKLxNBW3UDg7 HH7r1WJCPe+yY9P5ZwSomD7Z0IwQuIvrx2PB00/cFsKbfF7oyQHde5URwvEYjZI4wGRl 7iESWp+k/r3+fsSqm8d64vS3GRYRs1afhzfirpScVr+HA/yS8nox/o40SVnwwrkh6MIm RPoo+0DIHif9N6ZzOsJQev3/obijT+ekK8hSApjKK8YZP0KcrR9U+7xyYbZhvpdCV/i0 eOww== X-Gm-Message-State: AMCzsaXLQk5qmh6b71dLowJZwQOHkyCk/JaFKiBzF1B8LCzVHztLs46j dsULmm5Jh+hoDH08FHDipqLvjfSCSKk= X-Google-Smtp-Source: AOwi7QA4c/ijGZOTtfxkpKi6wzaB3V+rcZE0HfT4rKePQxujC4rCBEYd61sOVaLJHiIma4N7vgjU0A== X-Received: by 10.200.27.28 with SMTP id y28mr30936925qtj.297.1507140941965; Wed, 04 Oct 2017 11:15:41 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id l188sm10210622qkd.43.2017.10.04.11.15.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:15:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 4 Oct 2017 19:15:25 +0100 Message-Id: <20171004181526.9405-7-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004181526.9405-1-julien.grall@linaro.org> References: <20171004181526.9405-1-julien.grall@linaro.org> Cc: Julien Grall , Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH 6/7] xen/tmem: Convert the file common/tmem_xen.c to use typesafe 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" The file common/tmem_xen.c is now converted to use typesafe. This is requiring to override the macro page_to_mfn to make it work with mfn_t. Note that all variables converted to mfn_t havem there initial value, when set, switch from 0 to INVALID_MFN. This is fine because the initial values was always overriden before used. Signed-off-by: Julien Grall --- Cc: Konrad Rzeszutek Wilk --- xen/common/tmem_xen.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c index 20f74b268f..8dc031514a 100644 --- a/xen/common/tmem_xen.c +++ b/xen/common/tmem_xen.c @@ -14,6 +14,10 @@ #include #include +/* Override macros from asm/page.h to make them work with mfn_t */ +#undef page_to_mfn +#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) + bool __read_mostly opt_tmem; boolean_param("tmem", opt_tmem); @@ -31,7 +35,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, dstmem); static DEFINE_PER_CPU_READ_MOSTLY(void *, scratch_page); #if defined(CONFIG_ARM) -static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, +static inline void *cli_get_page(xen_pfn_t cmfn, mfn_t *pcli_mfn, struct page_info **pcli_pfp, bool cli_write) { ASSERT_UNREACHABLE(); @@ -39,14 +43,14 @@ static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, } static inline void cli_put_page(void *cli_va, struct page_info *cli_pfp, - unsigned long cli_mfn, bool mark_dirty) + mfn_t cli_mfn, bool mark_dirty) { ASSERT_UNREACHABLE(); } #else #include -static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, +static inline void *cli_get_page(xen_pfn_t cmfn, mfn_t *pcli_mfn, struct page_info **pcli_pfp, bool cli_write) { p2m_type_t t; @@ -68,16 +72,16 @@ static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, *pcli_mfn = page_to_mfn(page); *pcli_pfp = page; - return map_domain_page(_mfn(*pcli_mfn)); + return map_domain_page(*pcli_mfn); } static inline void cli_put_page(void *cli_va, struct page_info *cli_pfp, - unsigned long cli_mfn, bool mark_dirty) + mfn_t cli_mfn, bool mark_dirty) { if ( mark_dirty ) { put_page_and_type(cli_pfp); - paging_mark_dirty(current->domain, _mfn(cli_mfn)); + paging_mark_dirty(current->domain, cli_mfn); } else put_page(cli_pfp); @@ -88,14 +92,14 @@ static inline void cli_put_page(void *cli_va, struct page_info *cli_pfp, int tmem_copy_from_client(struct page_info *pfp, xen_pfn_t cmfn, tmem_cli_va_param_t clibuf) { - unsigned long tmem_mfn, cli_mfn = 0; + mfn_t tmem_mfn, cli_mfn = INVALID_MFN; char *tmem_va, *cli_va = NULL; struct page_info *cli_pfp = NULL; int rc = 1; ASSERT(pfp != NULL); tmem_mfn = page_to_mfn(pfp); - tmem_va = map_domain_page(_mfn(tmem_mfn)); + tmem_va = map_domain_page(tmem_mfn); if ( guest_handle_is_null(clibuf) ) { cli_va = cli_get_page(cmfn, &cli_mfn, &cli_pfp, 0); @@ -125,7 +129,7 @@ int tmem_compress_from_client(xen_pfn_t cmfn, unsigned char *wmem = this_cpu(workmem); char *scratch = this_cpu(scratch_page); struct page_info *cli_pfp = NULL; - unsigned long cli_mfn = 0; + mfn_t cli_mfn = INVALID_MFN; void *cli_va = NULL; if ( dmem == NULL || wmem == NULL ) @@ -152,7 +156,7 @@ int tmem_compress_from_client(xen_pfn_t cmfn, int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp, tmem_cli_va_param_t clibuf) { - unsigned long tmem_mfn, cli_mfn = 0; + mfn_t tmem_mfn, cli_mfn = INVALID_MFN; char *tmem_va, *cli_va = NULL; struct page_info *cli_pfp = NULL; int rc = 1; @@ -165,7 +169,7 @@ int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp, return -EFAULT; } tmem_mfn = page_to_mfn(pfp); - tmem_va = map_domain_page(_mfn(tmem_mfn)); + tmem_va = map_domain_page(tmem_mfn); if ( cli_va ) { memcpy(cli_va, tmem_va, PAGE_SIZE); @@ -181,7 +185,7 @@ int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp, int tmem_decompress_to_client(xen_pfn_t cmfn, void *tmem_va, size_t size, tmem_cli_va_param_t clibuf) { - unsigned long cli_mfn = 0; + mfn_t cli_mfn = INVALID_MFN; struct page_info *cli_pfp = NULL; void *cli_va = NULL; char *scratch = this_cpu(scratch_page); From patchwork Wed Oct 4 18:15:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114790 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3429122qgn; Wed, 4 Oct 2017 11:18:13 -0700 (PDT) X-Received: by 10.107.151.6 with SMTP id z6mr32443901iod.248.1507141093248; Wed, 04 Oct 2017 11:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507141093; cv=none; d=google.com; s=arc-20160816; b=Ov6z1dl42w3RenpbnfoYAru+cN8xNTIgOuDK5tJdHAMWlDfz0K/RvZbGtLHNAIQnD1 IPEU3b7Ob7NOvSup3QSFgcMfSNJp1DcizsU0B0otGjsy+vSBeSf/2tAnI+37zqDS89KO Bp2PJyp5mL7W+rE0C8tLwkdbRN8tDZsGxI2c3BpwtcUQlfSaRBxKq5VG9qMhxlxpsuRz 4+avFlHUptfUmQk44ro8JKE87zcF+eCvVbx3FUmkTc7dyp+YZmJaF7YqRSMropm/1JKM 02xb2c1XgKXSSTGu4Hw2lfycM8H70mgnLZm+A74xy+8XXbCH9YeTrtUh+CsMqkgAVuuU F5lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=m5s60+ic4ASeQZskX+7dumHX0DDe4eAapHJxP5F+J+Y=; b=atz4BEnrUBz6jKf0O9+/p+8btRbkwteZ2DALv6pus9sjEm7WKdJ0gEswFVCcF78ho+ N8LML0uqDj/2Zr/KPmRwu9t1J/hK0FQ01pB67PH1/SqQFPldDngYCvCRiZcGREOHeCDF Pi4x7hM/LfsKzG0+27Do0l5FF47IO87XVPoHrcS6jynxOTFr680/rX7XbFzCczWnyMaV dc5584IhItJRh4JjDScJApFtbZS36wcIzt9zf4dSN/PCmyNbhV7wB8Un9Ttmu1163lQF 4re7jv/KswihqAc4Pix7CqjzcEN58Eo1QDAXg8CsF9dcV7hTx1m0u5RFiB3nmUZxzQNv Fhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MNg7ePb1; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id s26si13418031ioe.205.2017.10.04.11.18.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:18:13 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MNg7ePb1; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzoD2-00029V-Jz; Wed, 04 Oct 2017 18:15: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 1dzoD0-00028L-MO for xen-devel@lists.xen.org; Wed, 04 Oct 2017 18:15:51 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id 3A/19-03283-65525D95; Wed, 04 Oct 2017 18:15:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJIsWRWlGSWpSXmKPExsVyMfTOat1g1au RBuu+i1gs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlrD/xgKui5z1yx8uZu1gbGI3+Zuhg5OYQE JjFKrP4X1MXIxcEiMI9ZonH2PxYQR0Kgn1Wif+NtdpAqCYEiiRv73rFA2GkSDdtXsUHYVRJv5 /8GquEAmqQmseZNFMTQfiaJC//lQcJsAjoS62bUgoRFBKQlrn2+zAgynllgC5tEy+fLYCOFBU IlJvZ2gtksAqoS05bfZwTp5RWwllizJR1ik7zErraLrCA2p4CNxKwp7YwQq6wl+tpPs05gFFz AyLCKUaM4tagstUjXyFwvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMw4BiAYAfj 4rWBhxglOZiURHlnyV+NFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBO1kFKCdYlJqeWpGWmQMMf Zi0BAePkghvCkiat7ggMbc4Mx0idYrRm+PCnUt/mDiObboMJA/suQUkO27eBZKbwOSG7w/+MA mx5OXnpUqJ87aCjBAAGZFRmge3ABbDlxhlpYR5GYFOFuIpSC3KzSxBlX/FKM7BqCTMawoyhSc zrwTujldAJzIBnTin6QrIiSWJCCmpBkY5L9kfijvaZn2U2DZvno1P0r0Nj8zOiqsyZDPOydht sDw4bVvWXxamM3dDju1d5+P7NEB/btn0748atlZodCzZYGbw/3vgUYcG7lkt7Xk7XzHWnt69R ueAqe/CraZbVe/H/LoWdTJfI3XDG9fUx301NQeuLH9lJ1SUHsl3QHW7af5+hkOTmO2UWIozEg 21mIuKEwFjU3ZY3AIAAA== X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-4.tower-21.messagelabs.com!1507140946!70178009!1 X-Originating-IP: [209.85.220.171] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22226 invoked from network); 4 Oct 2017 18:15:46 -0000 Received: from mail-qk0-f171.google.com (HELO mail-qk0-f171.google.com) (209.85.220.171) by server-4.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Oct 2017 18:15:46 -0000 Received: by mail-qk0-f171.google.com with SMTP id b15so10242459qkg.9 for ; Wed, 04 Oct 2017 11:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6MrB1pw4gu9WuP9Fl27g5J3Q3u5ea0DfPCnwAvECFF4=; b=MNg7ePb1hET3orz5Z6XE6kJj7heeQOLwpVPmmz9NFUtg5Ydwb5xRL/7LuoQnYUDIaZ FeNCsGHaX+PZklLv9+B5Rj8UxwxtKve6kr0uGl03RpsEzxY4Hqvc5+Wwt0eekZiEztHp CNuDDB7wHAqb5Z6k0AAWYuLan3WR5pujdc5qA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6MrB1pw4gu9WuP9Fl27g5J3Q3u5ea0DfPCnwAvECFF4=; b=aQcg02LjcOVJJZzx65rDB8ZoKFo9aWXotiXzSkjgAnyP25MZr9a1IgI6F1fny+hnyQ HvJ06rSyO+0CTJl8XsRm2/EPDegApNd/N5tlJFw/Mnas18tNnc5DamkJAqAdE2ST/s2j sMuyEIZDRvGeFjtI0MjSuPLhteGRKM6a0ZGp1Taf1yfQA15RY2a83roe8Df05kqOzOfw F1brh6BI+dO7MNc4QUB5loyaDwJB3JFK8OCJ0FNMnQbVHTjhhoGS9xajA9PSYOUpOLVU dXKe0fpfijQD0+7I351dpxunU3R/QY6PTvbFFBIJIzDbopE4JH42kEbevql5gXC4WxTI c8Yg== X-Gm-Message-State: AMCzsaXdc9oIURntmkLZtqO8aEPfppCFucez1bTR6DkAtcO0JC1hvmLk OPiE1FN2qOT9sO9Hb9aT+xw1Fym9iZA3Yw== X-Google-Smtp-Source: AOwi7QDSPWHVCAWY+yowdWg1yNL7wvTkNKJ3KgPvvOiS7TJx6M76w/o7YtwCrJt7a8ruveKBcsZZzQ== X-Received: by 10.55.135.70 with SMTP id j67mr15251916qkd.273.1507140945307; Wed, 04 Oct 2017 11:15:45 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id l188sm10210622qkd.43.2017.10.04.11.15.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 11:15:44 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 4 Oct 2017 19:15:26 +0100 Message-Id: <20171004181526.9405-8-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004181526.9405-1-julien.grall@linaro.org> References: <20171004181526.9405-1-julien.grall@linaro.org> Cc: Jun Nakajima , Kevin Tian , Stefano Stabellini , Wei Liu , Suravee Suthikulpanit , Razvan Cojocaru , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Julien Grall , Ian Jackson , Tim Deegan , Julien Grall , Tamas K Lengyel , Jan Beulich , Shane Wang , Boris Ostrovsky , Gang Wei , Paul Durrant Subject: [Xen-devel] [PATCH 7/7] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe 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" Most of the users of page_to_mfn and mfn_to_page are either overriding the macros to make them work with mfn_t or use mfn_x/_mfn because the rest of the function use mfn_t. So make __page_to_mfn and __mfn_to_page return mfn_t by default. Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override page_to_mfn and mfn_to_page to avoid using mfn_t. Signed-off-by: Julien Grall Acked-by: Razvan Cojocaru Acked-by: Tamas K Lengyel --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu Cc: Razvan Cojocaru Cc: Tamas K Lengyel Cc: Paul Durrant Cc: Boris Ostrovsky Cc: Suravee Suthikulpanit Cc: Jun Nakajima Cc: Kevin Tian Cc: George Dunlap Cc: Gang Wei Cc: Shane Wang --- xen/arch/arm/domain_build.c | 8 ++++---- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mem_access.c | 2 +- xen/arch/arm/mm.c | 2 +- xen/arch/arm/p2m.c | 8 +------- xen/arch/x86/cpu/vpmu.c | 6 +++--- xen/arch/x86/domain.c | 21 +++++++++++---------- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 6 +++--- xen/arch/x86/hvm/hvm.c | 16 ++++++++-------- xen/arch/x86/hvm/ioreq.c | 6 +++--- xen/arch/x86/hvm/stdvga.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/hvm/viridian.c | 8 ++++---- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 10 +++++----- xen/arch/x86/hvm/vmx/vvmx.c | 2 +- xen/arch/x86/mm.c | 6 ------ xen/arch/x86/mm/guest_walk.c | 6 +++--- xen/arch/x86/mm/hap/guest_walk.c | 2 +- xen/arch/x86/mm/hap/hap.c | 6 ------ xen/arch/x86/mm/hap/nested_ept.c | 2 +- xen/arch/x86/mm/mem_sharing.c | 9 ++------- xen/arch/x86/mm/p2m-ept.c | 4 ++++ xen/arch/x86/mm/p2m-pod.c | 6 ------ xen/arch/x86/mm/p2m.c | 6 ------ xen/arch/x86/mm/paging.c | 6 ------ xen/arch/x86/mm/shadow/private.h | 16 ++-------------- xen/arch/x86/numa.c | 2 +- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/pv/callback.c | 6 ------ xen/arch/x86/pv/descriptor-tables.c | 6 ------ xen/arch/x86/pv/dom0_build.c | 6 ++++++ xen/arch/x86/pv/domain.c | 6 ------ xen/arch/x86/pv/emul-gate-op.c | 6 ------ xen/arch/x86/pv/emul-priv-op.c | 10 ---------- xen/arch/x86/pv/grant_table.c | 6 ------ xen/arch/x86/pv/ro-page-fault.c | 6 ------ xen/arch/x86/smpboot.c | 6 ------ xen/arch/x86/tboot.c | 4 ++-- xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/mm.c | 6 ++++++ xen/common/domain.c | 4 ++-- xen/common/event_fifo.c | 2 +- xen/common/grant_table.c | 6 ++++++ xen/common/kimage.c | 16 ++++++++-------- xen/common/memory.c | 6 ++++++ xen/common/page_alloc.c | 6 ++++++ xen/common/tmem.c | 2 +- xen/common/tmem_xen.c | 4 ---- xen/common/trace.c | 6 ++++++ xen/common/vmap.c | 9 +++++---- xen/common/xenoprof.c | 2 -- xen/drivers/passthrough/amd/iommu_map.c | 6 ++++++ xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-arm/mm.h | 16 +++++++++------- xen/include/asm-arm/p2m.h | 4 ++-- xen/include/asm-x86/mm.h | 12 ++++++------ xen/include/asm-x86/p2m.h | 2 +- xen/include/asm-x86/page.h | 32 ++++++++++++++++---------------- xen/include/xen/domain_page.h | 4 ++-- xen/include/xen/tmem_xen.h | 2 +- 64 files changed, 168 insertions(+), 229 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 093ebf1a8e..0753d03aac 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -104,11 +104,11 @@ static bool insert_11_bank(struct domain *d, unsigned int order) { int res, i; - paddr_t spfn; + mfn_t smfn; paddr_t start, size; - spfn = page_to_mfn(pg); - start = pfn_to_paddr(spfn); + smfn = page_to_mfn(pg); + start = mfn_to_maddr(smfn); size = pfn_to_paddr(1UL << order); D11PRINT("Allocated %#"PRIpaddr"-%#"PRIpaddr" (%ldMB/%ldMB, order %d)\n", @@ -126,7 +126,7 @@ static bool insert_11_bank(struct domain *d, goto fail; } - res = guest_physmap_add_page(d, _gfn(spfn), _mfn(spfn), order); + res = guest_physmap_add_page(d, _gfn(mfn_x(smfn)), smfn, order); if ( res ) panic("Failed map pages to DOM0: %d", res); diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 9c183f96da..f391938640 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -295,7 +295,7 @@ static __init int kernel_decompress(struct bootmodule *mod) iounmap(input); return -ENOMEM; } - mfn = _mfn(page_to_mfn(pages)); + mfn = page_to_mfn(pages); output = __vmap(&mfn, 1 << kernel_order_out, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT); rc = perform_gunzip(output, input, size); diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c index 0f2cbb81d3..112e291cba 100644 --- a/xen/arch/arm/mem_access.c +++ b/xen/arch/arm/mem_access.c @@ -210,7 +210,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, if ( t != p2m_ram_rw ) goto err; - page = mfn_to_page(mfn_x(mfn)); + page = mfn_to_page(mfn); if ( unlikely(!get_page(page, v->domain)) ) page = NULL; diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 9a37f29ce6..fe7a5da9bb 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1286,7 +1286,7 @@ int xenmem_add_to_physmap_one( return -EINVAL; } - mfn = _mfn(page_to_mfn(page)); + mfn = page_to_mfn(page); t = p2m_map_foreign; rcu_unlock_domain(od); diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 0410b1e86b..1e7a0c6c40 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -38,12 +38,6 @@ static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT; #define P2M_ROOT_PAGES (1<domain_id, addr); printk("P2M @ %p mfn:0x%lx\n", - p2m->root, __page_to_mfn(p2m->root)); + p2m->root, mfn_x(page_to_mfn(p2m->root))); dump_pt_walk(page_to_maddr(p2m->root), addr, P2M_ROOT_LEVEL, P2M_ROOT_PAGES); diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c index fd2fcacc26..c3acddc53e 100644 --- a/xen/arch/x86/cpu/vpmu.c +++ b/xen/arch/x86/cpu/vpmu.c @@ -657,7 +657,7 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params) { struct vcpu *v; struct vpmu_struct *vpmu; - uint64_t mfn; + mfn_t mfn; void *xenpmu_data; if ( (params->vcpu >= d->max_vcpus) || (d->vcpu[params->vcpu] == NULL) ) @@ -678,8 +678,8 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params) if ( xenpmu_data ) { - mfn = domain_page_map_to_mfn(xenpmu_data); - ASSERT(mfn_valid(_mfn(mfn))); + mfn = _mfn(domain_page_map_to_mfn(xenpmu_data)); + ASSERT(mfn_valid(mfn)); unmap_domain_page_global(xenpmu_data); put_page_and_type(mfn_to_page(mfn)); } diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index bb1ffa3222..395ef6145a 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -186,7 +186,7 @@ void dump_pageframe_info(struct domain *d) } } printk(" DomPage %p: caf=%08lx, taf=%" PRtype_info "\n", - _p(page_to_mfn(page)), + _p(mfn_x(page_to_mfn(page))), page->count_info, page->u.inuse.type_info); } spin_unlock(&d->page_alloc_lock); @@ -199,7 +199,7 @@ void dump_pageframe_info(struct domain *d) page_list_for_each ( page, &d->xenpage_list ) { printk(" XenPage %p: caf=%08lx, taf=%" PRtype_info "\n", - _p(page_to_mfn(page)), + _p(mfn_x(page_to_mfn(page))), page->count_info, page->u.inuse.type_info); } spin_unlock(&d->page_alloc_lock); @@ -621,7 +621,8 @@ int arch_domain_soft_reset(struct domain *d) struct page_info *page = virt_to_page(d->shared_info), *new_page; int ret = 0; struct domain *owner; - unsigned long mfn, gfn; + mfn_t mfn; + unsigned long gfn; p2m_type_t p2mt; unsigned int i; @@ -655,7 +656,7 @@ int arch_domain_soft_reset(struct domain *d) ASSERT( owner == d ); mfn = page_to_mfn(page); - gfn = mfn_to_gmfn(d, mfn); + gfn = mfn_to_gmfn(d, mfn_x(mfn)); /* * gfn == INVALID_GFN indicates that the shared_info page was never mapped @@ -664,7 +665,7 @@ int arch_domain_soft_reset(struct domain *d) if ( gfn == gfn_x(INVALID_GFN) ) goto exit_put_page; - if ( mfn_x(get_gfn_query(d, gfn, &p2mt)) != mfn ) + if ( !mfn_eq(get_gfn_query(d, gfn, &p2mt), mfn) ) { printk(XENLOG_G_ERR "Failed to get Dom%d's shared_info GFN (%lx)\n", d->domain_id, gfn); @@ -681,7 +682,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret = guest_physmap_remove_page(d, _gfn(gfn), _mfn(mfn), PAGE_ORDER_4K); + ret = guest_physmap_remove_page(d, _gfn(gfn), mfn, PAGE_ORDER_4K); if ( ret ) { printk(XENLOG_G_ERR "Failed to remove Dom%d's shared_info frame %lx\n", @@ -690,7 +691,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret = guest_physmap_add_page(d, _gfn(gfn), _mfn(page_to_mfn(new_page)), + ret = guest_physmap_add_page(d, _gfn(gfn), page_to_mfn(new_page), PAGE_ORDER_4K); if ( ret ) { @@ -988,7 +989,7 @@ int arch_set_info_guest( { if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_l4_page_table ) - done = !fill_ro_mpt(_mfn(page_to_mfn(page))); + done = !fill_ro_mpt(page_to_mfn(page)); page_unlock(page); } @@ -1114,7 +1115,7 @@ int arch_set_info_guest( l4_pgentry_t *l4tab; l4tab = map_domain_page(_mfn(pagetable_get_pfn(v->arch.guest_table))); - *l4tab = l4e_from_pfn(page_to_mfn(cr3_page), + *l4tab = l4e_from_pfn(mfn_x(page_to_mfn(cr3_page)), _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED); unmap_domain_page(l4tab); } @@ -1941,7 +1942,7 @@ int domain_relinquish_resources(struct domain *d) if ( d->arch.pirq_eoi_map != NULL ) { unmap_domain_page_global(d->arch.pirq_eoi_map); - put_page_and_type(mfn_to_page(d->arch.pirq_eoi_map_mfn)); + put_page_and_type(mfn_to_page(_mfn(d->arch.pirq_eoi_map_mfn))); d->arch.pirq_eoi_map = NULL; d->arch.auto_unmask = 0; } diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 540ba089d7..9292ae5118 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -429,7 +429,7 @@ long arch_do_domctl( { if ( i >= max_pfns ) break; - mfn = page_to_mfn(page); + mfn = mfn_x(page_to_mfn(page)); if ( copy_to_guest_offset(domctl->u.getmemlist.buffer, i, &mfn, 1) ) { diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c index 9cf53b551c..1a83f27c0b 100644 --- a/xen/arch/x86/hvm/dm.c +++ b/xen/arch/x86/hvm/dm.c @@ -219,7 +219,7 @@ static int modified_memory(struct domain *d, page = get_page_from_gfn(d, pfn, NULL, P2M_UNSHARE); if ( page ) { - mfn_t gmfn = _mfn(page_to_mfn(page)); + mfn_t gmfn = page_to_mfn(page); paging_mark_dirty(d, gmfn); /* diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index e8f746c70b..7789f6e571 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -120,7 +120,7 @@ static int __init pvh_populate_memory_range(struct domain *d, continue; } - rc = guest_physmap_add_page(d, _gfn(start), _mfn(page_to_mfn(page)), + rc = guest_physmap_add_page(d, _gfn(start), page_to_mfn(page), order); if ( rc != 0 ) { @@ -270,7 +270,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d) } write_32bit_pse_identmap(ident_pt); unmap_domain_page(ident_pt); - put_page(mfn_to_page(mfn_x(mfn))); + put_page(mfn_to_page(mfn)); d->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] = gaddr; if ( pvh_add_mem_range(d, gaddr, gaddr + PAGE_SIZE, E820_RESERVED) ) printk("Unable to set identity page tables as reserved in the memory map\n"); @@ -288,7 +288,7 @@ static void __init pvh_steal_low_ram(struct domain *d, unsigned long start, for ( mfn = start; mfn < start + nr_pages; mfn++ ) { - struct page_info *pg = mfn_to_page(mfn); + struct page_info *pg = mfn_to_page(_mfn(mfn)); int rc; rc = unshare_xen_page_with_guest(pg, dom_io); diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 205b4cb685..e8dbc23a51 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2211,7 +2211,7 @@ int hvm_set_cr0(unsigned long value, bool_t may_defer) v->arch.guest_table = pagetable_from_page(page); HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %lx, mfn = %lx", - v->arch.hvm_vcpu.guest_cr[3], page_to_mfn(page)); + v->arch.hvm_vcpu.guest_cr[3], mfn_x(page_to_mfn(page))); } } else if ( !(value & X86_CR0_PG) && (old_value & X86_CR0_PG) ) @@ -2546,7 +2546,7 @@ static void *_hvm_map_guest_frame(unsigned long gfn, bool_t permanent, if ( unlikely(p2m_is_discard_write(p2mt)) ) *writable = 0; else if ( !permanent ) - paging_mark_dirty(d, _mfn(page_to_mfn(page))); + paging_mark_dirty(d, page_to_mfn(page)); } if ( !permanent ) @@ -2588,13 +2588,13 @@ void *hvm_map_guest_frame_ro(unsigned long gfn, bool_t permanent) void hvm_unmap_guest_frame(void *p, bool_t permanent) { - unsigned long mfn; + mfn_t mfn; struct page_info *page; if ( !p ) return; - mfn = domain_page_map_to_mfn(p); + mfn = _mfn(domain_page_map_to_mfn(p)); page = mfn_to_page(mfn); if ( !permanent ) @@ -2609,7 +2609,7 @@ void hvm_unmap_guest_frame(void *p, bool_t permanent) list_for_each_entry(track, &d->arch.hvm_domain.write_map.list, list) if ( track->page == page ) { - paging_mark_dirty(d, _mfn(mfn)); + paging_mark_dirty(d, mfn); list_del(&track->list); xfree(track); break; @@ -2626,7 +2626,7 @@ void hvm_mapped_guest_frames_mark_dirty(struct domain *d) spin_lock(&d->arch.hvm_domain.write_map.lock); list_for_each_entry(track, &d->arch.hvm_domain.write_map.list, list) - paging_mark_dirty(d, _mfn(page_to_mfn(track->page))); + paging_mark_dirty(d, page_to_mfn(track->page)); spin_unlock(&d->arch.hvm_domain.write_map.lock); } @@ -3201,7 +3201,7 @@ static enum hvm_translation_result __hvm_copy( if ( xchg(&lastpage, gfn_x(gfn)) != gfn_x(gfn) ) dprintk(XENLOG_G_DEBUG, "%pv attempted write to read-only gfn %#lx (mfn=%#lx)\n", - v, gfn_x(gfn), page_to_mfn(page)); + v, gfn_x(gfn), mfn_x(page_to_mfn(page))); } else { @@ -3209,7 +3209,7 @@ static enum hvm_translation_result __hvm_copy( memcpy(p, buf, count); else memset(p, 0, count); - paging_mark_dirty(v->domain, _mfn(page_to_mfn(page))); + paging_mark_dirty(v->domain, page_to_mfn(page)); } } else diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index f2e0b3f74a..5bd5cd788e 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -268,7 +268,7 @@ static void hvm_remove_ioreq_gfn( struct domain *d, struct hvm_ioreq_page *iorp) { if ( guest_physmap_remove_page(d, _gfn(iorp->gfn), - _mfn(page_to_mfn(iorp->page)), 0) ) + page_to_mfn(iorp->page), 0) ) domain_crash(d); clear_page(iorp->va); } @@ -281,9 +281,9 @@ static int hvm_add_ioreq_gfn( clear_page(iorp->va); rc = guest_physmap_add_page(d, _gfn(iorp->gfn), - _mfn(page_to_mfn(iorp->page)), 0); + page_to_mfn(iorp->page), 0); if ( rc == 0 ) - paging_mark_dirty(d, _mfn(page_to_mfn(iorp->page))); + paging_mark_dirty(d, page_to_mfn(iorp->page)); return rc; } diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c index 088fbdf8ce..925bab2438 100644 --- a/xen/arch/x86/hvm/stdvga.c +++ b/xen/arch/x86/hvm/stdvga.c @@ -590,7 +590,7 @@ void stdvga_init(struct domain *d) if ( pg == NULL ) break; s->vram_page[i] = pg; - clear_domain_page(_mfn(page_to_mfn(pg))); + clear_domain_page(page_to_mfn(pg)); } if ( i == ARRAY_SIZE(s->vram_page) ) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index b9cf423fd9..f50f931598 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1521,7 +1521,7 @@ static int svm_cpu_up_prepare(unsigned int cpu) if ( !pg ) goto err; - clear_domain_page(_mfn(page_to_mfn(pg))); + clear_domain_page(page_to_mfn(pg)); *this_hsa = page_to_maddr(pg); } @@ -1531,7 +1531,7 @@ static int svm_cpu_up_prepare(unsigned int cpu) if ( !pg ) goto err; - clear_domain_page(_mfn(page_to_mfn(pg))); + clear_domain_page(page_to_mfn(pg)); *this_vmcb = page_to_maddr(pg); } diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c index f0fa59d7d5..c5440863b1 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -354,7 +354,7 @@ static void enable_hypercall_page(struct domain *d) if ( page ) put_page(page); gdprintk(XENLOG_WARNING, "Bad GMFN %#"PRI_gfn" (MFN %#"PRI_mfn")\n", - gmfn, page ? page_to_mfn(page) : mfn_x(INVALID_MFN)); + gmfn, mfn_x(page ? page_to_mfn(page) : INVALID_MFN)); return; } @@ -414,7 +414,7 @@ static void initialize_vp_assist(struct vcpu *v) fail: gdprintk(XENLOG_WARNING, "Bad GMFN %#"PRI_gfn" (MFN %#"PRI_mfn")\n", gmfn, - page ? page_to_mfn(page) : mfn_x(INVALID_MFN)); + mfn_x(page ? page_to_mfn(page) : INVALID_MFN)); } static void teardown_vp_assist(struct vcpu *v) @@ -427,7 +427,7 @@ static void teardown_vp_assist(struct vcpu *v) v->arch.hvm_vcpu.viridian.vp_assist.va = NULL; - page = mfn_to_page(domain_page_map_to_mfn(va)); + page = mfn_to_page(_mfn(domain_page_map_to_mfn(va))); unmap_domain_page_global(va); put_page_and_type(page); @@ -494,7 +494,7 @@ static void update_reference_tsc(struct domain *d, bool_t initialize) if ( page ) put_page(page); gdprintk(XENLOG_WARNING, "Bad GMFN %#"PRI_gfn" (MFN %#"PRI_mfn")\n", - gmfn, page ? page_to_mfn(page) : mfn_x(INVALID_MFN)); + gmfn, mfn_x(page ? page_to_mfn(page) : INVALID_MFN)); return; } diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index f62fe7e217..471d224539 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -1441,7 +1441,7 @@ int vmx_vcpu_enable_pml(struct vcpu *v) vmx_vmcs_enter(v); - __vmwrite(PML_ADDRESS, page_to_mfn(v->arch.hvm_vmx.pml_pg) << PAGE_SHIFT); + __vmwrite(PML_ADDRESS, page_to_maddr(v->arch.hvm_vmx.pml_pg)); __vmwrite(GUEST_PML_INDEX, NR_PML_ENTRIES - 1); v->arch.hvm_vmx.secondary_exec_control |= SECONDARY_EXEC_ENABLE_PML; diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 9cfa9b6965..40b91933bf 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2951,7 +2951,7 @@ gp_fault: static int vmx_alloc_vlapic_mapping(struct domain *d) { struct page_info *pg; - unsigned long mfn; + mfn_t mfn; if ( !cpu_has_vmx_virtualize_apic_accesses ) return 0; @@ -2960,10 +2960,10 @@ static int vmx_alloc_vlapic_mapping(struct domain *d) if ( !pg ) return -ENOMEM; mfn = page_to_mfn(pg); - clear_domain_page(_mfn(mfn)); + clear_domain_page(mfn); share_xen_page_with_guest(pg, d, XENSHARE_writable); - d->arch.hvm_domain.vmx.apic_access_mfn = mfn; - set_mmio_p2m_entry(d, paddr_to_pfn(APIC_DEFAULT_PHYS_BASE), _mfn(mfn), + d->arch.hvm_domain.vmx.apic_access_mfn = mfn_x(mfn); + set_mmio_p2m_entry(d, paddr_to_pfn(APIC_DEFAULT_PHYS_BASE), mfn, PAGE_ORDER_4K, p2m_get_hostp2m(d)->default_access); return 0; @@ -2974,7 +2974,7 @@ static void vmx_free_vlapic_mapping(struct domain *d) unsigned long mfn = d->arch.hvm_domain.vmx.apic_access_mfn; if ( mfn != 0 ) - free_shared_domheap_page(mfn_to_page(mfn)); + free_shared_domheap_page(mfn_to_page(_mfn(mfn))); } static void vmx_install_vlapic_mapping(struct vcpu *v) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index cd0ee0a307..790a2285e5 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -84,7 +84,7 @@ int nvmx_vcpu_initialise(struct vcpu *v) } v->arch.hvm_vmx.vmread_bitmap = vmread_bitmap; - clear_domain_page(_mfn(page_to_mfn(vmread_bitmap))); + clear_domain_page(page_to_mfn(vmread_bitmap)); vmwrite_bitmap = alloc_domheap_page(NULL, 0); if ( !vmwrite_bitmap ) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index d9df5ca69f..39038723ce 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -129,12 +129,6 @@ #include "pv/mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - /* Mapping of the fixmap space needed early. */ l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) l1_fixmap[L1_PAGETABLE_ENTRIES]; diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c index 6055fec1ad..f67aeda3d0 100644 --- a/xen/arch/x86/mm/guest_walk.c +++ b/xen/arch/x86/mm/guest_walk.c @@ -469,20 +469,20 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m, if ( l3p ) { unmap_domain_page(l3p); - put_page(mfn_to_page(mfn_x(gw->l3mfn))); + put_page(mfn_to_page(gw->l3mfn)); } #endif #if GUEST_PAGING_LEVELS >= 3 if ( l2p ) { unmap_domain_page(l2p); - put_page(mfn_to_page(mfn_x(gw->l2mfn))); + put_page(mfn_to_page(gw->l2mfn)); } #endif if ( l1p ) { unmap_domain_page(l1p); - put_page(mfn_to_page(mfn_x(gw->l1mfn))); + put_page(mfn_to_page(gw->l1mfn)); } return walk_ok; diff --git a/xen/arch/x86/mm/hap/guest_walk.c b/xen/arch/x86/mm/hap/guest_walk.c index c550017ba4..cb3f9cebe7 100644 --- a/xen/arch/x86/mm/hap/guest_walk.c +++ b/xen/arch/x86/mm/hap/guest_walk.c @@ -83,7 +83,7 @@ unsigned long hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)( *pfec &= ~PFEC_page_present; goto out_tweak_pfec; } - top_mfn = _mfn(page_to_mfn(top_page)); + top_mfn = page_to_mfn(top_page); /* Map the top-level table and call the tree-walker */ ASSERT(mfn_valid(top_mfn)); diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index dc85e828cd..e45c1a1913 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -42,12 +42,6 @@ #include "private.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn(_pg) _mfn(__page_to_mfn(_pg)) - /************************************************/ /* HAP VRAM TRACKING SUPPORT */ /************************************************/ diff --git a/xen/arch/x86/mm/hap/nested_ept.c b/xen/arch/x86/mm/hap/nested_ept.c index 14b1bb01e9..1738df69f6 100644 --- a/xen/arch/x86/mm/hap/nested_ept.c +++ b/xen/arch/x86/mm/hap/nested_ept.c @@ -173,7 +173,7 @@ nept_walk_tables(struct vcpu *v, unsigned long l2ga, ept_walk_t *gw) goto map_err; gw->lxe[lvl] = lxp[ept_lvl_table_offset(l2ga, lvl)]; unmap_domain_page(lxp); - put_page(mfn_to_page(mfn_x(lxmfn))); + put_page(mfn_to_page(lxmfn)); if ( nept_non_present_check(gw->lxe[lvl]) ) goto non_present; diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index b856028c02..b799bdb77c 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -152,11 +152,6 @@ static inline shr_handle_t get_next_handle(void) #define mem_sharing_enabled(d) \ (is_hvm_domain(d) && (d)->arch.hvm_domain.mem_sharing_enabled) -#undef mfn_to_page -#define mfn_to_page(_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn(_pg) _mfn(__page_to_mfn(_pg)) - static atomic_t nr_saved_mfns = ATOMIC_INIT(0); static atomic_t nr_shared_mfns = ATOMIC_INIT(0); @@ -1185,8 +1180,8 @@ int __mem_sharing_unshare_page(struct domain *d, return -ENOMEM; } - s = map_domain_page(_mfn(__page_to_mfn(old_page))); - t = map_domain_page(_mfn(__page_to_mfn(page))); + s = map_domain_page(page_to_mfn(old_page)); + t = map_domain_page(page_to_mfn(page)); memcpy(t, s, PAGE_SIZE); unmap_domain_page(s); unmap_domain_page(t); diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index 054827aa88..24de202a1b 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -33,6 +33,10 @@ #include "mm-locks.h" +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + #define atomic_read_ept_entry(__pepte) \ ( (ept_entry_t) { .epte = read_atomic(&(__pepte)->epte) } ) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 0a811ccf28..7a88074c31 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -29,12 +29,6 @@ #include "mm-locks.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn(_pg) _mfn(__page_to_mfn(_pg)) - #define superpage_aligned(_x) (((_x)&(SUPERPAGE_PAGES-1))==0) /* Enforce lock ordering when grabbing the "external" page_alloc lock */ diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 3fbc537da6..2194b35bc7 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -47,12 +47,6 @@ bool_t __initdata opt_hap_1gb = 1, __initdata opt_hap_2mb = 1; boolean_param("hap_1gb", opt_hap_1gb); boolean_param("hap_2mb", opt_hap_2mb); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn(_pg) _mfn(__page_to_mfn(_pg)) - DEFINE_PERCPU_RWLOCK_GLOBAL(p2m_percpu_rwlock); /* Init the datastructures for later use by the p2m code */ diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 1e2c9ba4cc..cb97642cbc 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -47,12 +47,6 @@ /* Per-CPU variable for enforcing the lock ordering */ DEFINE_PER_CPU(int, mm_lock_level); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn(_pg) _mfn(__page_to_mfn(_pg)) - /************************************************/ /* LOG DIRTY SUPPORT */ /************************************************/ diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h index 6a03370402..b9cc680f4e 100644 --- a/xen/arch/x86/mm/shadow/private.h +++ b/xen/arch/x86/mm/shadow/private.h @@ -315,7 +315,7 @@ static inline int page_is_out_of_sync(struct page_info *p) static inline int mfn_is_out_of_sync(mfn_t gmfn) { - return page_is_out_of_sync(mfn_to_page(mfn_x(gmfn))); + return page_is_out_of_sync(mfn_to_page(gmfn)); } static inline int page_oos_may_write(struct page_info *p) @@ -326,7 +326,7 @@ static inline int page_oos_may_write(struct page_info *p) static inline int mfn_oos_may_write(mfn_t gmfn) { - return page_oos_may_write(mfn_to_page(mfn_x(gmfn))); + return page_oos_may_write(mfn_to_page(gmfn)); } #endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */ @@ -465,18 +465,6 @@ void sh_reset_l3_up_pointers(struct vcpu *v); * MFN/page-info handling */ -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn(_pg) _mfn(__page_to_mfn(_pg)) - -/* Override pagetable_t <-> struct page_info conversions to work with mfn_t */ -#undef pagetable_get_page -#define pagetable_get_page(x) mfn_to_page(pagetable_get_mfn(x)) -#undef pagetable_from_page -#define pagetable_from_page(pg) pagetable_from_mfn(page_to_mfn(pg)) - #define backpointer(sp) _mfn(pdx_to_pfn((unsigned long)(sp)->v.sh.back)) static inline unsigned long __backpointer(const struct page_info *sp) { diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index 4fc967f893..a87987da6f 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -430,7 +430,7 @@ static void dump_numa(unsigned char key) spin_lock(&d->page_alloc_lock); page_list_for_each(page, &d->page_list) { - i = phys_to_nid((paddr_t)page_to_mfn(page) << PAGE_SHIFT); + i = phys_to_nid(page_to_maddr(page)); page_num_node[i]++; } spin_unlock(&d->page_alloc_lock); diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index 0eb409758f..ba950af4a8 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -241,7 +241,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) } if ( cmpxchg(&currd->arch.pirq_eoi_map_mfn, - 0, page_to_mfn(page)) != 0 ) + 0, mfn_x(page_to_mfn(page))) != 0 ) { put_page_and_type(page); ret = -EBUSY; diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c index 97d8438600..5957cb5085 100644 --- a/xen/arch/x86/pv/callback.c +++ b/xen/arch/x86/pv/callback.c @@ -31,12 +31,6 @@ #include -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - static int register_guest_nmi_callback(unsigned long address) { struct vcpu *curr = current; diff --git a/xen/arch/x86/pv/descriptor-tables.c b/xen/arch/x86/pv/descriptor-tables.c index 81973af124..371221a302 100644 --- a/xen/arch/x86/pv/descriptor-tables.c +++ b/xen/arch/x86/pv/descriptor-tables.c @@ -25,12 +25,6 @@ #include #include -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - /******************* * Descriptor Tables */ diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index dcbee43e8f..e9a893ba47 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -22,6 +22,12 @@ #include "mm.h" +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn(pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + /* Allow ring-3 access in long mode as guest cannot use ring 1 ... */ #define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER) #define L1_PROT (BASE_PROT|_PAGE_GUEST_KERNEL) diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c index 90d5569be1..4ca3205821 100644 --- a/xen/arch/x86/pv/domain.c +++ b/xen/arch/x86/pv/domain.c @@ -16,12 +16,6 @@ #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - static void noreturn continue_nonidle_domain(struct vcpu *v) { check_wakeup_from_wait(); diff --git a/xen/arch/x86/pv/emul-gate-op.c b/xen/arch/x86/pv/emul-gate-op.c index 0f89c91dff..5cdb54c937 100644 --- a/xen/arch/x86/pv/emul-gate-op.c +++ b/xen/arch/x86/pv/emul-gate-op.c @@ -41,12 +41,6 @@ #include "emulate.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - static int read_gate_descriptor(unsigned int gate_sel, const struct vcpu *v, unsigned int *sel, diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index dd90713acf..9ccbd021ef 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -43,16 +43,6 @@ #include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - -/*********************** - * I/O emulation support - */ - struct priv_op_ctxt { struct x86_emulate_ctxt ctxt; struct { diff --git a/xen/arch/x86/pv/grant_table.c b/xen/arch/x86/pv/grant_table.c index aaca228c6b..97323367c5 100644 --- a/xen/arch/x86/pv/grant_table.c +++ b/xen/arch/x86/pv/grant_table.c @@ -27,12 +27,6 @@ #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - static unsigned int grant_to_pte_flags(unsigned int grant_flags, unsigned int cache_flags) { diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c index 6b2976d3df..a7b7eb5113 100644 --- a/xen/arch/x86/pv/ro-page-fault.c +++ b/xen/arch/x86/pv/ro-page-fault.c @@ -33,12 +33,6 @@ #include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - /********************* * Writable Pagetables */ diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 3ca716c59f..663966bc74 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -46,12 +46,6 @@ #include #include -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - #define setup_trampoline() (bootsym_phys(trampoline_realmode_entry)) unsigned long __read_mostly trampoline_phys; diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c index 59d7c477f4..e9522f06ec 100644 --- a/xen/arch/x86/tboot.c +++ b/xen/arch/x86/tboot.c @@ -184,7 +184,7 @@ static void update_pagetable_mac(vmac_ctx_t *ctx) for ( mfn = 0; mfn < max_page; mfn++ ) { - struct page_info *page = mfn_to_page(mfn); + struct page_info *page = mfn_to_page(_mfn(mfn)); if ( !mfn_valid(_mfn(mfn)) ) continue; @@ -276,7 +276,7 @@ static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE], vmac_set_key((uint8_t *)key, &ctx); for ( mfn = 0; mfn < max_page; mfn++ ) { - struct page_info *page = __mfn_to_page(mfn); + struct page_info *page = mfn_to_page(_mfn(mfn)); if ( !mfn_valid(_mfn(mfn)) ) continue; diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 86506f3747..b85394d1f9 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -811,7 +811,7 @@ int wrmsr_hypervisor_regs(uint32_t idx, uint64_t val) gdprintk(XENLOG_WARNING, "Bad GMFN %lx (MFN %lx) to MSR %08x\n", - gmfn, page ? page_to_mfn(page) : -1UL, base); + gmfn, page ? mfn_x(page_to_mfn(page)) : -1UL, base); return 0; } diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 11746730b4..971ccfcbbe 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -40,6 +40,12 @@ asm(".file \"" __FILE__ "\""); #include #include +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn(pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START; l2_pgentry_t *compat_idle_pg_table_l2; diff --git a/xen/common/domain.c b/xen/common/domain.c index 5aebcf265f..e8302e8e1b 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1192,7 +1192,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) } v->vcpu_info = new_info; - v->vcpu_info_mfn = _mfn(page_to_mfn(page)); + v->vcpu_info_mfn = page_to_mfn(page); /* Set new vcpu_info pointer /before/ setting pending flags. */ smp_wmb(); @@ -1225,7 +1225,7 @@ void unmap_vcpu_info(struct vcpu *v) vcpu_info_reset(v); /* NB: Clobbers v->vcpu_info_mfn */ - put_page_and_type(mfn_to_page(mfn_x(mfn))); + put_page_and_type(mfn_to_page(mfn)); } int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c index c49f446754..f15adf0eb5 100644 --- a/xen/common/event_fifo.c +++ b/xen/common/event_fifo.c @@ -389,7 +389,7 @@ static void unmap_guest_page(void *virt) return; virt = (void *)((unsigned long)virt & PAGE_MASK); - page = mfn_to_page(domain_page_map_to_mfn(virt)); + page = mfn_to_page(_mfn(domain_page_map_to_mfn(virt))); unmap_domain_page_global(virt); put_page_and_type(page); diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 6d20b17739..2afde596d9 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -40,6 +40,12 @@ #include #include +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn(pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + /* Per-domain grant information. */ struct grant_table { /* diff --git a/xen/common/kimage.c b/xen/common/kimage.c index 07587896a4..93c7da5c20 100644 --- a/xen/common/kimage.c +++ b/xen/common/kimage.c @@ -76,7 +76,7 @@ static struct page_info *kimage_alloc_zeroed_page(unsigned memflags) if ( !page ) return NULL; - clear_domain_page(_mfn(page_to_mfn(page))); + clear_domain_page(page_to_mfn(page)); return page; } @@ -405,7 +405,7 @@ static struct page_info *kimage_alloc_crash_control_page(struct kexec_image *ima if ( page ) { image->next_crash_page = hole_end; - clear_domain_page(_mfn(page_to_mfn(page))); + clear_domain_page(page_to_mfn(page)); } return page; @@ -641,7 +641,7 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image, *old = (addr & ~PAGE_MASK) | IND_SOURCE; unmap_domain_page(old); - page = mfn_to_page(mfn_x(old_mfn)); + page = mfn_to_page(old_mfn); break; } else @@ -873,22 +873,22 @@ int kimage_build_ind(struct kexec_image *image, unsigned long ind_mfn, for ( entry = page; ; ) { unsigned long ind; - unsigned long mfn; + mfn_t mfn; ind = kimage_entry_ind(entry, compat); - mfn = kimage_entry_mfn(entry, compat); + mfn = _mfn(kimage_entry_mfn(entry, compat)); switch ( ind ) { case IND_DESTINATION: - dest = (paddr_t)mfn << PAGE_SHIFT; + dest = mfn_to_maddr(mfn); ret = kimage_set_destination(image, dest); if ( ret < 0 ) goto done; break; case IND_INDIRECTION: unmap_domain_page(page); - page = map_domain_page(_mfn(mfn)); + page = map_domain_page(mfn); entry = page; continue; case IND_DONE: @@ -913,7 +913,7 @@ int kimage_build_ind(struct kexec_image *image, unsigned long ind_mfn, goto done; } - copy_domain_page(_mfn(page_to_mfn(xen_page)), _mfn(mfn)); + copy_domain_page(page_to_mfn(xen_page), mfn); put_page(guest_page); ret = kimage_add_page(image, page_to_maddr(xen_page)); diff --git a/xen/common/memory.c b/xen/common/memory.c index ad987e0f29..e467f271c7 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -29,6 +29,12 @@ #include #include +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn(pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + struct memop_args { /* INPUT */ struct domain *domain; /* Domain to be affected. */ diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 472c6fe329..5e7d74e274 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -150,6 +150,12 @@ #define p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL) #endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn(pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + /* * Comma-separated list of hexadecimal page numbers containing bad bytes. * e.g. 'badpage=0x3f45,0x8a321'. diff --git a/xen/common/tmem.c b/xen/common/tmem.c index c955cf7167..1adb96f00c 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -243,7 +243,7 @@ static void tmem_persistent_pool_page_put(void *page_va) struct page_info *pi; ASSERT(IS_PAGE_ALIGNED(page_va)); - pi = mfn_to_page(virt_to_mfn(page_va)); + pi = mfn_to_page(_mfn(virt_to_mfn(page_va))); ASSERT(IS_VALID_PAGE(pi)); __tmem_free_page_thispool(pi); } diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c index 8dc031514a..9131fd9d79 100644 --- a/xen/common/tmem_xen.c +++ b/xen/common/tmem_xen.c @@ -14,10 +14,6 @@ #include #include -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef page_to_mfn -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg)) - bool __read_mostly opt_tmem; boolean_param("tmem", opt_tmem); diff --git a/xen/common/trace.c b/xen/common/trace.c index 2e18702317..cf8f8b0997 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -42,6 +42,12 @@ CHECK_t_buf; #define compat_t_rec t_rec #endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn(pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + /* opt_tbuf_size: trace buffer size (in pages) for each cpu */ static unsigned int opt_tbuf_size; static unsigned int opt_tevt_mask; diff --git a/xen/common/vmap.c b/xen/common/vmap.c index 0b23f8fb97..10f32b29e0 100644 --- a/xen/common/vmap.c +++ b/xen/common/vmap.c @@ -36,7 +36,7 @@ void __init vm_init_type(enum vmap_region type, void *start, void *end) { struct page_info *pg = alloc_domheap_page(NULL, 0); - map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR); + map_pages_to_xen(va, mfn_x(page_to_mfn(pg)), 1, PAGE_HYPERVISOR); clear_page((void *)va); } bitmap_fill(vm_bitmap(type), vm_low[type]); @@ -107,7 +107,8 @@ static void *vm_alloc(unsigned int nr, unsigned int align, { unsigned long va = (unsigned long)vm_bitmap(t) + vm_top[t] / 8; - if ( !map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR) ) + if ( !map_pages_to_xen(va, mfn_x(page_to_mfn(pg)), + 1, PAGE_HYPERVISOR) ) { clear_page((void *)va); vm_top[t] += PAGE_SIZE * 8; @@ -258,7 +259,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) pg = alloc_domheap_page(NULL, 0); if ( pg == NULL ) goto error; - mfn[i] = _mfn(page_to_mfn(pg)); + mfn[i] = page_to_mfn(pg); } va = __vmap(mfn, 1, pages, 1, PAGE_HYPERVISOR, type); @@ -270,7 +271,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) error: while ( i-- ) - free_domheap_page(mfn_to_page(mfn_x(mfn[i]))); + free_domheap_page(mfn_to_page(mfn[i])); xfree(mfn); return NULL; } diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index 98937c9ac6..1f547bca52 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -22,8 +22,6 @@ /* 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_page -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn)) /* Limit amount of pages used for shared buffer (per domain) */ #define MAX_OPROF_SHARED_PAGES 32 diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index fd2327d3e5..bd62c2ce90 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -25,6 +25,12 @@ #include "../ats.h" #include +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn(pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page(mfn) __mfn_to_page(_mfn(mfn)) + /* Given pfn and page table level, return pde index */ static unsigned int pfn_to_pde_idx(unsigned long pfn, unsigned int level) { diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 1aecf7cf34..2c44fabf99 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -184,7 +184,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) page_list_for_each ( page, &d->page_list ) { - unsigned long mfn = page_to_mfn(page); + unsigned long mfn = mfn_x(page_to_mfn(page)); unsigned long gfn = mfn_to_gmfn(d, mfn); unsigned int mapping = IOMMUF_readable; int ret; diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index 0253823173..68182afd91 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -58,7 +58,7 @@ int arch_iommu_populate_page_table(struct domain *d) if ( is_hvm_domain(d) || (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) { - unsigned long mfn = page_to_mfn(page); + unsigned long mfn = mfn_x(page_to_mfn(page)); unsigned long gfn = mfn_to_gmfn(d, mfn); if ( gfn != gfn_x(INVALID_GFN) ) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 737a429409..3eb4b68761 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -138,7 +138,7 @@ extern vaddr_t xenheap_virt_start; #endif #ifdef CONFIG_ARM_32 -#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_page(page) is_xen_heap_mfn(mfn_x(__page_to_mfn(page))) #define is_xen_heap_mfn(mfn) ({ \ unsigned long mfn_ = (mfn); \ (mfn_ >= mfn_x(xenheap_mfn_start) && \ @@ -220,12 +220,14 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) }) /* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page(mfn) (frame_table + (pfn_to_pdx(mfn) - frametable_base_pdx)) -#define __page_to_mfn(pg) pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx) +#define __mfn_to_page(mfn) \ + (frame_table + (pfn_to_pdx(mfn_x(mfn)) - frametable_base_pdx)) +#define __page_to_mfn(pg) \ + _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx)) /* Convert between machine addresses and page-info structures. */ -#define maddr_to_page(ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define page_to_maddr(pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT) +#define maddr_to_page(ma) __mfn_to_page(maddr_to_mfn(ma)) +#define page_to_maddr(pg) (mfn_to_maddr(__page_to_mfn(pg))) /* Convert between frame number and address formats. */ #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) @@ -235,7 +237,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) #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_mfn(va) maddr_to_mfn(virt_to_maddr((vaddr_t)va)) #define vmap_to_page(va) mfn_to_page(vmap_to_mfn(va)) /* Page-align address and convert to frame number format */ @@ -309,7 +311,7 @@ static inline struct page_info *virt_to_page(const void *v) static inline void *page_to_virt(const struct page_info *pg) { - return mfn_to_virt(page_to_mfn(pg)); + return mfn_to_virt(mfn_x(__page_to_mfn(pg))); } struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index faadcfe8fe..87c9994974 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -276,7 +276,7 @@ static inline struct page_info *get_page_from_gfn( { struct page_info *page; p2m_type_t p2mt; - unsigned long mfn = mfn_x(p2m_lookup(d, _gfn(gfn), &p2mt)); + mfn_t mfn = p2m_lookup(d, _gfn(gfn), &p2mt); if (t) *t = p2mt; @@ -284,7 +284,7 @@ static inline struct page_info *get_page_from_gfn( if ( !p2m_is_any_ram(p2mt) ) return NULL; - if ( !mfn_valid(_mfn(mfn)) ) + if ( !mfn_valid(mfn) ) return NULL; page = mfn_to_page(mfn); diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index f2e0f498c4..984f54c3fa 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -259,7 +259,7 @@ struct page_info #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap) #define is_xen_heap_mfn(mfn) \ - (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(mfn))) + (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(_mfn(mfn)))) #define is_xen_fixed_mfn(mfn) \ ((((mfn) << PAGE_SHIFT) >= __pa(&_stext)) && \ (((mfn) << PAGE_SHIFT) <= __pa(&__2M_rwdata_end))) @@ -369,7 +369,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner); static inline bool get_page_from_mfn(mfn_t mfn, struct domain *d) { - struct page_info *page = __mfn_to_page(mfn_x(mfn)); + struct page_info *page = __mfn_to_page(mfn); if ( unlikely(!mfn_valid(mfn)) || unlikely(!get_page(page, d)) ) { @@ -463,10 +463,10 @@ extern paddr_t mem_hotplug; #define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY) #define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START) -#define _set_gpfn_from_mfn(mfn, pfn) ({ \ - struct domain *d = page_get_owner(__mfn_to_page(mfn)); \ - unsigned long entry = (d && (d == dom_cow)) ? \ - SHARED_M2P_ENTRY : (pfn); \ +#define _set_gpfn_from_mfn(mfn, pfn) ({ \ + struct domain *d = page_get_owner(__mfn_to_page(_mfn(mfn))); \ + unsigned long entry = (d && (d == dom_cow)) ? \ + SHARED_M2P_ENTRY : (pfn); \ ((void)((mfn) >= (RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) / 4 || \ (compat_machine_to_phys_mapping[(mfn)] = (unsigned int)(entry))), \ machine_to_phys_mapping[(mfn)] = (entry)); \ diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 70f00c332f..18eac537c9 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -480,7 +480,7 @@ static inline struct page_info *get_page_from_gfn( /* Non-translated guests see 1-1 RAM / MMIO mappings everywhere */ if ( t ) *t = likely(d != dom_io) ? p2m_ram_rw : p2m_mmio_direct; - page = __mfn_to_page(gfn); + page = __mfn_to_page(_mfn(gfn)); return mfn_valid(_mfn(gfn)) && get_page(page, d) ? page : NULL; } diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h index 45ca742678..8737ef16ff 100644 --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -88,10 +88,10 @@ ((paddr_t)(((x).l4 & (PADDR_MASK&PAGE_MASK)))) /* Get pointer to info structure of page mapped by pte (struct page_info *). */ -#define l1e_get_page(x) (__mfn_to_page(l1e_get_pfn(x))) -#define l2e_get_page(x) (__mfn_to_page(l2e_get_pfn(x))) -#define l3e_get_page(x) (__mfn_to_page(l3e_get_pfn(x))) -#define l4e_get_page(x) (__mfn_to_page(l4e_get_pfn(x))) +#define l1e_get_page(x) (__mfn_to_page(l1e_get_mfn(x))) +#define l2e_get_page(x) (__mfn_to_page(l2e_get_mfn(x))) +#define l3e_get_page(x) (__mfn_to_page(l3e_get_mfn(x))) +#define l4e_get_page(x) (__mfn_to_page(l4e_get_mfn(x))) /* Get pte access flags (unsigned int). */ #define l1e_get_flags(x) (get_pte_flags((x).l1)) @@ -157,10 +157,10 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags) #define l4e_from_intpte(intpte) ((l4_pgentry_t) { (intpte_t)(intpte) }) /* Construct a pte from a page pointer and access flags. */ -#define l1e_from_page(page, flags) l1e_from_pfn(__page_to_mfn(page), (flags)) -#define l2e_from_page(page, flags) l2e_from_pfn(__page_to_mfn(page), (flags)) -#define l3e_from_page(page, flags) l3e_from_pfn(__page_to_mfn(page), (flags)) -#define l4e_from_page(page, flags) l4e_from_pfn(__page_to_mfn(page), (flags)) +#define l1e_from_page(page, flags) l1e_from_mfn(__page_to_mfn(page), (flags)) +#define l2e_from_page(page, flags) l2e_from_mfn(__page_to_mfn(page), (flags)) +#define l3e_from_page(page, flags) l3e_from_mfn(__page_to_mfn(page), (flags)) +#define l4e_from_page(page, flags) l4e_from_mfn(__page_to_mfn(page), (flags)) /* Add extra flags to an existing pte. */ #define l1e_add_flags(x, flags) ((x).l1 |= put_pte_flags(flags)) @@ -215,13 +215,13 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags) /* Page-table type. */ typedef struct { u64 pfn; } pagetable_t; #define pagetable_get_paddr(x) ((paddr_t)(x).pfn << PAGE_SHIFT) -#define pagetable_get_page(x) __mfn_to_page((x).pfn) +#define pagetable_get_page(x) __mfn_to_page(pagetable_get_mfn(x)) #define pagetable_get_pfn(x) ((x).pfn) #define pagetable_get_mfn(x) _mfn(((x).pfn)) #define pagetable_is_null(x) ((x).pfn == 0) #define pagetable_from_pfn(pfn) ((pagetable_t) { (pfn) }) #define pagetable_from_mfn(mfn) ((pagetable_t) { mfn_x(mfn) }) -#define pagetable_from_page(pg) pagetable_from_pfn(__page_to_mfn(pg)) +#define pagetable_from_page(pg) pagetable_from_mfn(__page_to_mfn(pg)) #define pagetable_from_paddr(p) pagetable_from_pfn((p)>>PAGE_SHIFT) #define pagetable_null() pagetable_from_pfn(0) @@ -240,12 +240,12 @@ void copy_page_sse2(void *, const void *); #define __mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT)) /* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page(mfn) (frame_table + pfn_to_pdx(mfn)) -#define __page_to_mfn(pg) pdx_to_pfn((unsigned long)((pg) - frame_table)) +#define __mfn_to_page(mfn) (frame_table + pfn_to_pdx(mfn_x(mfn))) +#define __page_to_mfn(pg) _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table))) /* Convert between machine addresses and page-info structures. */ -#define __maddr_to_page(ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define __page_to_maddr(pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT) +#define __maddr_to_page(ma) __mfn_to_page(maddr_to_mfn(ma)) +#define __page_to_maddr(pg) (mfn_to_maddr(__page_to_mfn(pg))) /* Convert between frame number and address formats. */ #define __pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) @@ -273,8 +273,8 @@ void copy_page_sse2(void *, const void *); #define pfn_to_paddr(pfn) __pfn_to_paddr(pfn) #define paddr_to_pfn(pa) __paddr_to_pfn(pa) #define paddr_to_pdx(pa) pfn_to_pdx(paddr_to_pfn(pa)) -#define vmap_to_mfn(va) l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va))) -#define vmap_to_page(va) mfn_to_page(vmap_to_mfn(va)) +#define vmap_to_mfn(va) _mfn(l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va)))) +#define vmap_to_page(va) __mfn_to_page(vmap_to_mfn(va)) #endif /* !defined(__ASSEMBLY__) */ diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h index 890bae5b9c..5d1c34528e 100644 --- a/xen/include/xen/domain_page.h +++ b/xen/include/xen/domain_page.h @@ -44,11 +44,11 @@ unsigned long domain_page_map_to_mfn(const void *va); void *map_domain_page_global(mfn_t mfn); void unmap_domain_page_global(const void *va); -#define __map_domain_page(pg) map_domain_page(_mfn(__page_to_mfn(pg))) +#define __map_domain_page(pg) map_domain_page(__page_to_mfn(pg)) static inline void *__map_domain_page_global(const struct page_info *pg) { - return map_domain_page_global(_mfn(__page_to_mfn(pg))); + return map_domain_page_global(page_to_mfn(pg)); } #else /* !CONFIG_DOMAIN_PAGE */ diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h index 542c0b3f20..8516a0b131 100644 --- a/xen/include/xen/tmem_xen.h +++ b/xen/include/xen/tmem_xen.h @@ -25,7 +25,7 @@ typedef uint32_t pagesize_t; /* like size_t, must handle largest PAGE_SIZE */ #define IS_PAGE_ALIGNED(addr) IS_ALIGNED((unsigned long)(addr), PAGE_SIZE) -#define IS_VALID_PAGE(_pi) mfn_valid(_mfn(page_to_mfn(_pi))) +#define IS_VALID_PAGE(_pi) mfn_valid(page_to_mfn(_pi)) extern struct page_list_head tmem_page_list; extern spinlock_t tmem_page_list_lock;