From nobody Mon Feb 9 01:34:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1770383614; cv=none; d=zohomail.com; s=zohoarc; b=Eo6N63f2s+0uwDVVZlM7fGA2Y84gkEc7flmSHihSqQuD/FYp+wcGTjiEcvicCEPzyzuUH3hh9HfFI1fZspelZ5pYqlEBhOhhg1Rd70MLTViejGYfFDM40uEas1UJqCb87sVQvA4VJZSufz/xhD8K/TI7Vg8nAX1hoEP3fOfgei8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770383614; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l06N7W/IgJqsoeByf1/E1bvHwGy9JIi2puRVREdrwfk=; b=HC8iP3TkhMG4439zDBSIqsqOaf0/7K9QLA3/vcZDYg5Zc+YE2OfaZkj7CnRKHcNgednRiau4CKFb56QvyyBZtaQyYZT384X+geO8NHLFSBNc6lE0TbfZMqWBPQdUK32Qtf/DnQFh4kNxhZ0S/t/N5z3dOJxwu4GWY3a4UValxEo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1770383614120162.51711673530372; Fri, 6 Feb 2026 05:13:34 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1223202.1530809 (Exim 4.92) (envelope-from ) id 1voLe8-00017x-NM; Fri, 06 Feb 2026 13:13:16 +0000 Received: by outflank-mailman (output) from mailman id 1223202.1530809; Fri, 06 Feb 2026 13:13:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1voLe8-00017o-JD; Fri, 06 Feb 2026 13:13:16 +0000 Received: by outflank-mailman (input) for mailman id 1223202; Fri, 06 Feb 2026 13:13:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1voLe6-00015k-Or for xen-devel@lists.xenproject.org; Fri, 06 Feb 2026 13:13:14 +0000 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [2a00:1450:4864:20::42c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 953ecb26-035d-11f1-9ccf-f158ae23cfc8; Fri, 06 Feb 2026 14:13:09 +0100 (CET) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43596062728so2226633f8f.1 for ; Fri, 06 Feb 2026 05:13:09 -0800 (PST) Received: from localhost.localdomain (host-92-22-18-152.as13285.net. [92.22.18.152]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-436296c0f2esm5726244f8f.19.2026.02.06.05.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 05:13:07 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 953ecb26-035d-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1770383589; x=1770988389; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l06N7W/IgJqsoeByf1/E1bvHwGy9JIi2puRVREdrwfk=; b=FooH+3NJtFPRBCtoIX9seKxIE9B8reXEYf9Iw55ux1lQ/c9arEBXrwa+Z5Q1WiRT3A UfuXO3HO1IIeWoysy0iaoP5DQvwfUmD549xAaZVWFn3QVQM1ZTB4kzD+3KeWGbdmyGPM 4cNHpznCnB+eGtNqMtXFk7J52Y+ZDE5Y+ZAK8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770383589; x=1770988389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=l06N7W/IgJqsoeByf1/E1bvHwGy9JIi2puRVREdrwfk=; b=gLzqT77S0X0aSlyScJzH7SUesOM97w6MvNgBekt22TH1H8JJlIwGPxcCx94kwhBdTq enHHhgzPAjkqcLtA6zhsJx9vRCf6859Rzn5pUU84N6XFIPNt91MYXLkkzN4JG4tRuION Qu6b2Sj6TBbmSOWQhl2rSBXIJyIs/AfqqnQVTjOdpimbS6rH10qfFQshcXDJVtT75Dr5 SBbasY9FnjUdbl6SvjTcLyXQ2EpXYmJr1lFsJ+G9+5IDjUX5wvBpW//ZKBgA0THIbnl9 QnRrM2AsVbrA78btnm/ARgOkuauHtZoAGStnW+ttVDe9S+LhJY4AamQNocm4ZpTakQ2y lZuQ== X-Gm-Message-State: AOJu0YwhgW9IaWwEEhq2WCnQCy3DhpEpd7wg+ustbUBFSLpnHFlA5mpl mSCWe5npME8Wj4k+JvQpNNQGm0cu/0WDziDt8y1ytC86gRmkuBZD9wB//i4AeJ4tey/W2H+4ejs B9uF9 X-Gm-Gg: AZuq6aKNcvCBpoq6oXbCnU46yF3dIBvIzvrVnSDAvC6/q8ch8QckWsJ8w1+q7FWzDNX Hh/u1oQzkt5VcKMm6wFvCvZA9W3Xsm2W8t6rbWuJ/GeTyAFN0uncz5xTptIV2N2dIjQandGTGM8 +9fNrUb+JL41s3vHo8b1yFFDkZoHBTpBvWS9SgrGkEk3j/ET+XcUCSFlkPCLPsmLWpzSjmIijwY HdFTMZcuAmk67C1mIEBsr+Gv1GrJDWTpXH/tkFApZxPtlLOWAA2NFZKb/o8H1SuaZxzX9OpjkY8 PavDMzCk+Be/Ldppxv77/d8XCcfkUUvn9iLwHkIRJML+77HNpr01/kUYasOWhXpsgadQ9Emvt8P homV/8/eyPavi7wXqYR6F4o/goYADYMqrDB8Us9iA/6MxUws1+Ue5jLvL/0DXeGDWod/T4gzzNy lIgdFFjpKpxsGEfmst3UKGl5slExKs0lLrI0rsCnt0zW5LnBIvf31TDC7z9RMDpf8ndcWWLBpdF bB+aV7K6g== X-Received: by 2002:a05:6000:18a4:b0:431:c06:bc82 with SMTP id ffacd0b85a97d-436209967b3mr11293997f8f.12.1770383588085; Fri, 06 Feb 2026 05:13:08 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/2] x86: Sort headers Date: Fri, 6 Feb 2026 13:13:04 +0000 Message-Id: <20260206131305.2675905-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260206131305.2675905-1-andrew.cooper3@citrix.com> References: <20260206131305.2675905-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1770383615441158500 ... prior to making changes. mtrr/main.c absolutely does not need to include asm/uaccess.h No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/mtrr/generic.c | 10 ++++++---- xen/arch/x86/cpu/mtrr/main.c | 5 +++-- xen/arch/x86/mm/p2m-ept.c | 22 ++++++++++++---------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generi= c.c index c587e9140e06..ad6a24f055ec 100644 --- a/xen/arch/x86/cpu/mtrr/generic.c +++ b/xen/arch/x86/cpu/mtrr/generic.c @@ -1,17 +1,19 @@ /* This only handles 32bit MTRR on 32bit hosts. This is strictly wrong because MTRRs can span upto 40 bits (36bits on most modern x86) */=20 -#include + #include +#include #include #include -#include + +#include #include #include #include -#include #include +#include #include -#include + #include "mtrr.h" =20 static const struct fixed_range_block { diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c index d4f549d92ee7..eff0500f0d06 100644 --- a/xen/arch/x86/cpu/mtrr/main.c +++ b/xen/arch/x86/cpu/mtrr/main.c @@ -34,11 +34,12 @@ #include #include #include + #include +#include #include -#include #include -#include + #include "mtrr.h" =20 /* No blocking mutexes in Xen. Spin instead. */ diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index dfdbfa0afec8..204bdb054a89 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -5,22 +5,24 @@ */ =20 #include +#include +#include #include -#include +#include + #include #include -#include -#include #include -#include -#include -#include +#include #include -#include +#include +#include +#include #include -#include -#include -#include +#include +#include + +#include =20 #include "mm-locks.h" #include "p2m.h" base-commit: 381b4ff16f7ff83a2dc44f16b8dd0208f3255ec7 --=20 2.39.5 From nobody Mon Feb 9 01:34:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1770383609; cv=none; d=zohomail.com; s=zohoarc; b=XhKJfKs5rMmVFYgEuuRn8TjRRYUPPnn3czFmxBLVwu3TIJVk/cqvIkNS7IRrS+fb3e7St/XEJN0+490nkE2adsoWxKXdsq/OZVI/J+3ARrOAml9kXUGikUaq5Ky18+gzUvjWRZqpma5Hjy71i11kBsVJawOlcrloUJAQYiwCnnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770383609; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vW8VdQJGm+HJLfdiFyEYvmbpGb/n1ANvl9UX6UaPxlQ=; b=B/ewkOf2xbGLIgxELsVhWFvti4TKXPxK9ABrr1LCy3GCdCPK0FxtkCD1Jq7t+pbDFl1WbMCW8S3GmQsUmbDz8CixggzG2nJ5Z74MbVuGAH+TIYlHC4B0aiWNXFS9O7ZHfZj84qAjeKqKeR2nZTQu1ij1qnnLLzIFDKeKanIXZTI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1770383609666519.3770596190011; Fri, 6 Feb 2026 05:13:29 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1223201.1530798 (Exim 4.92) (envelope-from ) id 1voLe4-0000rN-Bc; Fri, 06 Feb 2026 13:13:12 +0000 Received: by outflank-mailman (output) from mailman id 1223201.1530798; Fri, 06 Feb 2026 13:13:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1voLe4-0000rG-8v; Fri, 06 Feb 2026 13:13:12 +0000 Received: by outflank-mailman (input) for mailman id 1223201; Fri, 06 Feb 2026 13:13:10 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1voLe2-0000do-OF for xen-devel@lists.xenproject.org; Fri, 06 Feb 2026 13:13:10 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 953eed7e-035d-11f1-b161-2bf370ae4941; Fri, 06 Feb 2026 14:13:09 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-48327b8350dso3915035e9.1 for ; Fri, 06 Feb 2026 05:13:09 -0800 (PST) Received: from localhost.localdomain (host-92-22-18-152.as13285.net. [92.22.18.152]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-436296c0f2esm5726244f8f.19.2026.02.06.05.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 05:13:08 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 953eed7e-035d-11f1-b161-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1770383589; x=1770988389; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vW8VdQJGm+HJLfdiFyEYvmbpGb/n1ANvl9UX6UaPxlQ=; b=cAkDeF6g4wLikJvbUOO/yEghYdLfqF+bAa1fAf7YzhZ5k44mHB3zNc3WddNM/++G4O eyJAZ74JbTG9tJHF4qwLe+SnmvdNzdnlCcUVbwo9+YfyXCz57bk9bZO0E7u5qkzmvylk ApGldOc9UB1Jbrv8Fr+N6X5jDjm7j0z5Lss90= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770383589; x=1770988389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vW8VdQJGm+HJLfdiFyEYvmbpGb/n1ANvl9UX6UaPxlQ=; b=P3+1w3wrrmRoU5YslnOYXqMaBmAsV9kBricHaxvuFTo8i8QZM0nDvdEbin4LApOHNt mWILaAxFesncX77cxXbZ6uj9OgngbrciOYQwn7lgL2Tcaa+Ag36A0tQMPr5YoETu49iy NqUrsDk3sPPsCUPqmE2vlNLsNbfCKdb7GRNcv1YNgvq93iiI/Ti/xjVcvS1nuJjl7JFC QuUuEl1B99WP0kv9YLha7UVZtiHXKQdRvIYrmkO0KJXTJOVv9GRz01yonZ8KC9pgjJ2R byg8hxXYR/OATP+DjPjMuBjwAGB5AlLBFE53szRcpJr763D/2Dxyo5zf8LmQh/0qS9kn Gbrg== X-Gm-Message-State: AOJu0YxgRWrbC4ejO6PqMTpxlDizaGA4R2kfKzhTPLlnkdChkapbsyMZ Eu8Wr2tstSWicX1Q7tJixf/W/cqoBPPH7JnJQ8A2ABd0e5RsKb62124chBYJGnI3Wtx9rhuBCXy 1oIlurObPtA== X-Gm-Gg: AZuq6aJmuEwpEGXQcz3Lvgo7JaN2eT3Ygyjk2ihEITmiFzM97ILRxalMSDVjAl0YuvG QSxgh/Q5PEVvSAR4ib18jZCzlM8JhS8Z9H5F1jm9AVFarsVMS8RbqI8yboZLcCOUHrNqNBmq4hv pxM9PHQimnbtgA+frvORmoqy4//g2yk0FrbWpphYEi72HDIPW8qYX37dXph/aRsW3jKd1WltJND nQaD6f7H7s9AZi/GLg/iS5Uvj6k733l2/IE0uHURSxqK0KBgTNjaDUPmlsfgN2NGVEDjETCmW6t 7UcR/5PzuBK1gxODpIkbyn59lm1YUJ8J7t5rGeFrrPxnoiUNAoWrVvysBxdSiyMq99C4DMDGYat XfnYGK3nhX+zDWyDudb/feQRrcntHmmJGaJy/R6nKOwJzkhrQ6qk16XYExnVhxuX7fBQDCJ4eCb I/yvhQHj1ceoiZ5pwC99DGdrx2q9fxhVjVFAaZRD0EzUU5AlnVuCO9WYY4HSi/dn5w09jj6g== X-Received: by 2002:a05:600c:470c:b0:483:103c:b1ee with SMTP id 5b1f17b1804b1-483201da9bamr41523865e9.8.1770383588708; Fri, 06 Feb 2026 05:13:08 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 2/2] x86/memtype: Deduplicate rendering of X86_MT_* Date: Fri, 6 Feb 2026 13:13:05 +0000 Message-Id: <20260206131305.2675905-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260206131305.2675905-1-andrew.cooper3@citrix.com> References: <20260206131305.2675905-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1770383611631158500 The MTRR infrastructure has two different copies of mtrr_attrib_to_str(), o= ne in .init and one in regular .text. EPT has another variation. All 3 are incomplete; they encode only the non-reserved values for the task, but hiding reserved values with ?'s is detrimental to the diagnostic purpose of these existing in the first place. Implement a single function which covers all the architectural values. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 Yes I know EPT tries to render the reserved reserved encodings numerically. It's a cute trick, but does get foiled by the '[MTRR_NUM_TYPES] =3D "??";' = row which breaks things. Putting this in traps.c isn't great, but there isn't an obviously better pl= ace either. --- xen/arch/x86/cpu/mtrr/generic.c | 21 ++++----------------- xen/arch/x86/cpu/mtrr/main.c | 21 +++------------------ xen/arch/x86/include/asm/traps.h | 1 + xen/arch/x86/mm/p2m-ept.c | 22 +++------------------- xen/arch/x86/traps.c | 16 ++++++++++++++++ 5 files changed, 27 insertions(+), 54 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generi= c.c index ad6a24f055ec..0b30689a0b99 100644 --- a/xen/arch/x86/cpu/mtrr/generic.c +++ b/xen/arch/x86/cpu/mtrr/generic.c @@ -13,6 +13,7 @@ #include #include #include +#include =20 #include "mtrr.h" =20 @@ -125,20 +126,6 @@ void __init get_mtrr_state(void) static bool __initdata mtrr_show; boolean_param("mtrr.show", mtrr_show); =20 -static const char *__init mtrr_attrib_to_str(mtrr_type x) -{ - static const char __initconst strings[MTRR_NUM_TYPES][16] =3D - { - [X86_MT_UC] =3D "uncachable", - [X86_MT_WC] =3D "write-combining", - [X86_MT_WT] =3D "write-through", - [X86_MT_WP] =3D "write-protect", - [X86_MT_WB] =3D "write-back", - }; - - return (x < ARRAY_SIZE(strings) && strings[x][0]) ? strings[x] : "?"; -} - static unsigned int __initdata last_fixed_start; static unsigned int __initdata last_fixed_end; static mtrr_type __initdata last_fixed_type; @@ -149,7 +136,7 @@ static void __init print_fixed_last(const char *level) return; =20 printk("%s %05x-%05x %s\n", level, last_fixed_start, - last_fixed_end - 1, mtrr_attrib_to_str(last_fixed_type)); + last_fixed_end - 1, x86_mt_name(last_fixed_type)); =20 last_fixed_end =3D 0; } @@ -188,7 +175,7 @@ static void __init print_mtrr_state(const char *level) int width; =20 printk("%sMTRR default type: %s\n", level, - mtrr_attrib_to_str(mtrr_state.def_type)); + x86_mt_name(mtrr_state.def_type)); if (mtrr_state.have_fixed) { const mtrr_type *fr =3D mtrr_state.fixed_ranges; const struct fixed_range_block *block =3D fixed_range_blocks; @@ -214,7 +201,7 @@ static void __init print_mtrr_state(const char *level) level, i, width, mtrr_state.var_ranges[i].base >> 12, width, mtrr_state.var_ranges[i].mask >> 12, - mtrr_attrib_to_str(mtrr_state.var_ranges[i].base & + x86_mt_name(mtrr_state.var_ranges[i].base & MTRR_PHYSBASE_TYPE_MASK)); else printk("%s %u disabled\n", level, i); diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c index eff0500f0d06..f11fbf1a223b 100644 --- a/xen/arch/x86/cpu/mtrr/main.c +++ b/xen/arch/x86/cpu/mtrr/main.c @@ -39,6 +39,7 @@ #include #include #include +#include =20 #include "mtrr.h" =20 @@ -63,22 +64,6 @@ static bool __ro_after_init mtrr_if; static void set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type type); =20 -static const char *const mtrr_strings[MTRR_NUM_TYPES] =3D -{ - "uncachable", /* 0 */ - "write-combining", /* 1 */ - "?", /* 2 */ - "?", /* 3 */ - "write-through", /* 4 */ - "write-protect", /* 5 */ - "write-back", /* 6 */ -}; - -static const char *mtrr_attrib_to_str(int x) -{ - return (x <=3D 6) ? mtrr_strings[x] : "?"; -} - /* This function returns the number of variable MTRRs */ static void __init set_num_var_ranges(void) { @@ -364,8 +349,8 @@ int mtrr_add_page(unsigned long base, unsigned long siz= e, if (types_compatible(type, ltype)) continue; printk (KERN_WARNING "mtrr: type mismatch for %lx000,%lx000 old: %s new= : %s\n", - base, size, mtrr_attrib_to_str(ltype), - mtrr_attrib_to_str(type)); + base, size, x86_mt_name(ltype), + x86_mt_name(type)); goto out; } if (increment) diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/tr= aps.h index 73097e957d05..00dde631ea5b 100644 --- a/xen/arch/x86/include/asm/traps.h +++ b/xen/arch/x86/include/asm/traps.h @@ -19,6 +19,7 @@ void percpu_traps_init(void); extern unsigned int ler_msr; =20 const char *vector_name(unsigned int vec); +const char *x86_mt_name(unsigned int mt); =20 #endif /* ASM_TRAP_H */ =20 diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index 204bdb054a89..1950beb745af 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 #include =20 @@ -1489,21 +1490,6 @@ void ept_p2m_uninit(struct p2m_domain *p2m) free_cpumask_var(ept->invalidate); } =20 -static const char *memory_type_to_str(unsigned int x) -{ - static const char memory_types[8][3] =3D { - [X86_MT_UC] =3D "UC", - [X86_MT_WC] =3D "WC", - [X86_MT_WT] =3D "WT", - [X86_MT_WP] =3D "WP", - [X86_MT_WB] =3D "WB", - [MTRR_NUM_TYPES] =3D "??", - }; - - ASSERT(x < ARRAY_SIZE(memory_types)); - return memory_types[x][0] ? memory_types[x] : "?"; -} - static void cf_check ept_dump_p2m_table(unsigned char key) { struct domain *d; @@ -1551,14 +1537,12 @@ static void cf_check ept_dump_p2m_table(unsigned ch= ar key) if ( p2m_is_pod(ept_entry->sa_p2mt) ) printk("gfn: %13lx order: %2d PoD\n", gfn, order); else - printk("gfn: %13lx order: %2d mfn: %13lx %c%c%c %c%c%c= \n", + printk("gfn: %13lx order: %2d mfn: %13lx %c%c%c %s%c\n= ", gfn, order, ept_entry->mfn + 0UL, ept_entry->r ? 'r' : ' ', ept_entry->w ? 'w' : ' ', ept_entry->x ? 'x' : ' ', - memory_type_to_str(ept_entry->emt)[0], - memory_type_to_str(ept_entry->emt)[1] - ?: ept_entry->emt + '0', + x86_mt_name(ept_entry->emt), c ?: ept_entry->ipat ? '!' : ' '); =20 if ( !(record_counter++ % 100) ) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index f621b99a5fcc..0d951762bce2 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1044,6 +1044,22 @@ const char *vector_name(unsigned int vec) return (vec < ARRAY_SIZE(names) && names[vec][0]) ? names[vec] : "???"; } =20 +const char *x86_mt_name(unsigned int mt) +{ + static const char names[8][4] =3D { + [X86_MT_UC] =3D "UC", + [X86_MT_WC] =3D "WC", + [X86_MT_RSVD_2] =3D "Rs2", + [X86_MT_RSVD_3] =3D "Rs3", + [X86_MT_WT] =3D "WT", + [X86_MT_WP] =3D "WP", + [X86_MT_WB] =3D "WB", + [X86_MT_UCM] =3D "UC-", + }; + + return mt < ARRAY_SIZE(names) ? names[mt] : "?"; +} + void asmlinkage do_double_fault(struct cpu_user_regs *regs) { unsigned int cpu; --=20 2.39.5