From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C91D9CD343F for ; Fri, 15 May 2026 08:43:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1309737.1580786 (Exim 4.92) (envelope-from ) id 1wNo88-0006bu-9W; Fri, 15 May 2026 08:42:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1309737.1580786; Fri, 15 May 2026 08:42:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wNo88-0006bn-6n; Fri, 15 May 2026 08:42:48 +0000 Received: by outflank-mailman (input) for mailman id 1309737; Fri, 15 May 2026 08:42:47 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wNo87-0006bf-9M for xen-devel@lists.xenproject.org; Fri, 15 May 2026 08:42:47 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wNo86-00CYOa-Gy for xen-devel@lists.xenproject.org; Fri, 15 May 2026 10:42:46 +0200 Received: from [10.42.69.2] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a06dc86-5cb7-0a2a0a5109dd-0a2a4502edfe-0 for ; Fri, 15 May 2026 10:42:46 +0200 Received: from [52.101.48.65] (helo=MW6PR02CU001.outbound.protection.outlook.com) by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a06dc84-af86-0a2a45020019-34653041f8d8-3 for ; Fri, 15 May 2026 10:42:46 +0200 Received: from CH7PR03MB7860.namprd03.prod.outlook.com (2603:10b6:610:24e::14) by DS0PR03MB7584.namprd03.prod.outlook.com (2603:10b6:8:204::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9913.12; Fri, 15 May 2026 08:42:42 +0000 Received: from CH7PR03MB7860.namprd03.prod.outlook.com ([fe80::f5ba:35df:1c9f:b343]) by CH7PR03MB7860.namprd03.prod.outlook.com ([fe80::f5ba:35df:1c9f:b343%4]) with mapi id 15.20.9913.012; Fri, 15 May 2026 08:42:42 +0000 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iMd/0yQLB/Ccq+Yz1CzdP2bY80Kp9fJJ4auiRd8ZbjPhk5oEL/WLSAoPUaXN4IQlNPfvE7hyu6XB45zAi1utEojOrFk90rgpl4P/pZAlUWIDnFs6h5PPpnaIER/b+NONBI773n139/Ug8h94XpVavaLXLqhwNy7y3yIN4PKIz0gFL54SjZhkNXZzL+l5wMYECG8QkpLkx6wgAMmtj/clnKxBLtNXvtTbd7JZW1xDFtXK93DAMC/Pp6uRW/JbtbghHKMQwqhdxVwm44O+ojiwG78LAQvRFnXQGSg5yaTwRFEdLGQq+9HUA963FjNiPXAqEJz24NjoAwFd5LJPuMknmA== 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=xE+sBv0E4K0Fx/gpv5zy0k/b/MMzyXvI87ZlKR8nbz0=; b=aLPCQcwDPpvvq5ynwRUlupp8NTkEBKVZgcUcBtDlB7dZX7DZJ/s78LD/Q9RTH9iR6+EiD9MUVJERh14074YOMI/yBEIcFXVzZ469O1cED7/Q4SehV6hBNMp0w7hiqrUnJJJIKHRmf2eJBkNRBVNPK48gp6G7KbAmWeSCfbLQxE3+USZqZ83POV1g76N7S9/NVi6C10NABOObkftnQnsnuNgJh14+2RO4ApL1KtwplzYnHHYm5hWcxTPBsZWWpIaDljr2ULs3PPgYhECrlQIuVlcYUAPvr6DE8IP1Bpxvaf5OEtoPd1gkRixi2zBoKDGof1G3NImzOPQH6k1Sms0aEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xE+sBv0E4K0Fx/gpv5zy0k/b/MMzyXvI87ZlKR8nbz0=; b=OW6ieNAf5bcViquC1qbDjlwGsFYsL+Qc371VoXXppckw7cm52xk5/aE63jCbooLSUapO2aNCebIoak7fKdzxhWJEh+4jm70CYOGgF9dZ9iMh/YDEHEK/yVtmJhEqadQ1tWsSZEfpow1BUj9noDQJ2duvfFJ5wOjyQkoemye+Np8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; Date: Fri, 15 May 2026 10:42:39 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Jan Beulich Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , Teddy Astie , Oleksii Kurochko Subject: Re: [PATCH for-4.22 3/5] x86/vRTC: support century field Message-ID: References: <383355d1-7032-4445-8a06-cb4411ea797e@suse.com> <17a25f0e-91e3-4e09-92ad-21e7dc0ebe62@suse.com> <439d03f4-4ebb-4bbf-a1ea-324156bff9f0@suse.com> <242237a9-6b9e-4580-8936-aa61be6b0636@suse.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <242237a9-6b9e-4580-8936-aa61be6b0636@suse.com> X-ClientProxiedBy: MA4P292CA0007.ESPP292.PROD.OUTLOOK.COM (2603:10a6:250:2d::12) To CH7PR03MB7860.namprd03.prod.outlook.com (2603:10b6:610:24e::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH7PR03MB7860:EE_|DS0PR03MB7584:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a965d4f-2752-44eb-63fc-08deb25ded96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|22082099003|56012099003|18002099003|11063799003|3023799003|4143699003; X-Microsoft-Antispam-Message-Info: 5Bvl4t+YI8JNSc+xWDPGgVKMeSofg++R1vrcuHdAHMZRLQfd63z3fY3yhG5XeECd4iwKCpTWrOROoPzaMj6WS3G9YvxD2B38ygRcIVv2eMdpOI1iKhPHkzmTR9mqyjGLz8rq5/Yi+sQvrsmTV5Wik8WGs4RUIK75KwqVlNeQ03n11/l6sKkx2Am9ppjX+IflFh6RLbRIejqFwA9+f3Gwspek7mM7dguqUgzOMft35TbuW71AmolyJm3lb310tPmXdX2irK8q/4BUU7gUhzKeRPFeeT//Xo8nDIaiCxKBNLrADGUeZzuoNK+w/MUGXeOIfSMst1yXhzXKDrf67vG7e5mWR03cUx6zq10JAJ48MoME/8MVUazg+YewiY8Zp9bRRgabKbK+dYncw/kRFy72aCp0KI0pYRgqW+ZH8DhDo2tFn1rSTVmdSGTtm6LL9/4gZsgjOTZol+oibOrQwtfl/CnOQraL8xWxM3HsIAeNo6b7wuoeEOTkKt2pSdDZleCvlLdqpHmDOQBY8/IDRvaK1R7kdVlRHNSakZtWwr01sufi3XuBP08qIJ+oNR7tp6HkeM2qweaYHsusLbZQlIZW8hpuAlmHWqwfQI8b67F5u+cvXMS9RCMp2DF98u1V42Hjzptb9jesITNgEk1E9tSjKc1J0ifddEKxya2eOD2rYDyRmKw1QKt0dymZpG2WodJj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH7PR03MB7860.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(22082099003)(56012099003)(18002099003)(11063799003)(3023799003)(4143699003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Y2MxdlVxek1zZnJiWkdZRTIzVFdkMlZCOWZmcUpxWkpMT3AwMzg2WHVBTnlv?= =?utf-8?B?NjdaTU10bVdaUmFVdFUzNGpFSFMxNzQxMXVocmlicTBGME9PZmdMSzZ5aW84?= =?utf-8?B?WUZwNll4SUZWcHZ5aGNoVlJaSTRzYU5XT2Fvc3BhRHpWYzcraEZQTE9ibS9S?= =?utf-8?B?R2Z6eElUenNHa2hSQy9kU3BHU0hEYzNvbTlJUUczZVJtQ3BtUUhCY2h3eFNm?= =?utf-8?B?RnFZVEVNZ1A2aW1sdmpVWEhmcnVVNUV5eUlVdWZrNWIxNzc3L09KNUNEZlBS?= =?utf-8?B?eWFwMDR6NklWdzBMQnpaenBZamNxNmdNVWEwOEhFQmo2NXV4bTJOQml0QUFq?= =?utf-8?B?Tm9iRXhnRjVkSS9yVjl2dUhCQjhMbXJZOFhlQXhhaTJ1MVJTTzRqYXRUZmh1?= =?utf-8?B?RHNRS3lVUGZCNVpYbG1tR2NiT2pZamRucHJBSEowcVMxRlV0VFpYb2R0TjJ4?= =?utf-8?B?L2k2bkszVytybGg4ejcwZlUvRDRBSTBTQ3c1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0lEa1ROVnNlVU5sZXBWbENOTnkrOVhyNGx4S1NtYU5MMm5jUT09?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a965d4f-2752-44eb-63fc-08deb25ded96 X-MS-Exchange-CrossTenant-AuthSource: CH7PR03MB7860.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2026 08:42:42.2575 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DlAtsmZBn2oezy0GUF7QrkS+IBR0HrRvxOO406BZlDy/CEZWwIfCN5qxsx8fH7sq/c/In5oIEz3Wwat29+Ud6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR03MB7584 X-purgate-ID: tlsNG-720697/1778834566-82969161-74CDD9F2/0/0 X-purgate-type: clean X-purgate-size: 3564 On Fri, May 15, 2026 at 08:52:03AM +0200, Jan Beulich wrote: > On 13.05.2026 21:40, Roger Pau Monné wrote: > > On Wed, May 13, 2026 at 05:24:13PM +0200, Jan Beulich wrote: > >> On 13.05.2026 17:14, Roger Pau Monné wrote: > >>> On Wed, May 13, 2026 at 04:58:57PM +0200, Jan Beulich wrote: > >>>> On 13.05.2026 16:24, Roger Pau Monné wrote: > >>>>> On Tue, May 12, 2026 at 04:59:35PM +0200, Jan Beulich wrote: > >>>>>> @@ -515,7 +538,10 @@ static int rtc_ioport_write(void *opaque > >>>>>> /* Fetch the current time and update just this field. */ > >>>>>> s->current_tm = gmtime(get_localtime(d)); > >>>>>> rtc_copy_date(s); > >>>>>> - s->hw.cmos_data[s->hw.cmos_index] = data; > >>>>>> + if ( s->hw.cmos_index != RTC_CENTURY ) > >>>>>> + s->hw.cmos_data[s->hw.cmos_index] = data; > >>>>>> + else > >>>>>> + s->hw.century = data; > >>>>>> rtc_set_time(s); > >>>>>> } > >>>>>> alarm_timer_update(s); > >>>>> > >>>>> Don't you need to adjust the tail return of rtc_ioport_write() (below > >>>>> the context here) to return 0 when s->hw.cmos_index == RTC_CENTURY, so > >>>>> the set value is also propagated to the DM, and not only the index? > >>>> > >>>> I don't think so. The case of us not handling RTC_CENTURY is dealt with > >>>> earlier in the function. Whereas when we handle the field, we don't want > >>>> to forward (like for all the other RTC fields). > >>> > >>> Right, so then you also want to adjust the top part of > >>> rtc_ioport_write() to not propagate the write to the 0x70 IO port when > >>> data is RTC_CENTURY? Otherwise you propagate the write to port 0x70, > >>> but not the read/write to port 0x71? > >> > >> I can't, as whether to forward depends on the data subsequently written. > >> Propagating the index "just in case" is the only workable model that I > >> can think of. And as guests can do any number of successive port 70 > >> writes, the DM needs to cope with this anyway. > > > > Hm, I see, the newly written value to port 0x71 is taken into account > > to decide whether to forward to the DM or not. > > > > I wonder: would it be simpler to extend the size of the hvm_hw_rtc > > structure so that Xen can detect whether the incoming VM has support > > for the century field, and then avoid having to play heuristics > > with the value itself? > > It would surely be possible (and we may need to do so anyway for the alarm > date/month fields), but I wanted to get away without doing so here. And it > seemed pretty reasonable to leverage the padding field for this. > > > We would know ahead of starting the guest > > whether RTC_CENTURY is supposed to be handled by Xen or forwarded to > > the DM, and we won't be limited to use 0 as the sentinel value for not > > exposing RTC_CENTURY. > > These are the positive aspects. The negative one is that "backwards" > migration would break with the larger record size. Whereas with the padding > field used, it won't: The guest likely won't notice that the value at 0x32 > isn't updated anymore, i.e. stays at value 20. Sorry, maybe I'm confused, but when migrating backwards the access won't be handled by Xen anymore, and hence we don't know what it would return, it's up to the catch-all device model. I don't think it's safe to migrate backwards, as the century value won't be preserved correctly. IOW: we might want to actively prevent such scenario? Thanks, Roger.