From nobody Sat Feb 7 15:22:06 2026 Received: from fra-out-002.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-002.esa.eu-central-1.outbound.mail-perimeter.amazon.com [3.65.3.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A66F133E348; Wed, 7 Jan 2026 13:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=3.65.3.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792420; cv=none; b=Yh5me3uKmLA+w0B9XX1BYIXu05qG6DSS5GdpUQRVrBiH2OYtyrPrsCz7OHBPFZyQBQ0CLESYO2Rq9hCee9t6v4cINRQVHBatNwEk/8oFijJYld1HJJbqQE6SFfcuTPBgaVmBPjwoe2qRHQCrPM28MGw9iv4OCgHyowSA+EmcEJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792420; c=relaxed/simple; bh=K9PWfOsr2URHViwINyOwCX3J3UQ1Ltgw6a13juuLadA=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=Zicz//rDd9clSL6cUctfxpZZ9RTwuxmsnpSOVMs2ue/Fk2Aik49u9sIYgIV9gjZRPhjcYJYGOuMgzssDp778iT+pvP0Kg/NO+KXmGLmJhhVi3KwLxQomxiu7F+/sNmjX8sqNeXXW8p/cjkWek5t2SoCX2McUgK2Ap86mptSA+5s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es; spf=pass smtp.mailfrom=amazon.es; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b=A5Q0r/zW; arc=none smtp.client-ip=3.65.3.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.es Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b="A5Q0r/zW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.es; i=@amazon.es; q=dns/txt; s=amazoncorp2; t=1767792419; x=1799328419; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=iKrltbaD/Drhq8kMDPgbTPux36kEXGe0gvAIL/BeBmI=; b=A5Q0r/zWC+tQUFtC/KQbERjY2PsJPOiWQJ1mDkC3XBEBbW75dBrrzwei o5p9RqcYiS1cvfnEs3pUrTIfNUG4iRpt/SErOTxV6oXiBgzSsJPFAHnAh lOM5qf/20CytQjO14y8K6qHECH3XQ3lYHXgTyFHxRAtyBWR/dxgxKbcVm JrCjP0yRCh9FxubSSK0hSgNN+FvVVa2AbbEeVd3pcFfnCc1lpEW48cR86 Hx1s8maxiCaKN3P/1UyorddiCekQsJjEnVdEF0s7Hkb3rzXllhxlCXC+x P/l3Jh0GyLMZ5cwcCvP6p5FCssvQaAz7h7QQDhhSpoGyULhh+4huLM0rS A==; X-CSE-ConnectionGUID: 58v3xja4QNqoj2AL1voR/A== X-CSE-MsgGUID: YggqituoT1C10BTKVOxa4w== X-IronPort-AV: E=Sophos;i="6.21,208,1763424000"; d="scan'208";a="7582955" Received: from ip-10-6-6-97.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.6.97]) by internal-fra-out-002.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 13:25:30 +0000 Received: from EX19MTAEUB001.ant.amazon.com [54.240.197.234:21286] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.8.109:2525] with esmtp (Farcaster) id 39e392b3-f1d0-46cf-8878-57df51408764; Wed, 7 Jan 2026 13:25:30 +0000 (UTC) X-Farcaster-Flow-ID: 39e392b3-f1d0-46cf-8878-57df51408764 Received: from EX19D012EUA002.ant.amazon.com (10.252.50.32) by EX19MTAEUB001.ant.amazon.com (10.252.51.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:25:27 +0000 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19D012EUA002.ant.amazon.com (10.252.50.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:25:27 +0000 Received: from EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719]) by EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719%3]) with mapi id 15.02.2562.035; Wed, 7 Jan 2026 13:25:27 +0000 From: "Chalios, Babis" To: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , "dwmw2@infradead.org" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Chalios, Babis" , "Graf (AWS), Alexander" , "mzxreary@0pointer.de" , "Cali, Marco" , "Woodhouse, David" Subject: [PATCH v5 1/7] ptp: vmclock: add vm generation counter Thread-Topic: [PATCH v5 1/7] ptp: vmclock: add vm generation counter Thread-Index: AQHcf9kWLvE+0o9WbU2Yd+WMMW1HBg== Date: Wed, 7 Jan 2026 13:25:27 +0000 Message-ID: <20260107132514.437-2-bchalios@amazon.es> References: <20260107132514.437-1-bchalios@amazon.es> In-Reply-To: <20260107132514.437-1-bchalios@amazon.es> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Similar to live migration, loading a VM from some saved state (aka snapshot) is also an event that calls for clock adjustments in the guest. However, guests might want to take more actions as a response to such events, e.g. as discarding UUIDs, resetting network connections, reseeding entropy pools, etc. These are actions that guests don't typically take during live migration, so add a new field in the vmclock_abi called vm_generation_counter which informs the guest about such events. Hypervisor advertises support for vm_generation_counter through the VMCLOCK_FLAG_VM_GEN_COUNTER_PRESENT flag. Users need to check the presence of this bit in vmclock_abi flags field before using this flag. Signed-off-by: Babis Chalios Reviewed-by: David Woodhouse --- include/uapi/linux/vmclock-abi.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/uapi/linux/vmclock-abi.h b/include/uapi/linux/vmclock-= abi.h index 2d99b29ac44a..937fe00e4f33 100644 --- a/include/uapi/linux/vmclock-abi.h +++ b/include/uapi/linux/vmclock-abi.h @@ -115,6 +115,12 @@ struct vmclock_abi { * bit again after the update, using the about-to-be-valid fields. */ #define VMCLOCK_FLAG_TIME_MONOTONIC (1 << 7) + /* + * If the VM_GEN_COUNTER_PRESENT flag is set, the hypervisor will + * bump the vm_generation_counter field every time the guest is + * loaded from some save state (restored from a snapshot). + */ +#define VMCLOCK_FLAG_VM_GEN_COUNTER_PRESENT (1 << 8) =20 __u8 pad[2]; __u8 clock_status; @@ -177,6 +183,15 @@ struct vmclock_abi { __le64 time_frac_sec; /* Units of 1/2^64 of a second */ __le64 time_esterror_nanosec; __le64 time_maxerror_nanosec; + + /* + * This field changes to another non-repeating value when the guest + * has been loaded from a snapshot. In addition to handling a + * disruption in time (which will also be signalled through the + * disruption_marker field), a guest may wish to discard UUIDs, + * reset network connections, reseed entropy, etc. + */ + __le64 vm_generation_counter; }; =20 #endif /* __VMCLOCK_ABI_H__ */ --=20 2.34.1 From nobody Sat Feb 7 15:22:06 2026 Received: from fra-out-014.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-014.esa.eu-central-1.outbound.mail-perimeter.amazon.com [18.199.210.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0078833F384; Wed, 7 Jan 2026 13:27:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.199.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792433; cv=none; b=Z05lycb6Xg/KmwyRbEJnYIQoX8R3oQuja4O0SSK91B3XJ+QAtMlUX1n2qr5SX22VcoXlGEes+BtpUVv/1FUTqPE4gs3u32V/NWIiz6yhfMSmrC5CH1kVFhPflK6JPPJuonIFsYIBInnoLuV1SxcN4my0N4iGyzbvfUHbn8g0N/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792433; c=relaxed/simple; bh=nq1DqVV+3cbt7tEz01qV717DHb1LVFBPLP+fYFFGQZA=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=fgvXdWXKqaRBsO8ciZWbt/1rZV2HrZEDaUEnmTvOznoVf9u/yNtqOyGaMnleDXklpJaElsTH7olV3Cn4jpL2wAM9rpAYRXqM+3Gc1ziKXLVg94/uHJ8TZ7dB/c/Eqauld17CxRFumt7Xrm2FAVsEAR2A4UH3UHmt9Ow4gulsbxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es; spf=pass smtp.mailfrom=amazon.es; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b=G54Ib6cK; arc=none smtp.client-ip=18.199.210.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.es Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b="G54Ib6cK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.es; i=@amazon.es; q=dns/txt; s=amazoncorp2; t=1767792431; x=1799328431; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=nq1DqVV+3cbt7tEz01qV717DHb1LVFBPLP+fYFFGQZA=; b=G54Ib6cKj4/DxoN5muzUR5bDj1QLSbLqLBvqmOq1Gx24wD3iqfZ6OyMH XdDGPDQbuZ/i0VWn//0XjDGikJte74PLQKtUvlElb6C9p963x5fLqG7hk pU7LdfR1/5SXPqB5Q8TH2fR1C9DtgKcXcdpxNHAVm03K9xBet8Es4BeFL +CrnTHvwgXrHw3rUZq1QzZp2GU19hoQD1F9oH0+48OF9Qs1leMvce343k tt9dVZ2gYexcy92eJ+Z+98rrtqciC0YfcBhpF49n0Tp5ZardUwzhHsPsw L3+lUT6hmCwP6ZNyHktDh4/imZkTtZjveeNi1JFskvY53FO8/Z0ydRsGC g==; X-CSE-ConnectionGUID: fqoicD2rQZiNnM6sa+lFwQ== X-CSE-MsgGUID: PtzoIg9rTPapSVfPBS88kw== X-IronPort-AV: E=Sophos;i="6.21,208,1763424000"; d="scan'208";a="7486078" Received: from ip-10-6-3-216.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.3.216]) by internal-fra-out-014.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 13:25:44 +0000 Received: from EX19MTAEUA002.ant.amazon.com [54.240.197.232:18844] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.8.109:2525] with esmtp (Farcaster) id 32bee1f6-1d45-4c6b-bcc2-d383ffd512bf; Wed, 7 Jan 2026 13:25:44 +0000 (UTC) X-Farcaster-Flow-ID: 32bee1f6-1d45-4c6b-bcc2-d383ffd512bf Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19MTAEUA002.ant.amazon.com (10.252.50.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:25:39 +0000 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19D012EUA001.ant.amazon.com (10.252.50.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:25:39 +0000 Received: from EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719]) by EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719%3]) with mapi id 15.02.2562.035; Wed, 7 Jan 2026 13:25:39 +0000 From: "Chalios, Babis" To: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , "dwmw2@infradead.org" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Chalios, Babis" , "Graf (AWS), Alexander" , "mzxreary@0pointer.de" , "Cali, Marco" , "Woodhouse, David" Subject: [PATCH v5 2/7] ptp: vmclock: support device notifications Thread-Topic: [PATCH v5 2/7] ptp: vmclock: support device notifications Thread-Index: AQHcf9kd3BInlfrFzkiJ2qioX48qKg== Date: Wed, 7 Jan 2026 13:25:38 +0000 Message-ID: <20260107132514.437-3-bchalios@amazon.es> References: <20260107132514.437-1-bchalios@amazon.es> In-Reply-To: <20260107132514.437-1-bchalios@amazon.es> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add optional support for device notifications in VMClock. When supported, the hypervisor will send a device notification every time it updates the seq_count to a new even value. Moreover, add support for poll() in VMClock as a means to propagate this notification to user space. poll() will return a POLLIN event to listeners every time seq_count changes to a value different than the one last seen (since open() or last read()/pread()). This means that when poll() returns a POLLIN event, listeners need to use read() to observe what has changed and update the reader's view of seq_count. In other words, after a poll() returned, all subsequent calls to poll() will immediately return with a POLLIN event until the listener calls read(). The device advertises support for the notification mechanism by setting flag VMCLOCK_FLAG_NOTIFICATION_PRESENT in vmclock_abi flags field. If the flag is not present the driver won't setup the ACPI notification handler and poll() will always immediately return POLLHUP. Signed-off-by: Babis Chalios Reviewed-by: David Woodhouse --- drivers/ptp/ptp_vmclock.c | 125 +++++++++++++++++++++++++++++-- include/uapi/linux/vmclock-abi.h | 5 ++ 2 files changed, 123 insertions(+), 7 deletions(-) diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index b3a83b03d9c1..38b2bacb755e 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -5,6 +5,9 @@ * Copyright =C2=A9 2024 Amazon.com, Inc. or its affiliates. */ =20 +#include "linux/poll.h" +#include "linux/types.h" +#include "linux/wait.h" #include #include #include @@ -39,6 +42,7 @@ struct vmclock_state { struct resource res; struct vmclock_abi *clk; struct miscdevice miscdev; + wait_queue_head_t disrupt_wait; struct ptp_clock_info ptp_clock_info; struct ptp_clock *ptp_clock; enum clocksource_ids cs_id, sys_cs_id; @@ -357,10 +361,15 @@ static struct ptp_clock *vmclock_ptp_register(struct = device *dev, return ptp_clock_register(&st->ptp_clock_info, dev); } =20 +struct vmclock_file_state { + struct vmclock_state *st; + atomic_t seq; +}; + static int vmclock_miscdev_mmap(struct file *fp, struct vm_area_struct *vm= a) { - struct vmclock_state *st =3D container_of(fp->private_data, - struct vmclock_state, miscdev); + struct vmclock_file_state *fst =3D fp->private_data; + struct vmclock_state *st =3D fst->st; =20 if ((vma->vm_flags & (VM_READ|VM_WRITE)) !=3D VM_READ) return -EROFS; @@ -379,11 +388,11 @@ static int vmclock_miscdev_mmap(struct file *fp, stru= ct vm_area_struct *vma) static ssize_t vmclock_miscdev_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos) { - struct vmclock_state *st =3D container_of(fp->private_data, - struct vmclock_state, miscdev); ktime_t deadline =3D ktime_add(ktime_get(), VMCLOCK_MAX_WAIT); + struct vmclock_file_state *fst =3D fp->private_data; + struct vmclock_state *st =3D fst->st; + uint32_t seq, old_seq; size_t max_count; - uint32_t seq; =20 if (*ppos >=3D PAGE_SIZE) return 0; @@ -392,6 +401,7 @@ static ssize_t vmclock_miscdev_read(struct file *fp, ch= ar __user *buf, if (count > max_count) count =3D max_count; =20 + old_seq =3D atomic_read(&fst->seq); while (1) { seq =3D le32_to_cpu(st->clk->seq_count) & ~1U; /* Pairs with hypervisor wmb */ @@ -402,8 +412,16 @@ static ssize_t vmclock_miscdev_read(struct file *fp, c= har __user *buf, =20 /* Pairs with hypervisor wmb */ virt_rmb(); - if (seq =3D=3D le32_to_cpu(st->clk->seq_count)) - break; + if (seq =3D=3D le32_to_cpu(st->clk->seq_count)) { + /* + * Either we updated fst->seq to seq (the latest version we observed) + * or someone else did (old_seq =3D=3D seq), so we can break. + */ + if (atomic_try_cmpxchg(&fst->seq, &old_seq, seq) || + old_seq =3D=3D seq) { + break; + } + } =20 if (ktime_after(ktime_get(), deadline)) return -ETIMEDOUT; @@ -413,10 +431,58 @@ static ssize_t vmclock_miscdev_read(struct file *fp, = char __user *buf, return count; } =20 +static __poll_t vmclock_miscdev_poll(struct file *fp, poll_table *wait) +{ + struct vmclock_file_state *fst =3D fp->private_data; + struct vmclock_state *st =3D fst->st; + uint32_t seq; + + /* + * Hypervisor will not send us any notifications, so fail immediately + * to avoid having caller sleeping for ever. + */ + if (!(le64_to_cpu(st->clk->flags) & VMCLOCK_FLAG_NOTIFICATION_PRESENT)) + return POLLHUP; + + poll_wait(fp, &st->disrupt_wait, wait); + + seq =3D le32_to_cpu(st->clk->seq_count); + if (atomic_read(&fst->seq) !=3D seq) + return POLLIN | POLLRDNORM; + + return 0; +} + +static int vmclock_miscdev_open(struct inode *inode, struct file *fp) +{ + struct vmclock_state *st =3D container_of(fp->private_data, + struct vmclock_state, miscdev); + struct vmclock_file_state *fst =3D kzalloc(sizeof(*fst), GFP_KERNEL); + + if (!fst) + return -ENOMEM; + + fst->st =3D st; + atomic_set(&fst->seq, 0); + + fp->private_data =3D fst; + + return 0; +} + +static int vmclock_miscdev_release(struct inode *inode, struct file *fp) +{ + kfree(fp->private_data); + return 0; +} + static const struct file_operations vmclock_miscdev_fops =3D { .owner =3D THIS_MODULE, + .open =3D vmclock_miscdev_open, + .release =3D vmclock_miscdev_release, .mmap =3D vmclock_miscdev_mmap, .read =3D vmclock_miscdev_read, + .poll =3D vmclock_miscdev_poll, }; =20 /* module operations */ @@ -459,6 +525,44 @@ static acpi_status vmclock_acpi_resources(struct acpi_= resource *ares, void *data return AE_ERROR; } =20 +static void +vmclock_acpi_notification_handler(acpi_handle __always_unused handle, + u32 __always_unused event, void *dev) +{ + struct device *device =3D dev; + struct vmclock_state *st =3D device->driver_data; + + wake_up_interruptible(&st->disrupt_wait); +} + +static int vmclock_setup_notification(struct device *dev, struct vmclock_s= tate *st) +{ + struct acpi_device *adev =3D ACPI_COMPANION(dev); + acpi_status status; + + /* + * This should never happen as this function is only called when + * has_acpi_companion(dev) is true, but the logic is sufficiently + * complex that Coverity can't see the tautology. + */ + if (!adev) + return -ENODEV; + + /* The device does not support notifications. Nothing else to do */ + if (!(le64_to_cpu(st->clk->flags) & VMCLOCK_FLAG_NOTIFICATION_PRESENT)) + return 0; + + status =3D acpi_install_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY, + vmclock_acpi_notification_handler, + dev); + if (ACPI_FAILURE(status)) { + dev_err(dev, "failed to install notification handler"); + return -ENODEV; + } + + return 0; +} + static int vmclock_probe_acpi(struct device *dev, struct vmclock_state *st) { struct acpi_device *adev =3D ACPI_COMPANION(dev); @@ -549,6 +653,11 @@ static int vmclock_probe(struct platform_device *pdev) if (ret) return ret; =20 + init_waitqueue_head(&st->disrupt_wait); + ret =3D vmclock_setup_notification(dev, st); + if (ret) + return ret; + /* * If the structure is big enough, it can be mapped to userspace. * Theoretically a guest OS even using larger pages could still @@ -581,6 +690,8 @@ static int vmclock_probe(struct platform_device *pdev) return -ENODEV; } =20 + dev->driver_data =3D st; + dev_info(dev, "%s: registered %s%s%s\n", st->name, st->miscdev.minor ? "miscdev" : "", (st->miscdev.minor && st->ptp_clock) ? ", " : "", diff --git a/include/uapi/linux/vmclock-abi.h b/include/uapi/linux/vmclock-= abi.h index 937fe00e4f33..d320623b0118 100644 --- a/include/uapi/linux/vmclock-abi.h +++ b/include/uapi/linux/vmclock-abi.h @@ -121,6 +121,11 @@ struct vmclock_abi { * loaded from some save state (restored from a snapshot). */ #define VMCLOCK_FLAG_VM_GEN_COUNTER_PRESENT (1 << 8) + /* + * If the NOTIFICATION_PRESENT flag is set, the hypervisor will send + * a notification every time it updates seq_count to a new even number. + */ +#define VMCLOCK_FLAG_NOTIFICATION_PRESENT (1 << 9) =20 __u8 pad[2]; __u8 clock_status; --=20 2.34.1 From nobody Sat Feb 7 15:22:06 2026 Received: from fra-out-012.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-012.esa.eu-central-1.outbound.mail-perimeter.amazon.com [52.57.120.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 220D333FE34; Wed, 7 Jan 2026 13:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.57.120.243 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792441; cv=none; b=Z1XKRzs9qxZKBI00e5aacVGFMIbtrzCLeTZeDhbxfeDdw7BZwNtQFv9LV8FHwk/DCi+4bEbnV3DPqaN+f6uohcg0H2qhbIwvVospj9INEg6cFvsWmDrn7hAXYxx/jhTbJ1XbBV8oVic3erSm61ydGT8Ec8BtUd7svYGnADi8W5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792441; c=relaxed/simple; bh=CMePqU7fDA/wHXd5/nycVWAvieQKAaHLSa+FSiuP0+0=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=qTgj5gENL8vlP+7xCr0d3upO/kUrXR6G2pZ5KtPho+XiGtXqp2r2LbdvjVG/fjehtjqvH9cABErqNLRBJF7GvL82/mpJFvUiGQ8LywA+507BDYKSicskWa4tiudCYHSwdS+ChZfLDAhyCVGBJemUrQb1VWf3wFfpVKTB3EhQ6v8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es; spf=pass smtp.mailfrom=amazon.es; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b=s3WTaWwZ; arc=none smtp.client-ip=52.57.120.243 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.es Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b="s3WTaWwZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.es; i=@amazon.es; q=dns/txt; s=amazoncorp2; t=1767792439; x=1799328439; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=yIJepOPX3arqb5MyazZ+94RAcXRQ7bSmHnzahqj+Zso=; b=s3WTaWwZ/VkPvkT8U2YcwGAsQCUFaZON5tEUkPoPekbuDd3ZWdgxZM2e mCPHkJV++hfCYSfo6ByDO5xULbjsU5eu3j4dNZqe+WCSxttuozeYU6Dau LCElTnhDDNTECHT/+pl2uaEeBnBTKn2kFvsAGjgz6TwJfcfqKH7d251zl WyOmj0OraMIhMex9HXTLV830FC6u2SKuHaT+WhAKfVoMbRY56NThPdeG+ CNdoASYGv2gK0w8aM/G43ilgGC57DC/H1/5clG8DIqsX1NmRXj5osydPq 1YTQRUszgbb1GZ3La89kiCybj0X61sS0pthn/hy4jS7S+pSygMwedkc9a Q==; X-CSE-ConnectionGUID: xOpZit2GTu+Kq2Ek5lFvJA== X-CSE-MsgGUID: DXdAOuVoQ0mEwNsgDrfkfQ== X-IronPort-AV: E=Sophos;i="6.21,208,1763424000"; d="scan'208";a="7474660" Received: from ip-10-6-3-216.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.3.216]) by internal-fra-out-012.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 13:25:51 +0000 Received: from EX19MTAEUA001.ant.amazon.com [54.240.197.233:25407] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.44.14:2525] with esmtp (Farcaster) id e68d9584-8813-4339-872d-da1bc2eb117d; Wed, 7 Jan 2026 13:25:50 +0000 (UTC) X-Farcaster-Flow-ID: e68d9584-8813-4339-872d-da1bc2eb117d Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19MTAEUA001.ant.amazon.com (10.252.50.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:25:50 +0000 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19D012EUA001.ant.amazon.com (10.252.50.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:25:50 +0000 Received: from EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719]) by EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719%3]) with mapi id 15.02.2562.035; Wed, 7 Jan 2026 13:25:50 +0000 From: "Chalios, Babis" To: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , "dwmw2@infradead.org" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Chalios, Babis" , "Graf (AWS), Alexander" , "mzxreary@0pointer.de" , "Cali, Marco" , "Woodhouse, David" , "Krzysztof Kozlowski" Subject: [PATCH v5 3/7] dt-bindings: ptp: Add amazon,vmclock Thread-Topic: [PATCH v5 3/7] dt-bindings: ptp: Add amazon,vmclock Thread-Index: AQHcf9kjlf9LyNdHpUqK8CP9OeMyQQ== Date: Wed, 7 Jan 2026 13:25:50 +0000 Message-ID: <20260107132514.437-4-bchalios@amazon.es> References: <20260107132514.437-1-bchalios@amazon.es> In-Reply-To: <20260107132514.437-1-bchalios@amazon.es> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Woodhouse The vmclock device provides a PTP clock source and precise timekeeping across live migration and snapshot/restore operations. The binding has a required memory region containing the vmclock_abi structure and an optional interrupt for clock disruption notifications. The full spec is at https://uapi-group.org/specifications/specs/vmclock/ Signed-off-by: David Woodhouse Signed-off-by: Babis Chalios Reviewed-by: Krzysztof Kozlowski --- .../bindings/ptp/amazon,vmclock.yaml | 46 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/ptp/amazon,vmclock.ya= ml diff --git a/Documentation/devicetree/bindings/ptp/amazon,vmclock.yaml b/Do= cumentation/devicetree/bindings/ptp/amazon,vmclock.yaml new file mode 100644 index 000000000000..357790df876f --- /dev/null +++ b/Documentation/devicetree/bindings/ptp/amazon,vmclock.yaml @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/ptp/amazon,vmclock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Virtual Machine Clock + +maintainers: + - David Woodhouse + +description: + The vmclock device provides a precise clock source and allows for + accurate timekeeping across live migration and snapshot/restore + operations. The full specification of the shared data structure is + available at https://uapi-group.org/specifications/specs/vmclock/ + +properties: + compatible: + const: amazon,vmclock + + reg: + description: + Specifies the shared memory region containing the vmclock_abi struct= ure. + maxItems: 1 + + interrupts: + description: + Interrupt used to notify when the contents of the vmclock_abi struct= ure + have been updated. + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include + ptp@80000000 { + compatible =3D "amazon,vmclock"; + reg =3D <0x80000000 0x1000>; + interrupts =3D ; + }; diff --git a/MAINTAINERS b/MAINTAINERS index e8f06145fb54..171813ea76a3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20728,6 +20728,7 @@ PTP VMCLOCK SUPPORT M: David Woodhouse L: netdev@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/ptp/amazon,vmclock.yaml F: drivers/ptp/ptp_vmclock.c F: include/uapi/linux/vmclock-abi.h =20 --=20 2.34.1 From nobody Sat Feb 7 15:22:06 2026 Received: from fra-out-014.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-014.esa.eu-central-1.outbound.mail-perimeter.amazon.com [18.199.210.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCFC433F39A; Wed, 7 Jan 2026 13:27:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.199.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792436; cv=none; b=Bp5802bhZAyWeXe0uHHAUceItD2FiiLh9tgBrBvo4EGPCXagBy38B+iZHjBgR5RMhNbofWhi0mtXtoDPXHgXg1s5wxhJup9xi9mGgG3xL4g8i4AzZGSxe6wiJwQ2coxh161x1DiWViSyQlZXk/AwJqHiHsHMkKIq7J1vocH55s0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792436; c=relaxed/simple; bh=Gmj9IBI+t/VW0oik5zPH7gkOEWiT4SWSyQDx1QVMrFY=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=lURxARfipGE1oZBMcslETic9aeI+Vpz/rF06fVfAdJSTl55sqPnAi+r1ew3kMP7AQU2Xj5EGcQkpcnABXBRS6GB9iuHamJt7DoljUPUbN8wsTRDrn9U6Et52h8CpF/r2fYBCO9wvRSlhm3GqbzRJwm8Z5F7S0AkQyK7/wHGRPAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es; spf=pass smtp.mailfrom=amazon.es; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b=HLVVXl3q; arc=none smtp.client-ip=18.199.210.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.es Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b="HLVVXl3q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.es; i=@amazon.es; q=dns/txt; s=amazoncorp2; t=1767792434; x=1799328434; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=zAXY52N8gXlIv3/t+EXjSdtsrE1TaG1NoRSb+1+uVkM=; b=HLVVXl3q3DUvrugHv5i9XA1H349j9g1tNE4RoDYjWuNWZ9p7gmUD/OL/ aVnzHAiOgZTiSCUDvOIK9+DYAzyILM3/zMG6asij67n8hJRcSPObR57Ub DVUqPT1aCNkYGEC1m+U2lP1sQCRTlcedaMmM6JFb8muIlDf5COHRmIpRP yWQfmf926QNawaNay8wYKkuUL4AIP//oegAghmfGfsDnQI3aDrtXXHrBj HY37SFitGgD5KBhfq3cwPmhOrS9Obp12MAx9xim3e4UdCGUHYLw5iLj5h QhC/Bsx7h9Ub6jEUOTlAJTvWFG1Jdf6kgkaATvWyksDU8nFWJBACjf9L5 Q==; X-CSE-ConnectionGUID: gcg0zxIKQIKm74NTMMnsUQ== X-CSE-MsgGUID: 1iQNDammTF2HNm0SOIoCww== X-IronPort-AV: E=Sophos;i="6.21,208,1763424000"; d="scan'208";a="7486104" Received: from ip-10-6-6-97.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.6.97]) by internal-fra-out-014.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 13:26:03 +0000 Received: from EX19MTAEUB001.ant.amazon.com [54.240.197.234:30606] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.35.222:2525] with esmtp (Farcaster) id 53d8d61f-0453-4ecf-9d89-1d64c54a7498; Wed, 7 Jan 2026 13:26:03 +0000 (UTC) X-Farcaster-Flow-ID: 53d8d61f-0453-4ecf-9d89-1d64c54a7498 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19MTAEUB001.ant.amazon.com (10.252.51.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:01 +0000 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19D012EUA001.ant.amazon.com (10.252.50.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:01 +0000 Received: from EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719]) by EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719%3]) with mapi id 15.02.2562.035; Wed, 7 Jan 2026 13:26:01 +0000 From: "Chalios, Babis" To: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , "dwmw2@infradead.org" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Chalios, Babis" , "Graf (AWS), Alexander" , "mzxreary@0pointer.de" , "Cali, Marco" , "Woodhouse, David" Subject: [PATCH v5 4/7] ptp: ptp_vmclock: Add device tree support Thread-Topic: [PATCH v5 4/7] ptp: ptp_vmclock: Add device tree support Thread-Index: AQHcf9kqLkJgPArGVUiIcSiHYNwkwQ== Date: Wed, 7 Jan 2026 13:26:01 +0000 Message-ID: <20260107132514.437-5-bchalios@amazon.es> References: <20260107132514.437-1-bchalios@amazon.es> In-Reply-To: <20260107132514.437-1-bchalios@amazon.es> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Add device tree support to the ptp_vmclock driver, allowing it to probe via device tree in addition to ACPI. Handle optional interrupt for clock disruption notifications, mirroring the ACPI notification behaviour. Signed-off-by: David Woodhouse Signed-off-by: Babis Chalios --- drivers/ptp/ptp_vmclock.c | 72 ++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index 38b2bacb755e..801e14cc4799 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -14,10 +14,13 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include =20 @@ -535,7 +538,7 @@ vmclock_acpi_notification_handler(acpi_handle __always_= unused handle, wake_up_interruptible(&st->disrupt_wait); } =20 -static int vmclock_setup_notification(struct device *dev, struct vmclock_s= tate *st) +static int vmclock_setup_acpi_notification(struct device *dev) { struct acpi_device *adev =3D ACPI_COMPANION(dev); acpi_status status; @@ -548,10 +551,6 @@ static int vmclock_setup_notification(struct device *d= ev, struct vmclock_state * if (!adev) return -ENODEV; =20 - /* The device does not support notifications. Nothing else to do */ - if (!(le64_to_cpu(st->clk->flags) & VMCLOCK_FLAG_NOTIFICATION_PRESENT)) - return 0; - status =3D acpi_install_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY, vmclock_acpi_notification_handler, dev); @@ -586,6 +585,57 @@ static int vmclock_probe_acpi(struct device *dev, stru= ct vmclock_state *st) return 0; } =20 +static irqreturn_t vmclock_of_irq_handler(int __always_unused irq, void *_= st) +{ + struct vmclock_state *st =3D _st; + + wake_up_interruptible(&st->disrupt_wait); + return IRQ_HANDLED; +} + +static int vmclock_probe_dt(struct device *dev, struct vmclock_state *st) +{ + struct platform_device *pdev =3D to_platform_device(dev); + struct resource *res; + + res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + st->res =3D *res; + + return 0; +} + +static int vmclock_setup_of_notification(struct device *dev) +{ + struct platform_device *pdev =3D to_platform_device(dev); + int irq; + + irq =3D platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + return devm_request_irq(dev, irq, vmclock_of_irq_handler, IRQF_SHARED, + "vmclock", dev->driver_data); +} + +static int vmclock_setup_notification(struct device *dev, + struct vmclock_state *st) +{ + /* The device does not support notifications. Nothing else to do */ + if (!(le64_to_cpu(st->clk->flags) & VMCLOCK_FLAG_NOTIFICATION_PRESENT)) + return 0; + + if (has_acpi_companion(dev)) { + return vmclock_setup_acpi_notification(dev); + } else { + return vmclock_setup_of_notification(dev); + } + +} + + static void vmclock_put_idx(void *data) { struct vmclock_state *st =3D data; @@ -606,7 +656,7 @@ static int vmclock_probe(struct platform_device *pdev) if (has_acpi_companion(dev)) ret =3D vmclock_probe_acpi(dev, st); else - ret =3D -EINVAL; /* Only ACPI for now */ + ret =3D vmclock_probe_dt(dev, st); =20 if (ret) { dev_info(dev, "Failed to obtain physical address: %d\n", ret); @@ -654,6 +704,7 @@ static int vmclock_probe(struct platform_device *pdev) return ret; =20 init_waitqueue_head(&st->disrupt_wait); + dev->driver_data =3D st; ret =3D vmclock_setup_notification(dev, st); if (ret) return ret; @@ -690,8 +741,6 @@ static int vmclock_probe(struct platform_device *pdev) return -ENODEV; } =20 - dev->driver_data =3D st; - dev_info(dev, "%s: registered %s%s%s\n", st->name, st->miscdev.minor ? "miscdev" : "", (st->miscdev.minor && st->ptp_clock) ? ", " : "", @@ -706,11 +755,18 @@ static const struct acpi_device_id vmclock_acpi_ids[]= =3D { }; MODULE_DEVICE_TABLE(acpi, vmclock_acpi_ids); =20 +static const struct of_device_id vmclock_of_ids[] =3D { + { .compatible =3D "amazon,vmclock", }, + { }, +}; +MODULE_DEVICE_TABLE(of, vmclock_of_ids); + static struct platform_driver vmclock_platform_driver =3D { .probe =3D vmclock_probe, .driver =3D { .name =3D "vmclock", .acpi_match_table =3D vmclock_acpi_ids, + .of_match_table =3D vmclock_of_ids, }, }; =20 --=20 2.34.1 From nobody Sat Feb 7 15:22:06 2026 Received: from fra-out-002.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-002.esa.eu-central-1.outbound.mail-perimeter.amazon.com [3.65.3.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A820E33CE8F; Wed, 7 Jan 2026 13:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=3.65.3.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792378; cv=none; b=EPfkLL5GnIng2tlozifw918CzUTxMb29OhiNxznaum32VvvTcbc1XYA/oHdZfeBpPF10751A+Sk/iPOyU4TGZMLT21pb6ULMAw11PGY/cSzYjbk4mO4CKupEdbZBF6pxM3pW5HBnI2tkEH1tdidpbsaUu8wRdggdyfhUA2OqBeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792378; c=relaxed/simple; bh=Vnx+w4tO6WZI7Vv/gWZsCtVnlCSNknXc7E4iblxx30g=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=Vh960ewbBlWAyx6BvEPlfELGoEWigfCAW80EIWqI5fKDZBqSQrv/bNLYj5/un3/pSaEy0Jw0nRkGRZSLvu377KQHJ1VJlWzk2HuOSuxX5YwXLUwzWKQfiYYdULXrlnu78PIqMWnsNGPlDFJNTxnLSiui0IRjN5IX9CSIYtWblw8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es; spf=pass smtp.mailfrom=amazon.es; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b=dCT/ih94; arc=none smtp.client-ip=3.65.3.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.es Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b="dCT/ih94" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.es; i=@amazon.es; q=dns/txt; s=amazoncorp2; t=1767792376; x=1799328376; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5Bx3MMmyxlhAy6Y+INEFT1pqhPUhnmaRC1X9Vcuoifc=; b=dCT/ih94ktITGlHpO2JcFPWCTcRPYe34vVtqlrWgCGiYASDb6bwdPFMH IYw5gronAPwux3BPb0zqwwBtY4RjRdF2ZJKYV80DhRYfHIcLLz30ndkcQ 6GHkH760X7P5MxS851yQyR0Rt7Nl1vKCdBQpGPcIESgcbMQbLK8bsrqoW rEkImBGPpu0e0DAEBaXSWHFZJU+C21gPugFQ3ec9SwjNd+98cyaT1UQ7q N8i6u8ZSnve4X16J4sbxUxLu44kDU9My9/jfcVol3tz57BwSUsGQ550xn eeeZVzNwrFpb8F0BG3grc21ThllxoiI2Wvgi6+YkKmgv+gvwRKk/s1ect A==; X-CSE-ConnectionGUID: zTw2wVGVQHuOvAtuQjj2mA== X-CSE-MsgGUID: Uc/8kYgxST+X+OjzoZmBkA== X-IronPort-AV: E=Sophos;i="6.21,208,1763424000"; d="scan'208";a="7583031" Received: from ip-10-6-11-83.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.11.83]) by internal-fra-out-002.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 13:26:13 +0000 Received: from EX19MTAEUC001.ant.amazon.com [54.240.197.225:14879] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.44.14:2525] with esmtp (Farcaster) id 63cc3061-c995-4d65-9a13-ba3c17942ac4; Wed, 7 Jan 2026 13:26:13 +0000 (UTC) X-Farcaster-Flow-ID: 63cc3061-c995-4d65-9a13-ba3c17942ac4 Received: from EX19D012EUA002.ant.amazon.com (10.252.50.32) by EX19MTAEUC001.ant.amazon.com (10.252.51.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:13 +0000 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19D012EUA002.ant.amazon.com (10.252.50.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:12 +0000 Received: from EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719]) by EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719%3]) with mapi id 15.02.2562.035; Wed, 7 Jan 2026 13:26:12 +0000 From: "Chalios, Babis" To: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , "dwmw2@infradead.org" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Chalios, Babis" , "Graf (AWS), Alexander" , "mzxreary@0pointer.de" , "Cali, Marco" , "Woodhouse, David" Subject: [PATCH v5 5/7] ptp: ptp_vmclock: add 'VMCLOCK' to ACPI device match Thread-Topic: [PATCH v5 5/7] ptp: ptp_vmclock: add 'VMCLOCK' to ACPI device match Thread-Index: AQHcf9kx/P0RVRKYqEe/wKI+SdlVww== Date: Wed, 7 Jan 2026 13:26:12 +0000 Message-ID: <20260107132514.437-6-bchalios@amazon.es> References: <20260107132514.437-1-bchalios@amazon.es> In-Reply-To: <20260107132514.437-1-bchalios@amazon.es> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Woodhouse As we finalised the spec, we spotted that vmgenid actually says that the _HID is supposed to be hypervisor-specific. Although in the 13 years since the original vmgenid doc was published, nobody seems to have cared about using _HID to distinguish between implementations on different hypervisors, and we only ever use the _CID. For consistency, match the _CID of "VMCLOCK" too. Signed-off-by: David Woodhouse Signed-off-by: Babis Chalios --- drivers/ptp/ptp_vmclock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index 801e14cc4799..80fc7c9e062e 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -751,6 +751,7 @@ static int vmclock_probe(struct platform_device *pdev) =20 static const struct acpi_device_id vmclock_acpi_ids[] =3D { { "AMZNC10C", 0 }, + { "VMCLOCK", 0 }, {} }; MODULE_DEVICE_TABLE(acpi, vmclock_acpi_ids); --=20 2.34.1 From nobody Sat Feb 7 15:22:06 2026 Received: from fra-out-006.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-006.esa.eu-central-1.outbound.mail-perimeter.amazon.com [18.197.217.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2B2332A3C8; Wed, 7 Jan 2026 13:27:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.197.217.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792474; cv=none; b=q5LR1HlDnsJyATl0N4IYmGQBfzqVFe9PdpNWqzDLjP0Wa1WhZmpLuOpBQzeU/1HMdzpRL1nThovtkovYX0Wf5SA1/D7Q3b5/llieC3vAtfFCbzoeVWFcvvkfFvNkGlLQ0QQkpCgIx053t7H6zZ7o8YrshKWoZcWa1l7bv0My+JM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792474; c=relaxed/simple; bh=Ti6DVNKmg5qGrzR6Izr3vZmPUKusU/KUZQ1En+vsk1Q=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=Epx4tDgCYWGe/MQrvIiGzRe5ruh356riVL90V146IjpY1W/4FJRKZ0lbSxbfQwrkendSOOCIvXhQxjo+jzGq8AW8MF4/ekrrnxNn1/o6+4rItm6WV0Xh6lXWIrTVthUf8TQ84TqnN+8zDnb4EdgyJHzrx65Zr/voKndeU+/jFWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es; spf=pass smtp.mailfrom=amazon.es; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b=E9L3e1/8; arc=none smtp.client-ip=18.197.217.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.es Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b="E9L3e1/8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.es; i=@amazon.es; q=dns/txt; s=amazoncorp2; t=1767792472; x=1799328472; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=H3uGUXvOCuNhUduxo8F66wZPo+9zml7uMCM9YxnLfJc=; b=E9L3e1/8TEB1VzHxFrM+/LRCGG8QuGK7mVFQhnXRGpn6wXXQi2lfe5/s WuG7YakxmBwubEpftrCm28pDiAaOW3SBoqFiehrVlB9I0dzzYCCv961uU 7OSBMmOMPTsXJ9bqj6DW+Tih1XvjVD0Nlw1HpVQfqkZiKmJvZQuJjbuYT 32EcyhHYCbTbUsFoakypdgk/si5wGzjV2Tnydyrxnykv2ZHnIDiGHZLOE jFuxdwUiIMpLH2C6maBlk0FFlWazvF6o2LqOTjrdWYxYPP4YDagspDM6A 4jajyHnlsSIlZo/C4bmmK8S8r1Z9rXK6VJONOxQ4XPlQYJewGZ5gJ9I5Q g==; X-CSE-ConnectionGUID: znsjwAptRtSAZ/0fqfDxBQ== X-CSE-MsgGUID: W1/19W8PS22GIPIm7R2qjw== X-IronPort-AV: E=Sophos;i="6.21,208,1763424000"; d="scan'208";a="7583657" Received: from ip-10-6-11-83.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.11.83]) by internal-fra-out-006.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 13:26:25 +0000 Received: from EX19MTAEUC002.ant.amazon.com [54.240.197.236:26786] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.4.21:2525] with esmtp (Farcaster) id 0b9a8df3-f540-4b78-b044-f04545756402; Wed, 7 Jan 2026 13:26:25 +0000 (UTC) X-Farcaster-Flow-ID: 0b9a8df3-f540-4b78-b044-f04545756402 Received: from EX19D012EUA003.ant.amazon.com (10.252.50.98) by EX19MTAEUC002.ant.amazon.com (10.252.51.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:24 +0000 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19D012EUA003.ant.amazon.com (10.252.50.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:24 +0000 Received: from EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719]) by EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719%3]) with mapi id 15.02.2562.035; Wed, 7 Jan 2026 13:26:24 +0000 From: "Chalios, Babis" To: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , "dwmw2@infradead.org" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Chalios, Babis" , "Graf (AWS), Alexander" , "mzxreary@0pointer.de" , "Cali, Marco" , "Woodhouse, David" Subject: [PATCH v5 6/7] ptp: ptp_vmclock: remove dependency on CONFIG_ACPI Thread-Topic: [PATCH v5 6/7] ptp: ptp_vmclock: remove dependency on CONFIG_ACPI Thread-Index: AQHcf9k4ohKUWhGLDU2lPfhktO8/2Q== Date: Wed, 7 Jan 2026 13:26:24 +0000 Message-ID: <20260107132514.437-7-bchalios@amazon.es> References: <20260107132514.437-1-bchalios@amazon.es> In-Reply-To: <20260107132514.437-1-bchalios@amazon.es> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Now that we added device tree support we can remove dependency on CONFIG_ACPI. Signed-off-by: David Woodhouse Signed-off-by: Babis Chalios --- drivers/ptp/Kconfig | 2 +- drivers/ptp/ptp_vmclock.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index 5f8ea34d11d6..b93640ca08b7 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig @@ -134,7 +134,7 @@ config PTP_1588_CLOCK_KVM config PTP_1588_CLOCK_VMCLOCK tristate "Virtual machine PTP clock" depends on X86_TSC || ARM_ARCH_TIMER - depends on PTP_1588_CLOCK && ACPI && ARCH_SUPPORTS_INT128 + depends on PTP_1588_CLOCK && ARCH_SUPPORTS_INT128 default PTP_1588_CLOCK_KVM help This driver adds support for using a virtual precision clock diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index 80fc7c9e062e..9f17f4a1b2be 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -501,6 +501,7 @@ static void vmclock_remove(void *data) misc_deregister(&st->miscdev); } =20 +#if IS_ENABLED(CONFIG_ACPI) static acpi_status vmclock_acpi_resources(struct acpi_resource *ares, void= *data) { struct vmclock_state *st =3D data; @@ -584,6 +585,7 @@ static int vmclock_probe_acpi(struct device *dev, struc= t vmclock_state *st) =20 return 0; } +#endif /* CONFIG_ACPI */ =20 static irqreturn_t vmclock_of_irq_handler(int __always_unused irq, void *_= st) { @@ -627,12 +629,11 @@ static int vmclock_setup_notification(struct device *= dev, if (!(le64_to_cpu(st->clk->flags) & VMCLOCK_FLAG_NOTIFICATION_PRESENT)) return 0; =20 - if (has_acpi_companion(dev)) { +#if IS_ENABLED(CONFIG_ACPI) + if (has_acpi_companion(dev)) return vmclock_setup_acpi_notification(dev); - } else { - return vmclock_setup_of_notification(dev); - } - +#endif + return vmclock_setup_of_notification(dev); } =20 =20 @@ -653,9 +654,11 @@ static int vmclock_probe(struct platform_device *pdev) if (!st) return -ENOMEM; =20 +#if IS_ENABLED(CONFIG_ACPI) if (has_acpi_companion(dev)) ret =3D vmclock_probe_acpi(dev, st); else +#endif ret =3D vmclock_probe_dt(dev, st); =20 if (ret) { --=20 2.34.1 From nobody Sat Feb 7 15:22:06 2026 Received: from fra-out-011.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-011.esa.eu-central-1.outbound.mail-perimeter.amazon.com [52.28.197.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4DE0329370; Wed, 7 Jan 2026 13:28:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.28.197.132 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792494; cv=none; b=kZ6MmlVW7isF6pfKRETpb7d3YegDel38R0zNDIt3bMvAoB9ZB2b5C0saLAjU/H6wX8qMOCkUp7fkx82tkCvtFRaIr0WklBCW3ScIk+lEXlyUqJKAx+7BRekZzDJ7+APaQ7n0iiUpuTVZ6Vl2hxDfny+XBRpzRt/s6FkMjGpBTIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767792494; c=relaxed/simple; bh=56SPx3NZaWqlHf55gYEDxW0QrPTbwVfjYUEYtgxt3gU=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=DLB/2PchS1a340vCt2EMdAB5Vllogg32spSigct9hBs/qESQa2Lc+cta0wh1xog07OHMVzqGDQg08k/XJJzZipcwHB3p4Vp6iRzgTr8Hn7lvPPY0vEw6KYgiHvG+MNdQ452BLeFtburiFMvLOHYMNM8ZQJnuJa+kzlDYdQ6sUW4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es; spf=pass smtp.mailfrom=amazon.es; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b=jX/LC4+o; arc=none smtp.client-ip=52.28.197.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.es Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.es Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.es header.i=@amazon.es header.b="jX/LC4+o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.es; i=@amazon.es; q=dns/txt; s=amazoncorp2; t=1767792492; x=1799328492; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=pWYlCloEqq1s81ftN7VRIRBv2cT68kwmWTOv6VQBqlU=; b=jX/LC4+o39lZiTvGSXRl3XAGSlwUPKgjzSpR0l8o8DsmYX/qHdrmDe6y MC79qhnGoDfB4q5Tb1QNsvNjba9larkw0EMXTAQNTWcd2YoWQiUVS6FNZ QDoPEo5WZgVsLr4inLA5luuDrJUufbxe5u4BmN5Z/NlIVzkV80WkxyTZu /Upvv34CBPRZuZUPYIZXN/7r/SwhLhVZxhAaMc4mX38tfh/1ae9tzrc5A F3yAPoGuAgyFRR/kWQcwkpfqE0swKnMJkemeyZ7StE9TPPZJAr24jlIty cKzGth0q558bNAqKBrTvNOaCMQlEzlKRJsFTa48/e6yHy/evucXM/u0s4 Q==; X-CSE-ConnectionGUID: uwteCHfpQNGxT0P7GCHsMQ== X-CSE-MsgGUID: 7dsqaItRQpGThU2mZZ1i+g== X-IronPort-AV: E=Sophos;i="6.21,208,1763424000"; d="scan'208";a="7469563" Received: from ip-10-6-11-83.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.11.83]) by internal-fra-out-011.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2026 13:26:45 +0000 Received: from EX19MTAEUA001.ant.amazon.com [54.240.197.233:26223] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.29.28:2525] with esmtp (Farcaster) id 3cd3cefa-1156-46e5-b73f-a3f1871c1613; Wed, 7 Jan 2026 13:26:44 +0000 (UTC) X-Farcaster-Flow-ID: 3cd3cefa-1156-46e5-b73f-a3f1871c1613 Received: from EX19D012EUA002.ant.amazon.com (10.252.50.32) by EX19MTAEUA001.ant.amazon.com (10.252.50.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:35 +0000 Received: from EX19D012EUA001.ant.amazon.com (10.252.50.122) by EX19D012EUA002.ant.amazon.com (10.252.50.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 7 Jan 2026 13:26:35 +0000 Received: from EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719]) by EX19D012EUA001.ant.amazon.com ([fe80::b7ea:84f7:2c4b:2719%3]) with mapi id 15.02.2562.035; Wed, 7 Jan 2026 13:26:35 +0000 From: "Chalios, Babis" To: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , "dwmw2@infradead.org" , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Chalios, Babis" , "Graf (AWS), Alexander" , "mzxreary@0pointer.de" , "Cali, Marco" , "Woodhouse, David" Subject: [PATCH v5 7/7] ptp: ptp_vmclock: return TAI not UTC Thread-Topic: [PATCH v5 7/7] ptp: ptp_vmclock: return TAI not UTC Thread-Index: AQHcf9k+JQEWfJl2KUO9UtZeCJ/L7w== Date: Wed, 7 Jan 2026 13:26:35 +0000 Message-ID: <20260107132514.437-8-bchalios@amazon.es> References: <20260107132514.437-1-bchalios@amazon.es> In-Reply-To: <20260107132514.437-1-bchalios@amazon.es> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Woodhouse To output UTC would involve complex calculations about whether the time elapsed since the reference time has crossed the end of the month when a leap second takes effect. I've prototyped that, but it made me sad. Much better to report TAI, which is what PHCs should do anyway. And much much simpler. Signed-off-by: David Woodhouse Signed-off-by: Babis Chalios --- drivers/ptp/ptp_vmclock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index 9f17f4a1b2be..ef5c2a66d9b8 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -83,13 +83,13 @@ static uint64_t mul_u64_u64_shr_add_u64(uint64_t *res_h= i, uint64_t delta, =20 static bool tai_adjust(struct vmclock_abi *clk, uint64_t *sec) { - if (likely(clk->time_type =3D=3D VMCLOCK_TIME_UTC)) + if (clk->time_type =3D=3D VMCLOCK_TIME_TAI) return true; =20 - if (clk->time_type =3D=3D VMCLOCK_TIME_TAI && + if (clk->time_type =3D=3D VMCLOCK_TIME_UTC && (le64_to_cpu(clk->flags) & VMCLOCK_FLAG_TAI_OFFSET_VALID)) { if (sec) - *sec +=3D (int16_t)le16_to_cpu(clk->tai_offset_sec); + *sec -=3D (int16_t)le16_to_cpu(clk->tai_offset_sec); return true; } return false; @@ -350,9 +350,9 @@ static struct ptp_clock *vmclock_ptp_register(struct de= vice *dev, return NULL; } =20 - /* Only UTC, or TAI with offset */ + /* Accept TAI directly, or UTC with valid offset for conversion to TAI */ if (!tai_adjust(st->clk, NULL)) { - dev_info(dev, "vmclock does not provide unambiguous UTC\n"); + dev_info(dev, "vmclock does not provide unambiguous time\n"); return NULL; } =20 --=20 2.34.1