From nobody Thu Oct 30 22:51:10 2025 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=1752687124; cv=none; d=zohomail.com; s=zohoarc; b=YgHDPC0Zb2Ao24zkrU48z+mUZ/CdJq24Ft02lzflzUWche0vk1iNF5fgYA/omUeRpgQ+C2P5m4UgbjmeMquN7aO4xsAO0Ox+1Fk5Vk2+802vbnksPwND8Si2gIZS6pnxQqTX+SnlSFa5wIzW5x1VkUJI+Lj5XSaK0YCV64eOwMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752687124; 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=jAO19gQnBoE7WVDxwvzlfnGuot/raaFCcBTWgczKVJ0=; b=mzGen8H+Wb5u6ZnRlPOoGVoytFvIYOhtJAQ2ZILYWr12BgHXNp8ILnvc75HjtJgDJK48wMmmlTogg2wKzrLwAH/nz5y8sVXp2Uh/fR6nStMu7TVKj6FORwvl04M7MqlyiuPDmOp/JnA0gN4dt39PkGQ3zeF4BTdMnO0/7v8NmFw= 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 1752687124380436.1611455716136; Wed, 16 Jul 2025 10:32:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1045518.1415649 (Exim 4.92) (envelope-from ) id 1uc5ym-0002pe-OM; Wed, 16 Jul 2025 17:31:40 +0000 Received: by outflank-mailman (output) from mailman id 1045518.1415649; Wed, 16 Jul 2025 17:31:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uc5ym-0002p7-H7; Wed, 16 Jul 2025 17:31:40 +0000 Received: by outflank-mailman (input) for mailman id 1045518; Wed, 16 Jul 2025 17:31:39 +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 1uc5yl-0002mM-63 for xen-devel@lists.xenproject.org; Wed, 16 Jul 2025 17:31:39 +0000 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [2a00:1450:4864:20::42c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ba0b5d5a-626a-11f0-a319-13f23c93f187; Wed, 16 Jul 2025 19:31:38 +0200 (CEST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3a575a988f9so69784f8f.0 for ; Wed, 16 Jul 2025 10:31:38 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e7f2e68sm27048625e9.1.2025.07.16.10.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jul 2025 10:31:36 -0700 (PDT) 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: ba0b5d5a-626a-11f0-a319-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1752687097; x=1753291897; 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=jAO19gQnBoE7WVDxwvzlfnGuot/raaFCcBTWgczKVJ0=; b=Vz5VegGqRfsadbzjFPEHlCmhYsYA9/6f3yRpZcxeIuTrRP9z002y2kP5u8gaynTjQ8 2oWMhoJ6zNaVPpUoYRHYc53pZkvh9yVb8fSauuorqLXq98jQI1qORUyKmiMa0v3GzfiA ku90CpDkBqaHy5iBFWuovfXvA/uHaMK8xGnpw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752687097; x=1753291897; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jAO19gQnBoE7WVDxwvzlfnGuot/raaFCcBTWgczKVJ0=; b=WmFolAbFOld9N3gdq+cbjuRt/q1PvpiIPjhEGhjl8fThrg9ZK4WTk6vuJlDH53+u4m v+t558dWO53ftKuDN42QlKYOCzdH6fN+5QlPie4Il8GVq1R60H44KzNUY5y2SIa9CZlu Q2XLoTJ7SE+1iQ+CgtVG/FTH25CeFEAK2hqbltv4XWVjiXSc8SGVqL5BFk7pqDcJpjfx C0gNhPkS0rpYirGf3RCwa2ko/LPhP0B3BDSofWOEOY9Wut+fbORGB8qVWtvTeQErrq2o CRdNgYFipuhIB4mstqZnQkWe2SZkCscfzdIo/KsgqRPQdNzXq1gq/l+uTdWIsLRFDwz3 SrJw== X-Gm-Message-State: AOJu0YzOVjWZ4Vm9y6GnEOcCPUZbpq4kNzo4D756E/cvYRxqutBFFo9s 6khLpKfcBDZ4G6GRBpecvXkidcTE0nJJbDYNjVR9csUKVmARhD9Fc2o16NIIbbs96f/ghH8Erra qYIt7oIrDOQ== X-Gm-Gg: ASbGncvXZ27fJ1/MsnLgeOrNz/PT+uE45lCDpdYofQ6jflYG5mNVLT8k+s09IVYW55N BZNn4RAtREB3M6guBbVzrQyW1QxZpgnW+Nf6fW90L19kXDzI4ZrLRFdmGmCoj9EkMG7kPph6m0a txGBJ5iAvPQ+4K9YX4JxVEHj4p4ipbF1KCv/McDEmjh7po1zC0cMVxF1ZRHGSfiNsmWauGAatXV QpvEopjg/3+kQq+MK0DxHMiAyDxwVPkYdCjpT7GV8JhRE3sAQ86XBiODmeHPyrCP8sqTG6R/QIg jS8VCi1fpjC3MKgVdhDM8a27WESIWg0mrgwmGVBQU7k87Ow7tBPfESrqLeN/rkw0K4fXv9iP5lA uSacJiRPL1egG/lBvTz1TZfmqeLrE7Ey6Z8Xc/M6sJXwR2h9FLUvMNzA6ow4AHwyRNlScSh8XR3 9P X-Google-Smtp-Source: AGHT+IE28/BnNOqiTvyAPZDQPuefbHWwadyUthjYXtd92J+8k3IwF4PxnXW3XlJUj3sSa4Hf9kiA7Q== X-Received: by 2002:a05:6000:4404:b0:3a6:d349:1b52 with SMTP id ffacd0b85a97d-3b60dd54165mr2329935f8f.21.1752687096867; Wed, 16 Jul 2025 10:31:36 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/6] x86: Sort headers Date: Wed, 16 Jul 2025 18:31:27 +0100 Message-Id: <20250716173132.2213891-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250716173132.2213891-1-andrew.cooper3@citrix.com> References: <20250716173132.2213891-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: 1752687125437116600 In intel.c, drop asm/mwait.h and asm/uaccess.h, neither of which are used. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/cpu_idle.c | 3 ++- xen/arch/x86/apic.c | 25 ++++++++++++------------- xen/arch/x86/cpu/intel.c | 14 ++++++-------- xen/arch/x86/cpu/mwait-idle.c | 6 ++++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index 19f710f0dd9d..86f32fd9a6f0 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -45,7 +45,6 @@ #include #include =20 -#include #include #include #include @@ -55,6 +54,8 @@ #include #include =20 +#include + #include #include =20 diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index bb86a1c161b3..a058c435878a 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -16,32 +16,31 @@ * Mikael Pettersson : PM converted to driver model. */ =20 -#include +#include #include #include +#include +#include #include #include +#include #include -#include -#include #include #include =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 =20 diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c index f7bd0d777289..59b5828fa9e9 100644 --- a/xen/arch/x86/cpu/intel.c +++ b/xen/arch/x86/cpu/intel.c @@ -1,18 +1,16 @@ +#include #include #include #include -#include -#include #include +#include =20 -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include #include =20 #include "cpu.h" diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c index 9ee54c625a90..c733a672d1e0 100644 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -42,18 +42,20 @@ /* un-comment DEBUG to enable pr_debug() statements */ #define DEBUG =20 -#include #include #include +#include #include #include #include + #include #include #include -#include #include +#include #include + #include =20 #define MWAIT_IDLE_VERSION "0.4.1" --=20 2.39.5 From nobody Thu Oct 30 22:51:10 2025 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=1752687122; cv=none; d=zohomail.com; s=zohoarc; b=YwG+G4EoDiB4pYl/WrJlrjmojHJtpD4bDZBCEI2f5ECCarZGaeqcyxCA5fD+zWRBxhG7fXfXCUDcPLnms/DJO6kgiJiyegExDv4lK4YxwDVMJYGghpEIxTjEgtTTyZoCPlR95iFrP+75rZ1ZfZg7Faw02Olpl5HlouPF7KkAPxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752687122; 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=uGM1Q5EIuvsx4uKAcpMSkvBp3uB8iDs6K5Nkv2be9Lk=; b=dq/dFZOt+C3HN0+z8JCpoPfcET2X5cjrL4AHSvlkaNeTj41vzLBLvta1/y8m88ZEu0YIffm0bBu1vMtsXVGCJylQIHy6iwa2wb0fFOiA3zdP3maOK7dt2rIi06/GqgJhq4GEKLPpWSplBWv9ny8yjmjpOQU1yPInE5VVOwDbllU= 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 1752687122970257.65006823495696; Wed, 16 Jul 2025 10:32:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1045521.1415682 (Exim 4.92) (envelope-from ) id 1uc5yp-0003fl-Iy; Wed, 16 Jul 2025 17:31:43 +0000 Received: by outflank-mailman (output) from mailman id 1045521.1415682; Wed, 16 Jul 2025 17:31:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uc5yp-0003fD-Eq; Wed, 16 Jul 2025 17:31:43 +0000 Received: by outflank-mailman (input) for mailman id 1045521; Wed, 16 Jul 2025 17:31:41 +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 1uc5yn-00030y-T1 for xen-devel@lists.xenproject.org; Wed, 16 Jul 2025 17:31:41 +0000 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [2a00:1450:4864:20::431]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id babe35b7-626a-11f0-b894-0df219b8e170; Wed, 16 Jul 2025 19:31:38 +0200 (CEST) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3a6d1369d4eso54205f8f.2 for ; Wed, 16 Jul 2025 10:31:38 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e7f2e68sm27048625e9.1.2025.07.16.10.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jul 2025 10:31:37 -0700 (PDT) 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: babe35b7-626a-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1752687098; x=1753291898; 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=uGM1Q5EIuvsx4uKAcpMSkvBp3uB8iDs6K5Nkv2be9Lk=; b=ahgevl2UcpcRzoT2hZeBW/QhFi5ieOeNsO5zDFd4/cgy4SsykSNm5KCSd6vxJ/GRc3 buM53ZjLl1N0RRdf7kNUkVoz2jtL+n6+1t5698aEGPfn2rfC6EjNWeVks5co/j/FqAcb OKjX0a0D/B7ShIdyQRLG02H+2NyY4+7hgBCMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752687098; x=1753291898; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uGM1Q5EIuvsx4uKAcpMSkvBp3uB8iDs6K5Nkv2be9Lk=; b=NBwnx42I0tAjn5ZXObvJeUaa/9HVOIxTDXIi9/5oDx6Wu6aDhsYFTjNu1Bo9sZg7M0 k6w6REjP9IVTEalNKRYoCwgKbtDbzUdXxDXoFdYdJVF8lYZZuZrB+JKmlbKXBeBMViMt S2mUhsRyPUVxKX2+Z84KBArrsPzpzO/t1V8zMOgkdKVJc0ZWEPoCEttprw02MLftj6oa gNHwjqmczUEXN3Ep5ml1J2Jnp1cxcJ9TJVbaZYl4y6XrdRWugYhh4NclTmgJIbP6vE7V 5PUnhucz4ZCHdEtBbrdk7uT2nEm2k1Eoq/JeycXez1PjQ/sIiK1h/Z3Lkm4iXpo7B3K6 c7kw== X-Gm-Message-State: AOJu0YxVvM+RSxWczNEjqQ+ZTqvU6lizH8s4c3DveQ1wh1IiB6RHLkdy iZZUaPJcl0SXSewYWoFtXBX6fWYzKfy7V7tDiL7ah/VF89PRgt53qMnmxDjTtGScTQb+ZyJ0iVU r6YtJP40Rtw== X-Gm-Gg: ASbGncu8g5DdlkrgHqN8CY/j9NISh6pUu5MeUqgrsTgtsO/597lNeum5uc8eMYUdmI+ Ib03imvDdjkltx0+3YOst1QRU1HT0MdA15moRGUxf+eKyoCmbSNp+xllRKqz/LeVuG5D/+eFbF1 kDcopanKoXhTbK5gIcmxLCUut7m7pVJksgn8IyXtN8IcipDUtF9wLh9IOgkIz/kHPEeSo1ow8pG 9mRDjl11viD/EhqguXLHJBzutZi1dcwJlPQ08+1BcIInkH9cb+SZzCTNcylRhhMPdcOiLCJlJm7 SSTf3xS366T/Z47mHYxvBT1pWWnBnF2Q+dN/+rnapIM3CpDc0fii4xyY5Sx7O7TMK7AmgRDnfWH U7oH3/2PK4VroW+TgZA3QcvPd1iuENNkPzc1mOvYhyzwB4hb01XtF9SHjy9/G+p1m7SSFlvVUg4 ZN X-Google-Smtp-Source: AGHT+IFPr6SaMfmfUk9/B5XbKRHzcgQBpqGhtOvy3yp7Lq8gwXtvkia5tDU5xNBUj60r82WH02/1Dg== X-Received: by 2002:a5d:5f86:0:b0:3b2:ef53:5818 with SMTP id ffacd0b85a97d-3b60dd643d3mr3247037f8f.5.1752687097759; Wed, 16 Jul 2025 10:31:37 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 2/6] x86: Break struct x86_cpu_id out of processor.h Date: Wed, 16 Jul 2025 18:31:28 +0100 Message-Id: <20250716173132.2213891-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250716173132.2213891-1-andrew.cooper3@citrix.com> References: <20250716173132.2213891-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: 1752687125689116600 Only 5 files use struct x86_cpu_id, so it should not be in processor.h. Th= is is in preparation to extend it with VFM support. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/cpu_idle.c | 2 +- xen/arch/x86/apic.c | 1 + xen/arch/x86/cpu/common.c | 21 +-------------------- xen/arch/x86/cpu/intel.c | 2 +- xen/arch/x86/cpu/mwait-idle.c | 1 + xen/arch/x86/include/asm/match-cpu.h | 25 +++++++++++++++++++++++++ xen/arch/x86/include/asm/processor.h | 10 ---------- 7 files changed, 30 insertions(+), 32 deletions(-) create mode 100644 xen/arch/x86/include/asm/match-cpu.h diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index 86f32fd9a6f0..fee29353439e 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -50,8 +50,8 @@ #include #include #include +#include #include -#include #include =20 #include diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index a058c435878a..c4272ab4de4f 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 77364fd728db..cc004fc976f5 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -11,9 +11,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -998,25 +998,6 @@ void cpu_uninit(unsigned int cpu) cpumask_clear_cpu(cpu, &cpu_initialized); } =20 -/* - * x86_match_cpu - match the current CPU against an array of - * x86_cpu_ids - * @match: Pointer to array of x86_cpu_ids. Last entry terminated with - * {}. - * Return the entry if the current CPU matches the entries in the - * passed x86_cpu_id match table. Otherwise NULL. The match table - * contains vendor (X86_VENDOR_*), family, model and feature bits or - * respective wildcard entries. - * - * A typical table entry would be to match a specific CPU - * { X86_VENDOR_INTEL, 6, 0x12 } - * or to match a specific CPU feature - * { X86_FEATURE_MATCH(X86_FEATURE_FOOBAR) } - * - * This always matches against the boot cpu, assuming models and -features are - * consistent over all CPUs. - */ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]) { const struct x86_cpu_id *m; diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c index 59b5828fa9e9..ee1ae92cd7e6 100644 --- a/xen/arch/x86/cpu/intel.c +++ b/xen/arch/x86/cpu/intel.c @@ -8,9 +8,9 @@ #include #include #include +#include #include #include -#include #include =20 #include "cpu.h" diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c index c733a672d1e0..eec2823cbacf 100644 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/include/asm/match-cpu.h b/xen/arch/x86/include/as= m/match-cpu.h new file mode 100644 index 000000000000..2704b84d74c9 --- /dev/null +++ b/xen/arch/x86/include/asm/match-cpu.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef X86_MATCH_CPU_H +#define X86_MATCH_CPU_H + +#include + +struct x86_cpu_id { + uint16_t vendor; + uint16_t family; + uint16_t model; + uint16_t feature; + const void *driver_data; +}; + +/* + * x86_match_cpu() - match the CPU against an array of x86_cpu_ids[] + * + * @table: Array of x86_cpu_ids. Last entry terminated with {}. + * + * Returns the matching entry, otherwise NULL. This always matches against + * the boot CPU, assuming models and features are consistent over all CPUs. + */ +const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]); + +#endif /* X86_MATCH_CPU_H */ diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/as= m/processor.h index 04824c3633cf..c58617631bf3 100644 --- a/xen/arch/x86/include/asm/processor.h +++ b/xen/arch/x86/include/asm/processor.h @@ -80,14 +80,6 @@ struct domain; struct vcpu; =20 -struct x86_cpu_id { - uint16_t vendor; - uint16_t family; - uint16_t model; - uint16_t feature; /* bit index */ - const void *driver_data; -}; - extern struct cpuinfo_x86 cpu_data[]; #define current_cpu_data cpu_data[smp_processor_id()] =20 @@ -104,8 +96,6 @@ extern unsigned int hap_paddr_bits; /* Maximum width of virtual addresses supported by the hardware. */ extern unsigned int vaddr_bits; =20 -extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id tabl= e[]); - extern void identify_cpu(struct cpuinfo_x86 *c); extern void setup_clear_cpu_cap(unsigned int cap); extern void setup_force_cpu_cap(unsigned int cap); --=20 2.39.5 From nobody Thu Oct 30 22:51:10 2025 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=1752687125; cv=none; d=zohomail.com; s=zohoarc; b=k1aiUUYFZeP6Cm5+rF3QeFlBH80gNKjvJ/caRUuOQf3xugGwEN5/j2n/iru6Cdt5TnIfnyD3VkB4kCGW+sLs/o3xsou1JpdZ01A+d8i7tsi8/gEawwtKiJDwUsNVyTt5W+FFWaHv4cXpTaeUA1e1dnQ/NB9rSMoYpMbXPqRLzmM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752687125; 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=BuWKT5EgHoHwknJ0QpFPabebIVFnr/8XAOuFOiO5CxY=; b=Yaw8mb1qZ0Omq8s4xgngEMGf9qcdqjvHBM/bWiqEA8C7vwgNQmY70iFnpCMQcKAdEMpQtI5m3eq67p7MwACEUpWoNuJs49VIo6oOHJ2PgQZ5IohZVTfeG6N0r6TKUJIWaQGFhJu6UuXsi9HBtHxslqNkkg5Jnw6PYrkughaOQjU= 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 1752687125498786.7162166955197; Wed, 16 Jul 2025 10:32:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1045519.1415662 (Exim 4.92) (envelope-from ) id 1uc5yo-0003EC-2S; Wed, 16 Jul 2025 17:31:42 +0000 Received: by outflank-mailman (output) from mailman id 1045519.1415662; Wed, 16 Jul 2025 17:31:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uc5yn-0003E4-V3; Wed, 16 Jul 2025 17:31:41 +0000 Received: by outflank-mailman (input) for mailman id 1045519; Wed, 16 Jul 2025 17:31:40 +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 1uc5ym-0002mM-2w for xen-devel@lists.xenproject.org; Wed, 16 Jul 2025 17:31:40 +0000 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [2a00:1450:4864:20::330]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bb38eb88-626a-11f0-a319-13f23c93f187; Wed, 16 Jul 2025 19:31:39 +0200 (CEST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-45611a517a4so697605e9.1 for ; Wed, 16 Jul 2025 10:31:39 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e7f2e68sm27048625e9.1.2025.07.16.10.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jul 2025 10:31:38 -0700 (PDT) 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: bb38eb88-626a-11f0-a319-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1752687099; x=1753291899; 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=BuWKT5EgHoHwknJ0QpFPabebIVFnr/8XAOuFOiO5CxY=; b=pBiWjdUzLBaNQKSnlukOqhbXJpEoFAZIu6xiVfZX75Ny0RTSti58hZkeEpbqcT6wcU C4UGxXyvn0krv/KCqAMvZe2N1XFdufWdb++R1OMLU9jQsOjtty+d5XJwZbf75OeVmmyb mXuMOJtrZjfyKQrr4BRWYjF68q0Dphrk4bKUk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752687099; x=1753291899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BuWKT5EgHoHwknJ0QpFPabebIVFnr/8XAOuFOiO5CxY=; b=atjclPBvpcUjbrJgJ9qihMKmNvcVdthx6P+mTmA1KMoiQYU+PGUDeiozxloDbqe03t V5E9Fi2HBSAGzgkads05hrNNnSSCW4jvQm79ENzOGcz2P+kAbGNV7HfgUuXjOIdUwTmc mNLCt/KNcXASW01T1gGBfGWOi5U1yFmGxiPLJBtK1UpWqk64EZwglCXukqV4w+NJkLDI 32G/tDuXIYRp4nqRuwEVIublNaMvalutufqwNREBlKP45MszLhjdQ3Qd+qTOamqXmdO+ /PIE3E3JYeMY6cdhKWfV5OKLQYAT2gW2hKwHTOWjj71pbzDzSM7tKGe+29QYCt2o4Y+P ry/g== X-Gm-Message-State: AOJu0YzSRWwVXhhwr3JTI8je6f3sAKwRBwvrfXjrUh+T07t+Y6Q2N9HM NtCQiuUIdrWyNHm6SF1QWnypGiTOvUkV6/2O6mDKifVt9MADyrJORmdzaBdm4v9yyXBWZaVwFQA m3VQM62XAVA== X-Gm-Gg: ASbGncsesi6UNUIWzPFOU5AHIyLkPjGvvTH3bFuljkuinI3+O1fDAfk2Jxz2YewOXqK lW5LZuUDZsFYT4SV23I4rGyzxYVKHcoK9WyJZqHfbjiSq1kDYRBM4s383hWaUjEOpmYEKUiTczH lfK2fOzsG9pjHzX56uROPxlryZudNBzRdt7tjHQlOOdM07gsECfnr88QdBXPmPGbc6mvshAAqYG /wdKaDQOHmD7/e2vUqvNHUrAHEz9IviTkQXlxWqBJRh53DALf0UzmLvFsBaSzjkqPQdln2RNGFB WEQ6gYkfCpmqcOwHfMedxNOSBVfJeaRc1M2S9whoVu+Irw/3d/LNDl/Woh0iKgPcF0cUHenZUA8 vDsDm3uPbAnkceYMbRqcW3zD+A2LAetgATNyb9gnXrgYUEjlG1+Iu5U4c8CI5w4mDq0LLohFGqI TI X-Google-Smtp-Source: AGHT+IGynP6k8Q9sBl7SRYEXh+IhwA9BUOAAgsi8q1SGfpvDdMhvPK8/YlT2pMvqdwd/AUMI0Rxaiw== X-Received: by 2002:a05:600c:8901:b0:455:efd7:17dc with SMTP id 5b1f17b1804b1-45634588a24mr2380285e9.11.1752687098614; Wed, 16 Jul 2025 10:31:38 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 3/6] x86/match-cpu: Introduce X86_MATCH_VFM() and convert intel_idle_ids[] Date: Wed, 16 Jul 2025 18:31:29 +0100 Message-Id: <20250716173132.2213891-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250716173132.2213891-1-andrew.cooper3@citrix.com> References: <20250716173132.2213891-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: 1752687127367116600 mwait-idle's ICPU() is the most convenient place to get started. Introduce X86_MATCH_CPU() and X86_MATCH_VFM() following their Linux counterparts. This involves match-cpu.h including more headers, which in turn allows us to drop a few. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 We now have X86_FEATURE_ANY and X86_FEATURE_ALWAYS as aliases of LM. Given the contexts they're used in, I've left the naming as-is. It's a bit nasty (preprocessing wise) triple-expanding VFM in X86_MATCH_VFM= (), but we need an Integer Constant Expression. --- xen/arch/x86/cpu/intel.c | 1 - xen/arch/x86/cpu/mwait-idle.c | 4 +--- xen/arch/x86/include/asm/match-cpu.h | 21 ++++++++++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c index ee1ae92cd7e6..26a171aa363e 100644 --- a/xen/arch/x86/cpu/intel.c +++ b/xen/arch/x86/cpu/intel.c @@ -7,7 +7,6 @@ =20 #include #include -#include #include #include #include diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c index eec2823cbacf..e837cbf50eb3 100644 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -51,7 +51,6 @@ =20 #include #include -#include #include #include #include @@ -1302,8 +1301,7 @@ static const struct idle_cpu idle_cpu_srf =3D { }; =20 #define ICPU(model, cpu) \ - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ ## model, X86_FEATURE_ALWAYS, \ - &idle_cpu_ ## cpu} + X86_MATCH_VFM(INTEL_ ## model, &idle_cpu_ ## cpu) =20 static const struct x86_cpu_id intel_idle_ids[] __initconstrel =3D { ICPU(NEHALEM_EP, nehalem), diff --git a/xen/arch/x86/include/asm/match-cpu.h b/xen/arch/x86/include/as= m/match-cpu.h index 2704b84d74c9..dcdc50a70d14 100644 --- a/xen/arch/x86/include/asm/match-cpu.h +++ b/xen/arch/x86/include/asm/match-cpu.h @@ -4,14 +4,33 @@ =20 #include =20 +#include +#include +#include + +#define X86_FEATURE_ANY X86_FEATURE_LM + struct x86_cpu_id { uint16_t vendor; uint16_t family; uint16_t model; - uint16_t feature; + uint16_t feature; /* X86_FEATURE_*, or X86_FEATURE_ANY */ const void *driver_data; }; =20 +#define X86_MATCH_CPU(v, f, m, feat, data) \ + { \ + .vendor =3D (v), \ + .family =3D (f), \ + .model =3D (m), \ + .feature =3D (feat), \ + .driver_data =3D (const void *)(unsigned long)(data), \ + } + +#define X86_MATCH_VFM(vfm, data) \ + X86_MATCH_CPU(VFM_VENDOR(vfm), VFM_FAMILY(vfm), \ + VFM_MODEL(vfm), X86_FEATURE_ANY, data) + /* * x86_match_cpu() - match the CPU against an array of x86_cpu_ids[] * --=20 2.39.5 From nobody Thu Oct 30 22:51:10 2025 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=1752687129; cv=none; d=zohomail.com; s=zohoarc; b=Kn7AvtPbs5+oaWNhEVwTVipF8+Lgps6pl/5FeHrvDRAv47NSTCj8rD1USxj+ydZt58IHB/l1HrTz9kCWrzjkCQbzINw3fNCfkB0PAPAatMmFyJZzPGhdZFdRvzuUewP1UnnQb2bAbYqK6b6ZgJPqBJDjkyW4sTdR3fDvDHTiOP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752687129; 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=2cHqWIXYK9ZHd5yODMOV445YmwZQVsFju3NAdcKhA+M=; b=ZTh/RQhJ8u8WF+/QTuVrtP1uxhYpXZ8+M+gF8PRJ3Pg/EJi1j2LS9CrzepMaoF7vw+ROfkCfcSVgkj76SjfdCEx9lqzRBQOuLibrKdWmCoq2VeVrEeewE56eHEW8bFB4dV97pQzOg1n8mwdkq9riiSoKVj0Rz07DzuSc2n+hfvk= 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 1752687129683649.7620062234178; Wed, 16 Jul 2025 10:32:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1045520.1415666 (Exim 4.92) (envelope-from ) id 1uc5yo-0003H6-Ba; Wed, 16 Jul 2025 17:31:42 +0000 Received: by outflank-mailman (output) from mailman id 1045520.1415666; Wed, 16 Jul 2025 17:31:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uc5yo-0003GP-6i; Wed, 16 Jul 2025 17:31:42 +0000 Received: by outflank-mailman (input) for mailman id 1045520; Wed, 16 Jul 2025 17:31:41 +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 1uc5ym-0002mM-Uh for xen-devel@lists.xenproject.org; Wed, 16 Jul 2025 17:31:40 +0000 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [2a00:1450:4864:20::334]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bba3099e-626a-11f0-a319-13f23c93f187; Wed, 16 Jul 2025 19:31:40 +0200 (CEST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4537edf2c3cso734375e9.3 for ; Wed, 16 Jul 2025 10:31:40 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e7f2e68sm27048625e9.1.2025.07.16.10.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jul 2025 10:31:38 -0700 (PDT) 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: bba3099e-626a-11f0-a319-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1752687099; x=1753291899; 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=2cHqWIXYK9ZHd5yODMOV445YmwZQVsFju3NAdcKhA+M=; b=KVyCnSd8amSZulrS1eg+guK8xqzdechMiAMxlrg+5xw2k5keEMynGz0f54HaaQv79I kIKfDR8QUlnj2QeQxzqt6Ze1ahv98xpHaYts8gp5hbF0q4S3aScae74Nw51beZAZJXpg SDjxVzuTYFm0MLNmUa/2z1ps7NWt6ZJ2T/LwM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752687099; x=1753291899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2cHqWIXYK9ZHd5yODMOV445YmwZQVsFju3NAdcKhA+M=; b=LLxyS2/Tk+s8RgZXvRIxmWXGWQewz7R2tbT2WRYANgvZYQKorQTJ/IqLy4R3z3ubRR ZAw3DoL/2M+Yw0Rpl0WzFZAsWGu2iMCZZJ+SCFjnlA+maoKiOyMDBHaf6Wmy7I+MwiAM WxnRvG7UHYTwZiSPs4iJNPGNWTATbIwDarezTIbAbyxqhni2YaB8DssXVExzDc53oG+4 7Jd8RydDDxmGfiyW0MuL1hsx3z6G3WKJgKFFwjor3L5QeurIdXvMH/IoIkWNuLd/5VzF I6m9QngZe+BYkp3g+X4uqOLNYkrF9mGIXKVoDs1Bf5Xe66TAEvRjWluDerXtQ0Uop+Y1 MM9A== X-Gm-Message-State: AOJu0YwQMt+BTHWwh63CbDm6q3rlGInWNy5N2uPfuWDoFqJm4rNdCaW/ /N+y3yhLBQDmE7i6WruobEc6cEzg/MXcHszOIvNxQrSpk1eHfPVc5Jhz6+vgnbB/OBIMGwK+TVm KVnEMooADtA== X-Gm-Gg: ASbGnctMnLizMAn4Hgd4ZFqAfgRkBpOIPXOkcMYOmHIau2Uuh/AdVrtRi1RquOXx1ng Gjv3NMvF953WMHgIyDK0PUnM3ryzNjb+Qp3d0CseX0HRd/HnOSbFPk2h/UvIo3lSfJh5ScVT1rv YMIGJ2rVI1SDMuFb2EAS5VBtGhQZAgZ+8i5TMK5zTLir52a2rtr57KZXt7zLbpTzwaoDUOCxkTd wbqx35qLEULTF5OyDdABTlkxLFindFwMioEvpzvVztVw3tvKpVfbniqyquqiw/WFS2pKdjYm4vZ y6I3ywFeqDZCPfvHJW6mkI2vlzHf49FUprTAF0RZVPLQX4bkzJRCpqBy7b3LCs5hNkvhYK7vMDX 2Fui+1VsLR2vM2oee6j9hBT64r57F/jFM8Db4bHIQzVC+MkuZePPSNjF7HGrzfpo9EE+puSlvd6 iI+GbKvAtWd44= X-Google-Smtp-Source: AGHT+IFerGiKFNcZqXC7oXHy7Xms5M28KyxTImmZyTMyYQmvkqDc4bSqVrqYOBHxadlOHOtj+kBnoQ== X-Received: by 2002:a05:600c:820f:b0:43c:ec0a:ddfd with SMTP id 5b1f17b1804b1-4562ed57638mr33497505e9.6.1752687099449; Wed, 16 Jul 2025 10:31:39 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 4/6] x86: Convert users of INTEL_FAM6_MODEL() to X86_MATCH_VFM() Date: Wed, 16 Jul 2025 18:31:30 +0100 Message-Id: <20250716173132.2213891-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250716173132.2213891-1-andrew.cooper3@citrix.com> References: <20250716173132.2213891-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: 1752687131268116600 This replaces raw model numbers (and comments in some cases) with names. F= or probe_mwait_errata(), merge the comments with the table to make it easier to see which erratum is which, and drop a stray "Problem" in LNL030. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 There isn't an obvious helper in Linux to use which can avoid the data parameter; Linux doesn't really do lists like this which are *just* a VFM match with nothing else. Either way, I've opted for a few extra NULLs than a proliferation of X86_MATCH_*() helpers. --- xen/arch/x86/acpi/cpu_idle.c | 48 ++++++++++++++------------------- xen/arch/x86/cpu/intel.c | 51 +++++++++++++++++------------------- 2 files changed, 44 insertions(+), 55 deletions(-) diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index fee29353439e..78e98e9c134d 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -583,7 +583,6 @@ bool errata_c6_workaround(void) =20 if ( unlikely(fix_needed =3D=3D -1) ) { -#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS } /* * Errata AAJ72: EOI Transaction May Not be Sent if Software Enters * Core C6 During an Interrupt Service Routine" @@ -594,12 +593,12 @@ bool errata_c6_workaround(void) * there is an EOI pending. */ static const struct x86_cpu_id eoi_errata[] =3D { - INTEL_FAM6_MODEL(0x1a), - INTEL_FAM6_MODEL(0x1e), - INTEL_FAM6_MODEL(0x1f), - INTEL_FAM6_MODEL(0x25), - INTEL_FAM6_MODEL(0x2c), - INTEL_FAM6_MODEL(0x2f), + X86_MATCH_VFM(INTEL_NEHALEM_EP, NULL), + X86_MATCH_VFM(INTEL_NEHALEM, NULL), + X86_MATCH_VFM(INTEL_NEHALEM_G, NULL), + X86_MATCH_VFM(INTEL_WESTMERE, NULL), + X86_MATCH_VFM(INTEL_WESTMERE_EP, NULL), + X86_MATCH_VFM(INTEL_WESTMERE_EX, NULL), { } }; /* @@ -617,29 +616,22 @@ bool errata_c6_workaround(void) * discovered on Haswell hardware, and is affected. */ static const struct x86_cpu_id isr_errata[] =3D { - /* Haswell */ - INTEL_FAM6_MODEL(0x3c), - INTEL_FAM6_MODEL(0x3f), - INTEL_FAM6_MODEL(0x45), - INTEL_FAM6_MODEL(0x46), - /* Broadwell */ - INTEL_FAM6_MODEL(0x47), - INTEL_FAM6_MODEL(0x3d), - INTEL_FAM6_MODEL(0x4f), - INTEL_FAM6_MODEL(0x56), - /* Skylake (client) */ - INTEL_FAM6_MODEL(0x5e), - INTEL_FAM6_MODEL(0x4e), - /* {Sky/Cascade}lake (server) */ - INTEL_FAM6_MODEL(0x55), - /* {Kaby/Coffee/Whiskey/Amber} Lake */ - INTEL_FAM6_MODEL(0x9e), - INTEL_FAM6_MODEL(0x8e), - /* Cannon Lake */ - INTEL_FAM6_MODEL(0x66), + X86_MATCH_VFM(INTEL_HASWELL, NULL), + X86_MATCH_VFM(INTEL_HASWELL_X, NULL), + X86_MATCH_VFM(INTEL_HASWELL_L, NULL), + X86_MATCH_VFM(INTEL_HASWELL_G, NULL), + X86_MATCH_VFM(INTEL_BROADWELL, NULL), + X86_MATCH_VFM(INTEL_BROADWELL_G, NULL), + X86_MATCH_VFM(INTEL_BROADWELL_X, NULL), + X86_MATCH_VFM(INTEL_BROADWELL_D, NULL), + X86_MATCH_VFM(INTEL_SKYLAKE_L, NULL), + X86_MATCH_VFM(INTEL_SKYLAKE, NULL), + X86_MATCH_VFM(INTEL_SKYLAKE_X, NULL), + X86_MATCH_VFM(INTEL_KABYLAKE_L, NULL), + X86_MATCH_VFM(INTEL_KABYLAKE, NULL), + X86_MATCH_VFM(INTEL_CANNONLAKE_L, NULL), { } }; -#undef INTEL_FAM6_MODEL =20 fix_needed =3D cpu_has_apic && ((!directed_eoi_enabled && x86_match_cpu(eoi_errata))= || diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c index 26a171aa363e..2028a609453b 100644 --- a/xen/arch/x86/cpu/intel.c +++ b/xen/arch/x86/cpu/intel.c @@ -382,16 +382,12 @@ static void cf_check early_init_intel(struct cpuinfo_= x86 *c) */ static void probe_c3_errata(const struct cpuinfo_x86 *c) { -#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS } static const struct x86_cpu_id models[] =3D { - /* Nehalem */ - INTEL_FAM6_MODEL(0x1a), - INTEL_FAM6_MODEL(0x1e), - INTEL_FAM6_MODEL(0x1f), - INTEL_FAM6_MODEL(0x2e), - /* Westmere (note Westmere-EX is not affected) */ - INTEL_FAM6_MODEL(0x2c), - INTEL_FAM6_MODEL(0x25), + X86_MATCH_VFM(INTEL_NEHALEM_EP, NULL), + X86_MATCH_VFM(INTEL_NEHALEM, NULL), + X86_MATCH_VFM(INTEL_NEHALEM_G, NULL), + X86_MATCH_VFM(INTEL_WESTMERE, NULL), + X86_MATCH_VFM(INTEL_WESTMERE_EP, NULL), { } }; =20 @@ -405,29 +401,30 @@ static void probe_c3_errata(const struct cpuinfo_x86 = *c) } } =20 -/* - * APL30: One use of the MONITOR/MWAIT instruction pair is to allow a logi= cal - * processor to wait in a sleep state until a store to the armed address r= ange - * occurs. Due to this erratum, stores to the armed address range may not - * trigger MWAIT to resume execution. - * - * ICX143: Under complex microarchitectural conditions, a monitor that is = armed - * with the MWAIT instruction may not be triggered, leading to a processor - * hang. - * - * LNL030: Problem P-cores may not exit power state Core C6 on monitor hit. - * - * Force the sending of an IPI in those cases. - */ static void __init probe_mwait_errata(void) { static const struct x86_cpu_id __initconst models[] =3D { - INTEL_FAM6_MODEL(INTEL_FAM6_ATOM_GOLDMONT), /* APL30 */ - INTEL_FAM6_MODEL(INTEL_FAM6_ICELAKE_X), /* ICX143 */ - INTEL_FAM6_MODEL(INTEL_FAM6_LUNARLAKE_M), /* LNL030 */ + /* + * APL30: One use of the MONITOR/MWAIT instruction pair is to allo= w a + * logical processor to wait in a sleep state until a store to the + * armed address range occurs. Due to this erratum, stores to the + * armed address range may not trigger MWAIT to resume execution. + */ + X86_MATCH_VFM(INTEL_ATOM_GOLDMONT, NULL), + + /* + * ICX143: Under complex microarchitectural conditions, a monitor = that + * is armed with the MWAIT instruction may not be triggered, leadi= ng + * to a processor hang. + */ + X86_MATCH_VFM(INTEL_ICELAKE_X, NULL), + + /* + * LNL030: P-cores may not exit power state Core C6 on monitor hit. + */ + X86_MATCH_VFM(INTEL_LUNARLAKE_M, NULL), { } }; -#undef INTEL_FAM6_MODEL =20 if ( boot_cpu_has(X86_FEATURE_MONITOR) && x86_match_cpu(models) ) { --=20 2.39.5 From nobody Thu Oct 30 22:51:10 2025 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=1752687134; cv=none; d=zohomail.com; s=zohoarc; b=G7I2pCD0KR+HY1K0DrUgOBENOj657AG9tZ8QbaVIao45QX50mvwqVLhXUJOvxa8/4HQ5/SKGWu909FiurSEiWfrNG7ycHtnRuiLrsiWhGK8zC01GmJD2HfoKDCetq2oLV0hbAaOEMGxqFehiMPtOiP2msJMUAsTn7uVsW+5+VAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752687134; 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=hKAPvis3UQ2b1oSSC4VWDVhBOhANhWsodZ/HjXmcnzE=; b=H8T1B4e5S+097JOA0KFuB81zE4cvywbR/aGod2ARnGbtq9qiIflyeBUPYssmYEAoPl494faQCHYf1HB+Da7aNaLZYqQ/GNTk7ajP10HZKSxEVKw6oFlrk22GdK4Hcx5Tm7eDmzDwJp0O7exPMtV155dp3B9KbhghzRtNtTAFdaI= 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 1752687133953546.4856711147573; Wed, 16 Jul 2025 10:32:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1045522.1415687 (Exim 4.92) (envelope-from ) id 1uc5yp-0003jj-VF; Wed, 16 Jul 2025 17:31:43 +0000 Received: by outflank-mailman (output) from mailman id 1045522.1415687; Wed, 16 Jul 2025 17:31:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uc5yp-0003ih-Nx; Wed, 16 Jul 2025 17:31:43 +0000 Received: by outflank-mailman (input) for mailman id 1045522; Wed, 16 Jul 2025 17:31:42 +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 1uc5yo-00030y-S6 for xen-devel@lists.xenproject.org; Wed, 16 Jul 2025 17:31:42 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bc276d58-626a-11f0-b894-0df219b8e170; Wed, 16 Jul 2025 19:31:41 +0200 (CEST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3a536ecbf6fso66805f8f.2 for ; Wed, 16 Jul 2025 10:31:41 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e7f2e68sm27048625e9.1.2025.07.16.10.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jul 2025 10:31:39 -0700 (PDT) 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: bc276d58-626a-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1752687100; x=1753291900; 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=hKAPvis3UQ2b1oSSC4VWDVhBOhANhWsodZ/HjXmcnzE=; b=hQihdnzrgbHMsFDiERSDFRjaWq5jWEi5KF0E1xPn1PGGUUiVgYEOmg6DOEjy9Xyr3C l2rs0NHppw0WgRmHLHvgI45FvdG67Hju8QC+y77TKR+PnbXaLQchRYjk8bcWdvCoEIpA H/R7KQedOqFv3b8Z21hJKMWaJdiodkyVzdHIY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752687100; x=1753291900; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hKAPvis3UQ2b1oSSC4VWDVhBOhANhWsodZ/HjXmcnzE=; b=o1NR1AEVlcPOvLHv5kkeIi2eemSok277gYMJKlIKJWgtlnPK0cWGwsOJTFm1KKPWLh +Y8VKUM+tii+1dD6LsBqf8S0RDFXfDds+CmG91geHy7hiT50KBunjf5bj3AzCe11ddiJ ohZxq9P6l7qu8n1ivUH1lEquOmHegOvAOl56YsnRardaHa7tg5R5KQ+2TEYiLbYOIMHd M9CZPyje4DOAKHOhmkFUxziVCZ7NB49R729ElEbKFkw6CPjyFYTTivk0N/1pAlmT6NSf hEsq0ITwB+73PkQ7p6n1yhnofuGD23bKIAchi7YI6eWBpOSKC2G2SnxlyugCtwDcwfWk N39w== X-Gm-Message-State: AOJu0YwVC/qEjWggaJpieQmbDwnMc5OcZY+vbm213hFLV/sLLU+ZuVT1 D1pitmxLAKkGvILUSNlIHfrHdQqjdi0cy7jGAvQfne83s1+4LmrBNlFtHXp5BnwxXSLWp2LmsGw 9zXgtSKVwgw== X-Gm-Gg: ASbGnctTbtlTnq2KTWWh5kimdkcJqGaWVPPTCwNa9SV0vyFVErdGCWr2fE8NZej778t T7xcbuIASN9bY0+dWVp2yRhNbBmYYshKvuEXL0w98QcG9w7/A6jK6Y81hLmWuzP+9hJREkIMhAH U8pVwazvkGV7RuOAhi9lbuiWkIUBQZWvLnNbH24CIMAhS9XUYxgv18zFsboO1LGBgxggexMLtRU iVjqSsB06dcnEOEwtpYh4MmLh67CVhC2LIgF/hgaNdcOHQEmbGrtz8CQb/kbi4lmwwRCpqrvlHp f0VV9eRolffHpdHhHy7gSp9qEk4qZENyJhlerv5gkIUYYdiXuaQ+clFY0MiltoY/hpTdS0fgim8 ssmj9L2geKhUYSezAk4OU7vYVf59J7xGrWMO4FfgMD40UD+oxIu0eUNSV009p91Up7rVtmxu69L m+XLAS/pdQbYM= X-Google-Smtp-Source: AGHT+IGuOUFb9On/HRhWgVEKTJCn+qFOiFKnj7/mEmRrFFTdg2Tjsv8eOlpKNj8dkRdwsq90mMvWEA== X-Received: by 2002:a05:6000:1883:b0:3a5:2653:7308 with SMTP id ffacd0b85a97d-3b60dd8e7f7mr4101040f8f.57.1752687100452; Wed, 16 Jul 2025 10:31:40 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 5/6] x86/match-cpu: Support matching on steppings Date: Wed, 16 Jul 2025 18:31:31 +0100 Message-Id: <20250716173132.2213891-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250716173132.2213891-1-andrew.cooper3@citrix.com> References: <20250716173132.2213891-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: 1752687135543116600 Architecturally, stepping is a 4-bit field, so a uint16_t suffices for a bitmap of steppings. In order to keep the size of struct x86_cpu_id the same, shrink the vendor = and family fields, neither of which need to be uint16_t in Xen. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 Linux supports all fields being optional. This has lead to using X86_MATCH_CPU(ANY, ANY, ANY, ANY, FEATURE_FOO, NULL) in place of boot_cpu_has(), and is not a construct I think we want to encorage. --- xen/arch/x86/cpu/common.c | 4 +++- xen/arch/x86/include/asm/match-cpu.h | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index cc004fc976f5..fc25935d3109 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -1003,13 +1003,15 @@ const struct x86_cpu_id *x86_match_cpu(const struct= x86_cpu_id table[]) const struct x86_cpu_id *m; const struct cpuinfo_x86 *c =3D &boot_cpu_data; =20 - for (m =3D table; m->vendor | m->family | m->model | m->feature; m++) { + for (m =3D table; m->vendor | m->family | m->model | m->steppings | m->fe= ature; m++) { if (c->x86_vendor !=3D m->vendor) continue; if (c->x86 !=3D m->family) continue; if (c->x86_model !=3D m->model) continue; + if (m->steppings && !(m->steppings & (1U << c->stepping))) + continue; if (!cpu_has(c, m->feature)) continue; return m; diff --git a/xen/arch/x86/include/asm/match-cpu.h b/xen/arch/x86/include/as= m/match-cpu.h index dcdc50a70d14..3862e766ccfc 100644 --- a/xen/arch/x86/include/asm/match-cpu.h +++ b/xen/arch/x86/include/asm/match-cpu.h @@ -8,28 +8,32 @@ #include #include =20 +#define X86_STEPPINGS_ANY 0 #define X86_FEATURE_ANY X86_FEATURE_LM =20 struct x86_cpu_id { - uint16_t vendor; - uint16_t family; + uint8_t vendor; + uint8_t family; uint16_t model; + uint16_t steppings; /* Stepping bitmap, or X86_STEPPINGS_ANY */ uint16_t feature; /* X86_FEATURE_*, or X86_FEATURE_ANY */ const void *driver_data; }; =20 -#define X86_MATCH_CPU(v, f, m, feat, data) \ +#define X86_MATCH_CPU(v, f, m, steps, feat, data) \ { \ .vendor =3D (v), \ .family =3D (f), \ .model =3D (m), \ + .steppings =3D (steps), \ .feature =3D (feat), \ .driver_data =3D (const void *)(unsigned long)(data), \ } =20 #define X86_MATCH_VFM(vfm, data) \ X86_MATCH_CPU(VFM_VENDOR(vfm), VFM_FAMILY(vfm), \ - VFM_MODEL(vfm), X86_FEATURE_ANY, data) + VFM_MODEL(vfm), X86_STEPPINGS_ANY, \ + X86_FEATURE_ANY, data) =20 /* * x86_match_cpu() - match the CPU against an array of x86_cpu_ids[] --=20 2.39.5 From nobody Thu Oct 30 22:51:10 2025 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=1752687132; cv=none; d=zohomail.com; s=zohoarc; b=KD3nipiDNp8RJPm2whh2rRO8vSU1nD9NicDb2G0q+dsRHjAj0LDRzgnN2Q1YsvpzPNSkMfeR31KPA9G5RH4iwcYgIx3H97pKUubv4tXModchyQSBm9EU71Qy2aPmJETanYnHg7j+S1fzmZVv3n1eNRBnSDUPuIOpMLXNU6tLYA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752687132; 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=LCdmRIQ27rwgE2yCA9bmvyBIJOmpFRV7SefCKLOpp1c=; b=P5cRdnaN91FA7LIwPUg6T8VxwdI8MCWVzgKdt7rEpHuMQpUs1M5DphcQi2ru3f3oxuo3h9i0oQF/1q19gExmUh6bvaJ0Vp0e54t7L2gL/Pb7MPyywQI0y8rMdJvleogRwQ6xXwx83N6PkkuwcLGihwP/jS3EPySVq57VhUmwNdc= 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 175268713232215.66683916176487; Wed, 16 Jul 2025 10:32:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1045523.1415701 (Exim 4.92) (envelope-from ) id 1uc5yr-0004AH-AF; Wed, 16 Jul 2025 17:31:45 +0000 Received: by outflank-mailman (output) from mailman id 1045523.1415701; Wed, 16 Jul 2025 17:31:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uc5yr-00049L-5h; Wed, 16 Jul 2025 17:31:45 +0000 Received: by outflank-mailman (input) for mailman id 1045523; Wed, 16 Jul 2025 17:31:44 +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 1uc5yp-00030y-Tu for xen-devel@lists.xenproject.org; Wed, 16 Jul 2025 17:31:43 +0000 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [2a00:1450:4864:20::335]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bcbb50ef-626a-11f0-b894-0df219b8e170; Wed, 16 Jul 2025 19:31:42 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-451d41e1ad1so557875e9.1 for ; Wed, 16 Jul 2025 10:31:42 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e7f2e68sm27048625e9.1.2025.07.16.10.31.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jul 2025 10:31:40 -0700 (PDT) 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: bcbb50ef-626a-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1752687101; x=1753291901; 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=LCdmRIQ27rwgE2yCA9bmvyBIJOmpFRV7SefCKLOpp1c=; b=Ln0z75RIQZ1E8bmFL54eF8lrG+LnC3QdB8/6QkcXXx38ttbAMlCbaBJV4HncJ3D4CE WHHv2fYcSp6s8VxgFFraDcwB02gb1NLkdvrz+tMnV/E+EHs2O6RKK45SWghcKfiTkm6t m8w1QEy4cHpbq/73Gso0r71uVYF8TOPk+Q8+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752687101; x=1753291901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LCdmRIQ27rwgE2yCA9bmvyBIJOmpFRV7SefCKLOpp1c=; b=n1++AhWn/jP3oZpcLZvQTXosoWqt899/7SnUY4ZLXImUlz2WzJcw40BmllDsBukhoJ 3LjIl+GLSBRdZHJ6Cryn5pTHfg0vagOb73qiywAq4VI8mdQxX7VjfVvgGz0AgS+cZHN4 j9B11stkPCCd+J8HAxzv4P7yOISC/7LtG9mR6gZs0l4hNI0pGXMyTOFkDhnUdUPBn4rM Cako/vMkWizFdt3K3HyQfR4huJy/aNLxwFH5Wxwmf28XzgK6aYTXoM6MfA66ACviGGYg /UDEqZ73EdRBSdDwpdQbejkriiI4P73i6xhJNLJLb+Yq0gVwHIrkiHwqpnhCa6OsqKnM 4pZw== X-Gm-Message-State: AOJu0Yx/tuwBcSuXznl0GuT8d3FtefXNiPjZ2Fj5z64msi5Z9OVWKcOm 811fE40qFlhwxYsVMw+oYxfU8pDK99DJ/XPRIJesL95VPZFgCRoZ5WYAGtUcgnAPjmNPEl2azOy yObXEqsHivQ== X-Gm-Gg: ASbGnct4T3o7yTdC07gRCjn9OZHG9s0VuX/88YvryTveJYtBLRjH+l5OI3zl4wybRLC idlMTIOIdKB1ry8ab3so/+jQTmdFl8XtylvMxB0xid7wdCceFL6wIiMhpscH9iSLxR2LZ77+k6Y wu7h4ofei5IfCoqyMuDiN6Id3VnDivpl6YTnYymyZlEkN8HEVJinwjCSJcQIQYtQvKkQ8giw54a 2A3t0JMT9vy7gl1F6uhG2gdG1h9sMxhguFsVyQNvvufEBannBObeaXiLzAPvXQgiAYCBM2p3aI3 enV40kphKdiTUkTl7e9wNfOqYbKaquXNgoo4b24X4Sv7WHX39fkG0LvvMCU1HgcZ1pMpaDP34BV 8a0ZbFQwBulw+Sh2XPd0f3bme381SdCRPq1rHzZWpXZQAPtYJGMLFJKmShkqdUqeyGK7CH94ahG zf X-Google-Smtp-Source: AGHT+IEG58dhEhZvnXvn8P7XJ4Ia6N+uuMUqPSmCPFS+5ao3mhFWC8kyh0y+xvyOS8aJcQXH8hEdqw== X-Received: by 2002:a05:600c:450f:b0:455:fab4:4b80 with SMTP id 5b1f17b1804b1-4562e275cd0mr37034325e9.19.1752687101375; Wed, 16 Jul 2025 10:31:41 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 6/6] x86/apic: Convert the TSC deadline errata table to X86_MATCH_*() Date: Wed, 16 Jul 2025 18:31:32 +0100 Message-Id: <20250716173132.2213891-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250716173132.2213891-1-andrew.cooper3@citrix.com> References: <20250716173132.2213891-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: 1752687133609116600 With the ability to match on steppings, introduce a new X86_MATCH_VFMS() helper to match a specific stepping, and use it to rework deadline_match[]. Notably this removes the overloading of driver_data possibly being a functi= on pointer, and removes the latent bug where the target functions are missing ENDBR instructions owing to the lack of the cf_check attribute. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 The bloat-o-meter summary shows that the use of functions really wasn't the wisest idea: add/remove: 0/3 grow/shrink: 1/2 up/down: 80/-146 (-66) Function old new delta deadline_match 224 304 +80 APIC_init_uniprocessor 334 331 -3 skx_deadline_rev 30 - -30 CSWTCH 335 299 -36 hsx_deadline_rev 38 - -38 bdx_deadline_rev 39 - -39 --- xen/arch/x86/apic.c | 79 +++++++--------------------- xen/arch/x86/include/asm/match-cpu.h | 5 ++ 2 files changed, 25 insertions(+), 59 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index c4272ab4de4f..744124185189 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1051,64 +1051,32 @@ static void setup_APIC_timer(void) local_irq_restore(flags); } =20 -#define DEADLINE_MODEL_MATCH(m, fr) \ - { .vendor =3D X86_VENDOR_INTEL, .family =3D 6, .model =3D (m), \ - .feature =3D X86_FEATURE_TSC_DEADLINE, \ - .driver_data =3D (void *)(unsigned long)(fr) } +static const struct x86_cpu_id __initconst deadline_match[] =3D { + X86_MATCH_VFMS(INTEL_HASWELL_X, 0x2, 0x3a), /* EP */ + X86_MATCH_VFMS(INTEL_HASWELL_X, 0x4, 0x0f), /* EX */ =20 -static unsigned int __init hsx_deadline_rev(void) -{ - switch ( boot_cpu_data.x86_mask ) - { - case 0x02: return 0x3a; /* EP */ - case 0x04: return 0x0f; /* EX */ - } + X86_MATCH_VFM (INTEL_BROADWELL_X, 0x0b000020), =20 - return ~0U; -} + X86_MATCH_VFMS(INTEL_BROADWELL_D, 0x2, 0x00000011), + X86_MATCH_VFMS(INTEL_BROADWELL_D, 0x3, 0x0700000e), + X86_MATCH_VFMS(INTEL_BROADWELL_D, 0x4, 0x0f00000c), + X86_MATCH_VFMS(INTEL_BROADWELL_D, 0x5, 0x0e000003), =20 -static unsigned int __init bdx_deadline_rev(void) -{ - switch ( boot_cpu_data.x86_mask ) - { - case 0x02: return 0x00000011; - case 0x03: return 0x0700000e; - case 0x04: return 0x0f00000c; - case 0x05: return 0x0e000003; - } + X86_MATCH_VFMS(INTEL_SKYLAKE_X, 0x3, 0x01000136), + X86_MATCH_VFMS(INTEL_SKYLAKE_X, 0x4, 0x02000014), =20 - return ~0U; -} + X86_MATCH_VFM (INTEL_HASWELL, 0x22), + X86_MATCH_VFM (INTEL_HASWELL_L, 0x20), + X86_MATCH_VFM (INTEL_HASWELL_G, 0x17), =20 -static unsigned int __init skx_deadline_rev(void) -{ - switch ( boot_cpu_data.x86_mask ) - { - case 0x00 ... 0x02: return ~0U; - case 0x03: return 0x01000136; - case 0x04: return 0x02000014; - } - - return 0; -} - -static const struct x86_cpu_id __initconstrel deadline_match[] =3D { - DEADLINE_MODEL_MATCH(0x3c, 0x22), /* Haswell */ - DEADLINE_MODEL_MATCH(0x3f, hsx_deadline_rev), /* Haswell EP/EX */ - DEADLINE_MODEL_MATCH(0x45, 0x20), /* Haswell D */ - DEADLINE_MODEL_MATCH(0x46, 0x17), /* Haswell H */ + X86_MATCH_VFM (INTEL_BROADWELL, 0x25), + X86_MATCH_VFM (INTEL_BROADWELL_G, 0x17), =20 - DEADLINE_MODEL_MATCH(0x3d, 0x25), /* Broadwell */ - DEADLINE_MODEL_MATCH(0x47, 0x17), /* Broadwell H */ - DEADLINE_MODEL_MATCH(0x4f, 0x0b000020), /* Broadwell EP/EX */ - DEADLINE_MODEL_MATCH(0x56, bdx_deadline_rev), /* Broadwell D */ + X86_MATCH_VFM (INTEL_SKYLAKE_L, 0xb2), + X86_MATCH_VFM (INTEL_SKYLAKE, 0xb2), =20 - DEADLINE_MODEL_MATCH(0x4e, 0xb2), /* Skylake M */ - DEADLINE_MODEL_MATCH(0x55, skx_deadline_rev), /* Skylake X */ - DEADLINE_MODEL_MATCH(0x5e, 0xb2), /* Skylake D */ - - DEADLINE_MODEL_MATCH(0x8e, 0x52), /* Kabylake M */ - DEADLINE_MODEL_MATCH(0x9e, 0x52), /* Kabylake D */ + X86_MATCH_VFM (INTEL_KABYLAKE_L, 0x52), + X86_MATCH_VFM (INTEL_KABYLAKE, 0x52), =20 {} }; @@ -1125,14 +1093,7 @@ static void __init check_deadline_errata(void) if ( !m ) return; =20 - /* - * Function pointers will have the MSB set due to address layout, - * immediate revisions will not. - */ - if ( (long)m->driver_data < 0 ) - rev =3D ((unsigned int (*)(void))(m->driver_data))(); - else - rev =3D (unsigned long)m->driver_data; + rev =3D (unsigned long)m->driver_data; =20 if ( this_cpu(cpu_sig).rev >=3D rev ) return; diff --git a/xen/arch/x86/include/asm/match-cpu.h b/xen/arch/x86/include/as= m/match-cpu.h index 3862e766ccfc..b491232c351f 100644 --- a/xen/arch/x86/include/asm/match-cpu.h +++ b/xen/arch/x86/include/asm/match-cpu.h @@ -35,6 +35,11 @@ struct x86_cpu_id { VFM_MODEL(vfm), X86_STEPPINGS_ANY, \ X86_FEATURE_ANY, data) =20 +#define X86_MATCH_VFMS(vfm, stepping, data) \ + X86_MATCH_CPU(VFM_VENDOR(vfm), VFM_FAMILY(vfm), \ + VFM_MODEL(vfm), 1U << (stepping), \ + X86_FEATURE_ANY, data) + /* * x86_match_cpu() - match the CPU against an array of x86_cpu_ids[] * --=20 2.39.5