From nobody Sat Sep 26 22:16:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1789646131; cv=pass; d=zohomail.com; s=zohoarc; b=HqNBFT/dSJdH/s9MkwcLziKid3yswSWqxxJyKT1JctzKxUSh9ADvgWpNYNKyThEsS+ym3T+C+PxNEYunLIqICG7z72zG0062x9WIDZPw9Ruuz0gBMQInJURZSMbweYNfiEJnPjueUvbc1gG6zFlm4To0dYqBn+ixmKk235iHJlY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789646131; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RF+6TjHLTASDJ2k4snq/t4XokJGES40bhmPzulxd2JY=; b=mqZ0+taqmvqAI7lqTE/GijleYvmKiOEKV5+gE03vas5PnHYCMC38lQixCza90KvdLyD8NC+QMc2awH6AjyAWEAQE0OGlvpPNHV1s20lAlDgbkKCzNUMAwa6+Nq2luxWe0iO59MREB5ApqlhIIlbxEEPvdfm87OMOh4ahksrTSQE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789646131045556.8582099703407; Thu, 17 Sep 2026 04:55:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7Aha-0000rj-3y; Thu, 17 Sep 2026 07:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x756X-0007ak-48 for qemu-devel@nongnu.org; Thu, 17 Sep 2026 01:56:17 -0400 Received: from mail-westusazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c000::1] helo=BYAPR05CU005.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x756V-0007Zw-AL for qemu-devel@nongnu.org; Thu, 17 Sep 2026 01:56:16 -0400 Received: from CH0PR03CA0256.namprd03.prod.outlook.com (2603:10b6:610:e5::21) by DS0PR12MB6630.namprd12.prod.outlook.com (2603:10b6:8:d2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.9; Thu, 17 Sep 2026 05:54:39 +0000 Received: from LV8PEPF00000060.namprd02.prod.outlook.com (2603:10b6:610:e5:cafe::98) by CH0PR03CA0256.outlook.office365.com (2603:10b6:610:e5::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.11 via Frontend Transport; Thu, 17 Sep 2026 05:54:38 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by LV8PEPF00000060.mail.protection.outlook.com (10.167.245.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Thu, 17 Sep 2026 05:54:38 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Thu, 17 Sep 2026 00:54:37 -0500 Received: from localhost.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49 via Frontend Transport; Thu, 17 Sep 2026 00:54:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cs2HNuBL3c6dVcZ2/X8Vy4fwRWdtZ0JVb5Szmam/IzOaLGfZt+z/hoRcfKjDGr24+9c0pzs0hge5ELIMMTg3+rUPCK5l8DqVDNuzVOINCO0KfOzENz/2u5Lwc5ojgOPKdVrmSQvQWdXeb2iOMygmnO1lUHocFqk+5VW9euEldZvERe2l0IycSUcASdI9RHynj//t8pXwy5eYCB+YPkyAa8uCp56Be39uPjIHUzmtZs5CPIMCi8VsfCFGbbyFPqlBuISsb552/umPCLiGbLatqOE8t97Mr7FzmYwycWpROaLWY0nR4hH5QkduNe0OmIBMYPNCweqxi52wCMGDsvAgJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RF+6TjHLTASDJ2k4snq/t4XokJGES40bhmPzulxd2JY=; b=D9GSCX3v4FpPMMgWSvFb5lRtnOvNK7VjgZGOVFNDeaVbIqvcH3WLRe6NtzjeTPmKsWKNv/L2d/u9tr+hWePXTwqs3qXV3y735s32y3Us/BE7InfyiGD9B8QbHNSY/3YQOYk8N1jF1vzv/VpPtNImSZTx4+Hj5A+2OQLpTpesjGpJs4pRLkQzvmbCVEOA2ctZT7egZnqJC2QOvWOhna4jk843dv1xyjYCUbkujW7j4iVxXV6Y02a84HZ9aKstkq1cgVzyaF02GThC+80RmkzOAyKzDBS1vCnmhtOKe8YGsf70JtpJfniGS25096y5CAfclg2ayVXCiQTKsUvu2X9hIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RF+6TjHLTASDJ2k4snq/t4XokJGES40bhmPzulxd2JY=; b=AIzLWJ0ToNQe4+OqshOYC/vy43vaEMAHey+ofmMI+ni91gTbk0LX9q/M6oJ6y7T/Lti4woTNgssfuQKPduvNhiwSe846JQZmlkVCqFsYIVKZyD+EC02e63laVSE4Fmu7ohLrssc/8exBfW6lZIkNRzlZbraiTQXuFwwh5bB5C3w= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Baorui.Liu To: CC: "Michael S . Tsirkin" , Meng Zhang , Baorui.Liu Subject: [RFC PATCH 1/3] standard-headers: add experimental VIRTIO_ID_CPUFREQ Date: Thu, 17 Sep 2026 13:54:15 +0800 Message-ID: <20260917055417.495-2-baorliu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260917055417.495-1-baorliu@amd.com> References: <20260917055417.495-1-baorliu@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV8PEPF00000060:EE_|DS0PR12MB6630:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f52465c-18e3-424e-e3da-08df148028f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700016|376014|82310400026|1800799024|23010399003|10067099003|11063799006|56012099006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: n5Qz7Sh1ROPRwwHYnDd9hNc9+wsev6sv2y7HbaJgBQoOBFVh2xP+aNOjUu6ldm8wsKo3vkaTU73x/PWkZkH27OMaKyy8BR84nObbiVe6gxXgaBb761xhhVPq0B8p7jgW7JwsJcZx4VfzndNIKNRmbE1TesSb6YWVzCYzc2kc9ynwLmNgpIp73OItZLTMdYIKB1/2oPk+9qA4RDBEIxFwOZlQKu6zVvPTNKm4fkKKT4E+xc+2FO3znVYIFr6MyyyxxrD83VmebBKZ3SessfRkdUWvf81xnUHE3uNl6GbyJam7OzRBqHRrruef3clqxffNcSo5ff85djyTbxj0878vKUJteaAUlBckqKeusjMVHyIUQGms9jja/5StM3HVlV/TQ3aY9B75/WmusDrxziv+clP86wWCNVgpWJaQlXSxiQUiqDioodBf6Deq+njYz2rcMCqVkFx+r9ABto61CUUjmJcWqYAv94sHAFC3HyFctB/wWQ6XiV2IR5q9Jt31Wkua/ngwUkmk7+9qZmGYRgF35Mu9w5sV0nlw7WtG8vWu5RqP+a8WU0mDSS/RNwT9ZYffMkNOyEMlUASfPxkb+M80pt6tNIXoBc4nrdGtgEW1ghhM0u9D0QSe5VVbqck9WYFlSc1w0wUSYl6XO72I/5zZ4YulnjVN3f1eNnV+tJ/dldK/T7aRc49t3D7J83DaCQH/+WAHA8g5Kll2Yx17+DVUzQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700016)(376014)(82310400026)(1800799024)(23010399003)(10067099003)(11063799006)(56012099006)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rw7O6jyLwTu40xgeYrw1H0oOdHYL2olg7M1XvAuX/xnl7UHyGArAwxHASFMNneTo6mYXa1dhAbwSIliMrh0aST+UnMDNZtfCUsinjrs3Atvfmp9ycKy4X95q/9xTwMWejOQ7gPLLrwH/0dQ5SEPsl+63G/MxzAxppQIXsRf57AKIejWONrOWXHqmqOHFvZ0Z8W99vrpz2yBTmI/hmclF/HvHiSmKATeldAFnMT9IEBYm0D/GQ9DXOGf5vnQFgIOH0m2oE/J3/x2UqzC0FQHnONW52jV5XFX2VAb7OG8oen23ILfEdrsuEoeNCcaRSPaBiPBJNuUmNJvY/w2dqyd22OuwXGBOu7qWOwXxjf88qeec2me1Mp1BMD6/MrJfWcy0c5iCFRDQVASJvgxHFOoKBig13siCfz95edf97QL0rb6sV1Gps51ibDQH3LsVyzIp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2026 05:54:38.4780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f52465c-18e3-424e-e3da-08df148028f1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: LV8PEPF00000060.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6630 Received-SPF: permerror client-ip=2a01:111:f403:c000::1; envelope-from=Baorui.Liu@amd.com; helo=BYAPR05CU005.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 17 Sep 2026 07:54:51 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1789646132167158500 Content-Type: text/plain; charset="utf-8" Virtio device ID 42 is not yet assigned by the virtio specification or Linux. Define it locally so the Xen virtio-cpufreq backend can match the guest frontend. This is not generated by scripts/update-linux-headers.sh. Signed-off-by: Meng Zhang Signed-off-by: Baorui.Liu --- include/standard-headers/linux/virtio_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/standard-headers/linux/virtio_ids.h b/include/standard= -headers/linux/virtio_ids.h index f9056af0c6..dde5a1914f 100644 --- a/include/standard-headers/linux/virtio_ids.h +++ b/include/standard-headers/linux/virtio_ids.h @@ -68,6 +68,7 @@ #define VIRTIO_ID_AUDIO_POLICY 39 /* virtio audio policy */ #define VIRTIO_ID_BT 40 /* virtio bluetooth */ #define VIRTIO_ID_GPIO 41 /* virtio gpio */ +#define VIRTIO_ID_CPUFREQ 42 /* virtio cpufreq (experimental) */ #define VIRTIO_ID_SPI 45 /* virtio spi */ #define VIRTIO_ID_MEDIA 48 /* virtio media */ =20 --=20 2.34.1 From nobody Sat Sep 26 22:16:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1789646132; cv=pass; d=zohomail.com; s=zohoarc; b=e9HDjorI8zOPgxWWrwBkWPvNPurIVXDca1grybSuDm320RuahHX30Xapgv0i1p94nLEqo6UQvUUJ8Cm2l7HRFMAbsKIWmmKZaIuYINX74H/8Jc7LVYqOaIiURIWOF3xWr9/fFsSAq+L+eYgZFoAj5250AzpyOMilGfmt/Al9uKs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789646132; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=czxnWPTYJwsfmcJ6GNrtlMuo01bSQg+xJY+kDpE9OrQ=; b=mqtxwlP8y7extNYFKqIoZ9RkFTYMiH2QHn2RUfhdFCD75BzUIge+gb27xgeJgZvu6pXiDWKNQP+VELZUlghC2dyZ/gonN7S6SxU6cFxI9ebI3y9FuFtrBinHvi5PTDrLPB9ptc67CiDe88uJXrtqw5kv6pLuDZo1qg/hrlBIhbg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789646132794780.1878555953094; Thu, 17 Sep 2026 04:55:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7AhZ-0000qo-FW; Thu, 17 Sep 2026 07:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x755I-0007Oe-BD for qemu-devel@nongnu.org; Thu, 17 Sep 2026 01:55:01 -0400 Received: from mail-northcentralusazlp170130007.outbound.protection.outlook.com ([2a01:111:f403:c105::7] helo=CH4PR04CU002.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x755E-0007IT-N5 for qemu-devel@nongnu.org; Thu, 17 Sep 2026 01:55:00 -0400 Received: from CH0PR03CA0265.namprd03.prod.outlook.com (2603:10b6:610:e5::30) by SN7PR12MB7274.namprd12.prod.outlook.com (2603:10b6:806:2ad::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.12; Thu, 17 Sep 2026 05:54:50 +0000 Received: from LV8PEPF00000060.namprd02.prod.outlook.com (2603:10b6:610:e5:cafe::45) by CH0PR03CA0265.outlook.office365.com (2603:10b6:610:e5::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.11 via Frontend Transport; Thu, 17 Sep 2026 05:54:50 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by LV8PEPF00000060.mail.protection.outlook.com (10.167.245.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Thu, 17 Sep 2026 05:54:50 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Thu, 17 Sep 2026 00:54:49 -0500 Received: from localhost.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49 via Frontend Transport; Thu, 17 Sep 2026 00:54:48 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ioqb7X6HDIvBqgHnndvbHNCz4kUFdQI2KyoRK+CBt34ULmnmQTfNa8BFxVgcM3GSxMrVOTIwvD1jLUzfdm1/+h2QABQ3kFcpxiwcURvrs3fXhExdWC+P06/En1FkfS+1eGzWl0VHfX49+nN3HKFwIPSlZ9XJEpyLAJbWYExWdVax6l12+W5KQEMiERfKqC6JsXCcjL7FCE7H1ouFNG51FZMoWKzrkaPwQGLd/xrly5IzAhkC7+SZVJNH+goj1T8950rSdJHn1vYfn6T62y5uZofL/zPY0CF+etcqLvlnRcsa6kup1+MPopBHFNWJNJjjNRSymPRI1pZpZG7GIV3rdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=czxnWPTYJwsfmcJ6GNrtlMuo01bSQg+xJY+kDpE9OrQ=; b=bwYhIayEimqBn0f6Hb31lqM8hNkRHct7ddGENX7uQycx7hKMFIUaerTwrkoi7M8r6SoaE7UGR5jiOOY5Dqksq4F2LjDbIyLQ4zolhTWKsKv2ycpgjgY+MNOfbZex/ki8ke8RkWBFa1sdCdzsdC0VhGa4L6XQYqtLOTyraGEc4VNfl5I/Yr8Tmoe56i+ZyziHi36c5BiaIVsBe+NTsEoImW5HrsMSwK53RbjR+sNATiq5MfqyV3dG8A41WYM+j8FRpIJ+8d9+2XwnnPyXu5xFMVJqLr68ppqlIAZCFCXYzcQRBU+XRRXem9nVTJHDg0UYPO+w8tfg+yqcHil9chqf3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=czxnWPTYJwsfmcJ6GNrtlMuo01bSQg+xJY+kDpE9OrQ=; b=sAAnuGDEwU4vXxrAXRR1/C67cqFaOMfhXuES7mFamayzM0ZON0ZebUCCXnRg2E4nkhxXV9qnHpTPEsreCCN2LUVNXUv7BSliuVkjL87AasM7lm53sjhZVvQ7x8eGP5b7UwU6y/w6Ch69cgtJ6+NMdkX/K9gWxVFeDOj0omU3Tb4= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Baorui.Liu To: CC: "Michael S . Tsirkin" , Meng Zhang , Baorui.Liu Subject: [RFC PATCH 2/3] hw/virtio: add virtio-cpufreq Xen backend Date: Thu, 17 Sep 2026 13:54:16 +0800 Message-ID: <20260917055417.495-3-baorliu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260917055417.495-1-baorliu@amd.com> References: <20260917055417.495-1-baorliu@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV8PEPF00000060:EE_|SN7PR12MB7274:EE_ X-MS-Office365-Filtering-Correlation-Id: 806bcc4d-c564-4e5f-139d-08df14802fd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700016|376014|82310400026|23010399003|1800799024|22082099003|18002099003|10067099003|6133799003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: URjyOs/4Eeb3iyORzAMIycj8GGYF+J1WkbfTH8Pfbb5SuVs35VlbUiXbgJunhB3S2a2GeB1HO9XpcyHWHgBBnLaJw7Whjex5DtSHLLLZYF95n6ofIGZRCr8nOQqnafdEgYIip8+c2Sfco+I+go+ZGg45MjjDnZ8V1cIhooXLfxMLqJgqXRSduG5jN9hYMll6cJann19IsvdWZL+EwS6Q+2yEkl5KHvZJaojRcTCSFu8+3u+6hsqh4laFU/ByWE6AM3aJZxoJLPcBhHGQCNSm6jWk5c4JEVRvmACw6NZIE951KgcZlE4J4AH40aOAbP9jADnUTzLtnrmBVMxECZQq9IY72DaKRG4AoE8JKs6mGObqS5zJfbRSxHu8t0dfWdyqq0VRe3pmpxsZiASto3XMbjY2mO2bs3LqJ8FmnpLns8Oq+S37amox79TOG4+5YFx2dksTSlKy1sNpB4wqjkymEk47y0BJy1xEc7c9k/yNs2OrLR7yvAvDygDK+yuNqrWsUYOSfn9eNZU7sfM+Dh1ypb9K+HoDwwcxmgJPzjaUu8BIM6GufS0g63AW5QeRBt3a4N03uTLlU1NTboGqAAXtIzli/3q5OZ0xLMa4LAErb2DRNgU6rSVhuDmquVOORMx7z2TFBqjSKX1asnIue2CR7vz/GWb108XPAipI6gEmBO4GUwCX32omk0I/zd6YgvZeJ6RTte56V3qErzs8qTRMBA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700016)(376014)(82310400026)(23010399003)(1800799024)(22082099003)(18002099003)(10067099003)(6133799003)(11063799006)(56012099006); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ik9I2538yLNatFWofw968yBV1Utv50m2hPIWsCs/Ll1ofJ9A9Ptq5F05oPNP+GcT+xKaZENu/i+8XFypB5DayHjBon0mfHpBU6lZBompBpbuc/h2k3XB4uYG1K3ck1czR14aRUvpkg56tOzEg1lKhmyktBx5iWEjrFKz5nLZ6j1IrMJbsKvwweD2Idr81KAj+4p5ocMdQauJ7Pdwphy1gWwYjDu89Yla0nwlqnHrpeWTBe/Y6pD2WxtCuCjk0sDQtfAXw95wlsaHNZNFCOW7p0SjINmA4eKKq/EN3Ojn4Rftx8zb46UZClECChLH+a7oq6le9K+RmqIpPWJV0FBQ4i73/lx3csCY6Uz4jvDQNxw+JCOTIfuK0rlqrVCLrnFx41+TfFf10LdKrnvfY17U3dLgECezpCz7O7NtEiRQBV0uGGSkH5xoZHbMmr4qpqUx X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2026 05:54:50.0343 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 806bcc4d-c564-4e5f-139d-08df14802fd5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: LV8PEPF00000060.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7274 Received-SPF: permerror client-ip=2a01:111:f403:c105::7; envelope-from=Baorui.Liu@amd.com; helo=CH4PR04CU002.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 17 Sep 2026 07:54:51 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1789646134226158500 Content-Type: text/plain; charset="utf-8" Report the host pCPU frequency of a pinned Xen vCPU to a guest virtio-cpufreq frontend. Virtio ID 42 is experimental. Based on the qemu-xen device by Meng Zhang. Signed-off-by: Meng Zhang Signed-off-by: Baorui.Liu --- MAINTAINERS | 7 + hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 2 + hw/virtio/virtio-cpufreq-pci.c | 82 ++++++++++ hw/virtio/virtio-cpufreq.c | 242 +++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 3 + hw/virtio/virtio-qmp.c | 1 + hw/virtio/virtio.c | 1 + include/hw/virtio/virtio-cpufreq.h | 23 +++ 9 files changed, 366 insertions(+) create mode 100644 hw/virtio/virtio-cpufreq-pci.c create mode 100644 hw/virtio/virtio-cpufreq.c create mode 100644 include/hw/virtio/virtio-cpufreq.h diff --git a/MAINTAINERS b/MAINTAINERS index 9012bf476d..dc9014c2be 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2702,6 +2702,13 @@ F: hw/virtio/virtio-crypto.c F: hw/virtio/virtio-crypto-pci.c F: include/hw/virtio/virtio-crypto.h =20 +virtio-cpufreq +M: Baorui Liu +S: Maintained +F: hw/virtio/virtio-cpufreq.c +F: hw/virtio/virtio-cpufreq-pci.c +F: include/hw/virtio/virtio-cpufreq.h + virtio based memory device M: David Hildenbrand S: Supported diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig index 91cf833407..b6951f5096 100644 --- a/hw/virtio/Kconfig +++ b/hw/virtio/Kconfig @@ -146,3 +146,8 @@ config VHOST_USER_RTC bool default y depends on VIRTIO && VHOST_USER + +config VIRTIO_CPUFREQ + bool + default y + depends on VIRTIO && XEN diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index b59f455a51..03793e1a7c 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -55,6 +55,7 @@ endif system_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhos= t-user-vsock.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng= .c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_RTC', if_true: files('virtio-rtc= .c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_CPUFREQ', if_true: files('virtio= -cpufreq.c')) =20 system_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio= -balloon.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-u= ser-fs.c')) @@ -79,6 +80,7 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_INPUT_HOST', if_tr= ue: files('virtio-input virtio_pci_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-inpu= t-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng-pc= i.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_RTC', if_true: files('virtio-rtc-pc= i.c')) +virtio_pci_ss.add(when: 'CONFIG_VIRTIO_CPUFREQ', if_true: files('virtio-cp= ufreq-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: [files('virtio-nsm-p= ci.c', 'cbor-helpers.c'), libcbor]) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-ba= lloon-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-9p-pci.= c')) diff --git a/hw/virtio/virtio-cpufreq-pci.c b/hw/virtio/virtio-cpufreq-pci.c new file mode 100644 index 0000000000..b7066d962c --- /dev/null +++ b/hw/virtio/virtio-cpufreq-pci.c @@ -0,0 +1,82 @@ +/* + * Virtio CPU frequency PCI bindings + * + * Copyright (c) 2026 Advanced Micro Devices, Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/virtio/virtio-pci.h" +#include "hw/virtio/virtio-cpufreq.h" +#include "qapi/error.h" +#include "qemu/module.h" +#include "qom/object.h" +#include "standard-headers/linux/virtio_ids.h" + +typedef struct VirtIOCPUFreqPCI VirtIOCPUFreqPCI; + +/* + * virtio-cpufreq-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_CPUFREQ_PCI "virtio-cpufreq-pci-base" +DECLARE_INSTANCE_CHECKER(VirtIOCPUFreqPCI, VIRTIO_CPUFREQ_PCI, + TYPE_VIRTIO_CPUFREQ_PCI) + +struct VirtIOCPUFreqPCI { + VirtIOPCIProxy parent_obj; + VirtIOCPUFreq vdev; +}; + +static void virtio_cpufreq_pci_realize(VirtIOPCIProxy *vpci_dev, Error **e= rrp) +{ + VirtIOCPUFreqPCI *vcpufreq =3D VIRTIO_CPUFREQ_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&vcpufreq->vdev); + + if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) { + return; + } +} + +static void virtio_cpufreq_pci_class_init(ObjectClass *klass, const void *= data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); + PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); + + k->realize =3D virtio_cpufreq_pci_realize; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + /* + * virtio 1.0 PCI device ID is 0x1040 + virtio ID. ID 42 is experiment= al + * and is not yet assigned by the virtio spec. + */ + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_10_BASE + VIRTIO_ID_CPUFR= EQ; + pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; + pcidev_k->class_id =3D PCI_CLASS_OTHERS; +} + +static void virtio_cpufreq_initfn(Object *obj) +{ + VirtIOCPUFreqPCI *dev =3D VIRTIO_CPUFREQ_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_CPUFREQ); +} + +static const VirtioPCIDeviceTypeInfo virtio_cpufreq_pci_info =3D { + .base_name =3D TYPE_VIRTIO_CPUFREQ_PCI, + .generic_name =3D "virtio-cpufreq-pci", + .non_transitional_name =3D "virtio-cpufreq-pci-non-transitional", + .instance_size =3D sizeof(VirtIOCPUFreqPCI), + .instance_init =3D virtio_cpufreq_initfn, + .class_init =3D virtio_cpufreq_pci_class_init, +}; + +static void virtio_cpufreq_pci_register(void) +{ + virtio_pci_types_register(&virtio_cpufreq_pci_info); +} + +type_init(virtio_cpufreq_pci_register) diff --git a/hw/virtio/virtio-cpufreq.c b/hw/virtio/virtio-cpufreq.c new file mode 100644 index 0000000000..c9672c901b --- /dev/null +++ b/hw/virtio/virtio-cpufreq.c @@ -0,0 +1,242 @@ +/* + * Virtio CPU frequency backend + * + * Reports the host pCPU frequency that currently runs a Xen vCPU to a + * guest virtio-cpufreq frontend. + * + * Copyright (c) 2026 Advanced Micro Devices, Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "qemu/iov.h" +#include "qemu/module.h" +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-cpufreq.h" +#include "hw/xen/xen_native.h" +#include "migration/vmstate.h" +#include "standard-headers/linux/virtio_ids.h" + +struct freq_request { + uint32_t cpu_id; /* vCPU ID to query */ + uint32_t freq_khz; /* Returned frequency in kHz */ +} QEMU_PACKED; + +static bool pinning_checked; +static bool pinning_ok; + +/* + * Each guest vCPU must be pinned to a unique pCPU so the reported + * frequency is meaningful. + */ +static bool check_cpu_pinned(void) +{ + uint32_t domid =3D xen_domid; + xc_cpumap_t cpumap_hard; + xc_domaininfo_t info; + int vcpu, pcpu, vcpus_num, pcpus_num; + bool checked_result =3D true; + int *used_pcpu; + + if (!xen_xc) { + error_report("virtio-cpufreq: Xen interface is not available"); + return false; + } + + if (xc_domain_getinfo_single(xen_xc, domid, &info) < 0) { + error_report("virtio-cpufreq: xc_domain_getinfo_single failed"); + return false; + } + + vcpus_num =3D info.max_vcpu_id + 1; + pcpus_num =3D xc_get_max_cpus(xen_xc); + used_pcpu =3D g_new(int, pcpus_num); + + cpumap_hard =3D xc_cpumap_alloc(xen_xc); + if (cpumap_hard =3D=3D NULL) { + g_free(used_pcpu); + return false; + } + + for (pcpu =3D 0; pcpu < pcpus_num; pcpu++) { + used_pcpu[pcpu] =3D -1; + } + + for (vcpu =3D 0; vcpu < vcpus_num; vcpu++) { + int count =3D 0, pinned_pcpu =3D -1; + + memset(cpumap_hard, 0, xc_get_cpumap_size(xen_xc)); + if (xc_vcpu_getaffinity(xen_xc, domid, vcpu, cpumap_hard, + NULL, XEN_VCPUAFFINITY_HARD)) { + error_report("virtio-cpufreq: xc_vcpu_getaffinity failed"); + checked_result =3D false; + break; + } + + for (pcpu =3D 0; pcpu < pcpus_num; pcpu++) { + if (xc_cpumap_testcpu(pcpu, cpumap_hard)) { + count++; + pinned_pcpu =3D pcpu; + } + } + + if (count !=3D 1) { + error_report("virtio-cpufreq: vCPU%d is pinned to %d pCPUs " + "(expected 1)", vcpu, count); + checked_result =3D false; + break; + } + + if (used_pcpu[pinned_pcpu] !=3D -1) { + error_report("virtio-cpufreq: pCPU%d already used by another v= CPU", + pinned_pcpu); + checked_result =3D false; + break; + } + + used_pcpu[pinned_pcpu] =3D vcpu; + } + + free(cpumap_hard); + g_free(used_pcpu); + return checked_result; +} + +static uint32_t get_host_cpu_freq(uint32_t vcpu_id) +{ + uint32_t pcpu_id; + uint32_t domid =3D xen_domid; + int cpufreq; + xc_vcpuinfo_t vcpu_info; + + if (!xen_xc) { + return 0; + } + + if (xc_vcpu_getinfo(xen_xc, domid, vcpu_id, &vcpu_info)) { + error_report("virtio-cpufreq: xc_vcpu_getinfo failed"); + return 0; + } + pcpu_id =3D vcpu_info.cpu; + + if (xc_get_cpufreq_avgfreq(xen_xc, pcpu_id, &cpufreq)) { + error_report("virtio-cpufreq: get freq failed"); + return 0; + } + + return cpufreq; +} + +static void virtio_cpufreq_handle_request(VirtIODevice *vdev, VirtQueue *v= q) +{ + VirtQueueElement *elem; + struct freq_request req; + size_t len; + + elem =3D virtqueue_pop(vq, sizeof(VirtQueueElement)); + if (!elem) { + return; + } + + /* + * out_sg: request (cpu_id) + * in_sg: response (freq_khz) + */ + if (elem->out_num =3D=3D 0 || elem->in_num =3D=3D 0) { + error_report("virtio-cpufreq: invalid buffer configuration"); + virtqueue_push(vq, elem, 0); + virtio_notify(vdev, vq); + g_free(elem); + return; + } + + len =3D iov_to_buf(elem->out_sg, elem->out_num, 0, &req, sizeof(req)); + if (len < sizeof(req)) { + error_report("virtio-cpufreq: invalid request size %zu (expected %= zu)", + len, sizeof(req)); + virtqueue_push(vq, elem, 0); + virtio_notify(vdev, vq); + g_free(elem); + return; + } + + if (!pinning_checked) { + pinning_ok =3D check_cpu_pinned(); + pinning_checked =3D true; + } + + if (!pinning_ok) { + req.freq_khz =3D 0; + } else { + req.freq_khz =3D get_host_cpu_freq(req.cpu_id); + } + + len =3D iov_from_buf(elem->in_sg, elem->in_num, 0, &req, sizeof(req)); + + virtqueue_push(vq, elem, len); + virtio_notify(vdev, vq); + g_free(elem); +} + +static uint64_t virtio_cpufreq_get_features(VirtIODevice *vdev, + uint64_t features, + Error **errp) +{ + return features; +} + +static void virtio_cpufreq_device_realize(DeviceState *dev, Error **errp) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VirtIOCPUFreq *vcpufreq =3D VIRTIO_CPUFREQ(dev); + + virtio_init(vdev, VIRTIO_ID_CPUFREQ, 0); + vcpufreq->vq =3D virtio_add_queue(vdev, 128, virtio_cpufreq_handle_req= uest); +} + +static void virtio_cpufreq_device_unrealize(DeviceState *dev) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + + virtio_del_queue(vdev, 0); + virtio_cleanup(vdev); +} + +static const VMStateDescription vmstate_virtio_cpufreq =3D { + .name =3D "virtio-cpufreq", + .minimum_version_id =3D 1, + .version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_VIRTIO_DEVICE, + VMSTATE_END_OF_LIST() + }, +}; + +static void virtio_cpufreq_class_init(ObjectClass *klass, const void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + + dc->vmsd =3D &vmstate_virtio_cpufreq; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + vdc->realize =3D virtio_cpufreq_device_realize; + vdc->unrealize =3D virtio_cpufreq_device_unrealize; + vdc->get_features =3D virtio_cpufreq_get_features; +} + +static const TypeInfo virtio_cpufreq_info =3D { + .name =3D TYPE_VIRTIO_CPUFREQ, + .parent =3D TYPE_VIRTIO_DEVICE, + .instance_size =3D sizeof(VirtIOCPUFreq), + .class_init =3D virtio_cpufreq_class_init, +}; + +static void virtio_register_types(void) +{ + type_register_static(&virtio_cpufreq_info); +} + +type_init(virtio_register_types) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c73f1f546c..fa677c730a 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -312,6 +312,9 @@ static const VirtIOPCIIDInfo virtio_pci_id_info[] =3D { .vdev_id =3D VIRTIO_ID_RNG, .trans_devid =3D PCI_DEVICE_ID_VIRTIO_RNG, .class_id =3D PCI_CLASS_OTHERS, + }, { + .vdev_id =3D VIRTIO_ID_CPUFREQ, + .class_id =3D PCI_CLASS_OTHERS, }, }; =20 diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c index 5aaeebdd96..c9ef4786b1 100644 --- a/hw/virtio/virtio-qmp.c +++ b/hw/virtio/virtio-qmp.c @@ -643,6 +643,7 @@ VirtioDeviceFeatures *qmp_decode_features(uint16_t devi= ce_id, case VIRTIO_ID_DMABUF: case VIRTIO_ID_PARAM_SERV: case VIRTIO_ID_AUDIO_POLICY: + case VIRTIO_ID_CPUFREQ: break; default: g_assert_not_reached(); diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index c9f9e5b511..5edd7bf766 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -198,6 +198,7 @@ const char *virtio_device_names[] =3D { [VIRTIO_ID_AUDIO_POLICY] =3D "virtio-audio-pol", [VIRTIO_ID_BT] =3D "virtio-bluetooth", [VIRTIO_ID_GPIO] =3D "virtio-gpio", + [VIRTIO_ID_CPUFREQ] =3D "virtio-cpufreq", [VIRTIO_ID_SPI] =3D "virtio-spi", [VIRTIO_ID_MEDIA] =3D "virtio-media", }; diff --git a/include/hw/virtio/virtio-cpufreq.h b/include/hw/virtio/virtio-= cpufreq.h new file mode 100644 index 0000000000..25d151d7e6 --- /dev/null +++ b/include/hw/virtio/virtio-cpufreq.h @@ -0,0 +1,23 @@ +/* + * Virtio CPU frequency backend (Xen) + * + * Copyright (c) 2026 Advanced Micro Devices, Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_VIRTIO_CPUFREQ_H +#define QEMU_VIRTIO_CPUFREQ_H + +#include "hw/virtio/virtio.h" +#include "qom/object.h" + +#define TYPE_VIRTIO_CPUFREQ "virtio-cpufreq-device" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOCPUFreq, VIRTIO_CPUFREQ) + +struct VirtIOCPUFreq { + VirtIODevice parent_obj; + VirtQueue *vq; +}; + +#endif /* QEMU_VIRTIO_CPUFREQ_H */ --=20 2.34.1 From nobody Sat Sep 26 22:16:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1789646112; cv=pass; d=zohomail.com; s=zohoarc; b=FAU/gV9d8G0qDmInWwc6OC5KAi85lmADjJiS+xWhVT5HUIEsVlMewzu4qBpYLcYqIY55GKKEUr8ZGZfFgcOp7ZS1uE5VJsapvMKdjALyW3181yJbmKpLF+x16sjNMu4V6rbxf/gz/Y4yICLnpV3KUbJIKfsmKdhlVCLS30zOcSE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789646112; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vGc6nkLHyDV1D1vmhf4UtYW+sXCOz8V3Rt9ODuzlB9Q=; b=SW6tjEWBxjRFr3tNpak5umkJD9kn5zvRAQJd2YqrLL59nQyoeUfU+hjvY4KY6RLKuy9N/NWISgJ/5npvyRbrL8LQR9urr7LyCtWQEZjoeg09OUvNuXp4Q2xsIOTI+kf2F03wsk+6gUquPyicZKJYxTFz939W3YhH1ag2KlRWyPc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17896461120511002.3756803779013; Thu, 17 Sep 2026 04:55:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7AhY-0000qS-I9; Thu, 17 Sep 2026 07:54:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x755I-0007Od-1a for qemu-devel@nongnu.org; Thu, 17 Sep 2026 01:55:00 -0400 Received: from mail-eastus2azlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c110::3] helo=BN8PR05CU002.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x755G-0007IX-0U for qemu-devel@nongnu.org; Thu, 17 Sep 2026 01:54:59 -0400 Received: from BN9P223CA0009.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::14) by SN7PR12MB7452.namprd12.prod.outlook.com (2603:10b6:806:299::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.12; Thu, 17 Sep 2026 05:54:53 +0000 Received: from LV8PEPF00000059.namprd02.prod.outlook.com (2603:10b6:408:10b:cafe::7) by BN9P223CA0009.outlook.office365.com (2603:10b6:408:10b::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.9 via Frontend Transport; Thu, 17 Sep 2026 05:54:53 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by LV8PEPF00000059.mail.protection.outlook.com (10.167.245.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Thu, 17 Sep 2026 05:54:52 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Thu, 17 Sep 2026 00:54:52 -0500 Received: from localhost.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49 via Frontend Transport; Thu, 17 Sep 2026 00:54:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YMbZUgtPnIUOJFwRwcPI00SATtVOoAc3STMoGYatNlVHLzEhHJW4YWPKqQ0FArmET0qi+1HYXF7tsuPt2o2zf/0bgYsXfOTmBZcnHiY1I+iiamil5pMDye4V41TLEpSlzvaJawSXWdeIqpxAHJnXqM/5ENt+OBxffG8oXt9Tk7uCsHS5vaA8CRhXxpzfPwQd476X+UbTf1omvl3y0oSbEJuJzdFzVq5ybb2VWyNQrBDII8lygFZbPGqczN8keI3G9owgAUBIP0lC6tMx47t4DztXjZQj0qJTDCTTZIPBkOzvg1uWTMLB2ddlrxOF10yiLimpBHftlNbUd+8iLUTQJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vGc6nkLHyDV1D1vmhf4UtYW+sXCOz8V3Rt9ODuzlB9Q=; b=kdWZRsjMjS3133JlApl5w4rBFPWbuLqGmEyLittBLtCQBYuewfLDlZrSM2DFozn+udc02/tvWDpA/XgiOSxqwKYqKWupKWDrY1hzKf9Zd3TZSEKBRtHlguaQsRF82tJs+7MXir6jfHIiIvHJfo+E5vUndXwVTX6KrZfY2ueYw7VjpGwYA6Ej3QNDZAsORGapAYIeCALquB3b+osq2m8AFqGy8NRXml+3hfR10qrS8FoJrHNkliCdfDAPea2d19VB9e+G6b6kpXEZ09bHArTympJWbfcbJanxuPKsy2ZLkVE4v1IW0dSNaJvshE4prARyoOFZx78eqzRhtoKTwkbZBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vGc6nkLHyDV1D1vmhf4UtYW+sXCOz8V3Rt9ODuzlB9Q=; b=vFVxIOfjbg9SqrR5U5tz4MK/ENBa9dh+npe4me2Ek+rxFxNXWfXiDTrZO+Ejd6bANuzzFshOkb6MH8eVupDxTK5hpJKQO+I81sup0EDWCua+MEDPIbeDw8u/ZCg6HC1Ba/O/6VzpvBR3YA8cRiGEh8RJh9Zz5oOBomudMozCw80= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Baorui.Liu To: CC: "Michael S . Tsirkin" , Meng Zhang , Baorui.Liu Subject: [RFC PATCH 3/3] hw/virtio: give virtio-cpufreq two MSI-X vectors Date: Thu, 17 Sep 2026 13:54:17 +0800 Message-ID: <20260917055417.495-4-baorliu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260917055417.495-1-baorliu@amd.com> References: <20260917055417.495-1-baorliu@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV8PEPF00000059:EE_|SN7PR12MB7452:EE_ X-MS-Office365-Filtering-Correlation-Id: c65a64be-45d2-463d-c76a-08df14803197 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700016|376014|82310400026|23010399003|1800799024|56012099006|11063799006|10067099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: ETQ3iDtphkQNqHLWqtoxipA6Go6nyaj4ygV6rt457Rhd/JuMwK0ii826VZYR2Pi47MdZ7Ba2G1mNNmBXuiS1op0prkeF+fVPiwBYjJHEi4nu17hhja6QJnanqBYXrFgr7YmzO0olPA5KFDwCc8F9ElGXPdzy44BpldX32Yq+eZlRiUoFFvwyzpXtZ2K+AkfV7aqoRyo0WtPLgFC7xI3i2tN06Xg3IswuxJVh6ba+sS8gxfesCmyaaNgWIBGXcCFxZ07osVJckw4lFS9f+8LAWXfAaAhDDm065zQX9kQq7ocictaNGuynG8X5lbrgNPwJNKtONgDYlFyG/qLhoqAwoeEpoZ3nMQ2a+I0je08M5MEdi5YL8h2R8mgitwgd/1ATKiTIWY9v+tDF4idISCBOAE9AZAMZj5qcNFY6borpBXmNSY7ILvClNjV1MwfLHZyUkSDVxMYYnh+uspj0Yb8yMQnjDWBgayCJf8zyepnEswnFfi3OQGSu31DQZQ7fAvjbXMV0JMhUajzOIaggt7RgdEhunf07+nqbBaYTn2dFA70w3uie7DDrl1LWvfBm88fFy+aZ8Xq1ElBrM5jGr3ZEaWnEyTuBixCdNN4GJ9PvddQrUU6yMNG86WfNkUcEi1Cc1nZYhc5/hUMLzhhRSggzo4s98z0JEDLwNda9sXJHvgAh3ywqCKPBJ4/R1d3nSglfFuOJw5iaxkiPL2U0WXu7KA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700016)(376014)(82310400026)(23010399003)(1800799024)(56012099006)(11063799006)(10067099003)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6G60AcPTpEG0X8aT4hNiT3BfH1hSDcVC1jaS9Z476oFhK7EF/SH1sZZujOGLy6y0Pkvz5qsvkmOY+ABaIQBPXvCJD5fB49C8t7hXQjqCtUYJ0mVYVSF6Gh8sn+P2YLidFRJhmMEJbMA0MMS79oGIJlyLtbjrvAZ8DlafB84A15j4FbwBUe9wji+k5uXTH5/X+IM4eOIGmabvZoGCOP6RvfcoaWhRTJErEZMBDsL2TZrBAO3fRl8TdMq++Kfuf7gi6UI+nmq2VQXr7SIAAIwL6YPGQNd2C6hUHp++ka4bIDA9MEi3hJssrgidTxoPVY29BD/CbvjOY6XyjZnfx2p+9J2tmMVhe9pWG8rvqrc089j8P0coQtWBhLP6aGTLfcWUPYc/59DRa/LM+oxwmKnXIvlEKd28kWNXE81zyrWxgeFuBAMi22BuOCF+nfCKB8rR X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2026 05:54:52.9869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c65a64be-45d2-463d-c76a-08df14803197 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: LV8PEPF00000059.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7452 Received-SPF: permerror client-ip=2a01:111:f403:c110::3; envelope-from=Baorui.Liu@amd.com; helo=BN8PR05CU002.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 17 Sep 2026 07:54:51 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1789646115740158500 Content-Type: text/plain; charset="utf-8" virtio_notify() does not reach the Android frontend unless the PCI device has two interrupt vectors. Based on a qemu-xen fix by Meng Zhang. Signed-off-by: Meng Zhang Signed-off-by: Baorui.Liu --- hw/virtio/virtio-cpufreq-pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/virtio/virtio-cpufreq-pci.c b/hw/virtio/virtio-cpufreq-pci.c index b7066d962c..5715826af2 100644 --- a/hw/virtio/virtio-cpufreq-pci.c +++ b/hw/virtio/virtio-cpufreq-pci.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "hw/virtio/virtio-pci.h" #include "hw/virtio/virtio-cpufreq.h" +#include "hw/core/qdev-properties.h" #include "qapi/error.h" #include "qemu/module.h" #include "qom/object.h" @@ -28,6 +29,10 @@ struct VirtIOCPUFreqPCI { VirtIOCPUFreq vdev; }; =20 +static const Property virtio_cpufreq_pci_properties[] =3D { + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), +}; + static void virtio_cpufreq_pci_realize(VirtIOPCIProxy *vpci_dev, Error **e= rrp) { VirtIOCPUFreqPCI *vcpufreq =3D VIRTIO_CPUFREQ_PCI(vpci_dev); @@ -44,6 +49,7 @@ static void virtio_cpufreq_pci_class_init(ObjectClass *kl= ass, const void *data) VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); =20 + device_class_set_props(dc, virtio_cpufreq_pci_properties); k->realize =3D virtio_cpufreq_pci_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); =20 --=20 2.34.1