From nobody Sat Feb 7 15:12:31 2026 Received: from pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com [35.83.148.184]) (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 71998423A64; Wed, 21 Jan 2026 14:34:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.83.148.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006062; cv=none; b=j0JKPfrGBuQjIgHFLSN5CpItJ/oz4ucKDWS8QHKQT5RW1l4BNE8tfj9NeQPWqtfXgCg1Il0X4rgfKUAUduMv/57fRAqcHRiR3/AcCkG2gBngDwNNjYt6GxDOzZ+o8mA6UBS0rY8Cc/1B9nZYVJhe5jOpwsXFC6w0UhVHpcRsp70= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006062; c=relaxed/simple; bh=MPUpUJgzzfHudJXEi5vg0C4okW8qVV8H4BssMKuJ9vc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=F0P1dZKG4e0IImHZ8vSGm7MEh5XVbcWAGDkY+JHKsaiU77CLUj0/fF87xRx6+zWfrcn++4nepn9avyG2Be6O1Jwwu0h+ehPVX1zq2fFTTaB/MwqsKSD48nbjuuGt9h8QQ/0kkXe5z0lED1H8Wm26P7ZsTViHIuWXA2K5gIspqDY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=Tdy0eYmE; arc=none smtp.client-ip=35.83.148.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="Tdy0eYmE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769006060; x=1800542060; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oKwikhUEneq7kTC3ndykcYJektlKHtMVROcOvRNkC0s=; b=Tdy0eYmEUQzNp7qTRXK22cp009URlr2IyL4P63bYbhMwlYu1Q93geW1c tVkjTfSuD/nGjaoZogKnpSGnABQTF2wq7wDRLaRuzgY1pbzkWme+cUNpq xT7m6KZeKkqlEoZkeLgco53VZMgksPihjB6mQUSTgn96Z6IVlkpViwV96 ENWzZz3XifCZ6BJJCX15QeQke5cDZadbseQQy0+h6xvNJdnGHQ0Y2Jtf1 b0+AHu0P6Ibtw3QNWcBfRLYZ0m6SbfuWecDFOEit61heeTchyCk2jWtod 5e47lo+ggEkSoNpy4PP84hVD4qA8GW2jydif+mcGG1StRNaEW+3YwcL/l Q==; X-CSE-ConnectionGUID: W+lsB/mDRYGqtppXNXnRFQ== X-CSE-MsgGUID: Opv0/6nQRmOBvmtnU6E1jw== X-IronPort-AV: E=Sophos;i="6.21,242,1763424000"; d="scan'208";a="11089716" Received: from ip-10-5-9-48.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.9.48]) by internal-pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 14:34:17 +0000 Received: from EX19MTAUWC002.ant.amazon.com [205.251.233.51:19109] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.37.11:2525] with esmtp (Farcaster) id 52e7a185-456f-449e-b682-b71aedfc8ed8; Wed, 21 Jan 2026 14:34:17 +0000 (UTC) X-Farcaster-Flow-ID: 52e7a185-456f-449e-b682-b71aedfc8ed8 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:17 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:14 +0000 From: Takahiro Itazuri To: , , , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v6 1/7] ptp: vmclock: add vm generation counter Date: Wed, 21 Jan 2026 14:33:38 +0000 Message-ID: <20260121143402.3092-2-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121143402.3092-1-itazur@amazon.com> References: <20260121143402.3092-1-itazur@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D031UWA003.ant.amazon.com (10.13.139.47) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Type: text/plain; charset="utf-8" From: "Babis Chalios" 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.47.3 From nobody Sat Feb 7 15:12:31 2026 Received: from pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.246.68.102]) (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 9CF3B26C3AE; Wed, 21 Jan 2026 14:34:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=44.246.68.102 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006069; cv=none; b=hZMKlJAsQPko+7KTlbqDgcCqJo8gduZcva1bb+MuJh2nH4vez/nrOISpJVRIYIyHyJvqU6LSQrCataEdZr2wkYUDXTtHQaKWZtemChpJ/WllwkE8INv2o12JEkJ0nUnGZfgnQU2OAbuelCCw57OAXy4l0I/nYfgxfLs8emrl3C4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006069; c=relaxed/simple; bh=Lp3GOCm3/pAkrjTxnPBfS9n2Yl7qtouomJnYKdFMEog=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wi1b8/KRofEZroVcKAuJEvrOgk4s2m8HOSIoHzWM6h9IzF1C6KkFigsRFSrp2m12dbDed7JHciOwkH2P5RGMHZpmOtUXLpm0NIq8fVH1S8LtN8kPj1UZXAemyKqR7WxkyK4E/JLOYqP3v6r229ihaB58KmubckPvziphIr6pQeY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=RXYTetfq; arc=none smtp.client-ip=44.246.68.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="RXYTetfq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769006067; x=1800542067; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=85P+lDf7W0uZl7b0fai6toak+e6G1un7jTh+wPxwnWc=; b=RXYTetfqbeSvJHYrx7DE7SovpaPlCvDnIWcpiE96tQd+SdAMkJyG6FnH igkWmt0pfXzsogiZoIGTtBiGo7U/dyUd1iVFtt8mBGt1uENVqHhUPzlwd BVSp1DUtF8A0v8zHtj4JK30wyCU/Dv12jx9W4H4ITL6dCtJLgkLSrsa4Y 0ij1g9fM8LvgR4VTxy5L/09NlTYV/fW1BJATL2/iLa+dkhh7yMRvuE4s2 ophNXMcQfzWAVSIZWvNaQnwjzxVqHSi9xh4LDVtSAMDQcybCLHl21bcc8 BEX0ZTJNhFinFrCtvYa34P2ESizrDKE/3c6vA5gi1JSarx3zmCjE8fBuZ Q==; X-CSE-ConnectionGUID: gzFLvCynRyOxDon/Hhufrg== X-CSE-MsgGUID: 7zaWckV0RZmRkEUGv4spGQ== X-IronPort-AV: E=Sophos;i="6.21,242,1763424000"; d="scan'208";a="11311056" Received: from ip-10-5-6-203.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.6.203]) by internal-pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 14:34:25 +0000 Received: from EX19MTAUWB002.ant.amazon.com [205.251.233.111:4604] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.14.244:2525] with esmtp (Farcaster) id ae457860-ed8c-47bb-9878-ee7b715d9c5d; Wed, 21 Jan 2026 14:34:25 +0000 (UTC) X-Farcaster-Flow-ID: ae457860-ed8c-47bb-9878-ee7b715d9c5d Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWB002.ant.amazon.com (10.250.64.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:24 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:21 +0000 From: Takahiro Itazuri To: , , , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v6 2/7] ptp: vmclock: support device notifications Date: Wed, 21 Jan 2026 14:33:39 +0000 Message-ID: <20260121143402.3092-3-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121143402.3092-1-itazur@amazon.com> References: <20260121143402.3092-1-itazur@amazon.com> 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" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D046UWA002.ant.amazon.com (10.13.139.39) To EX19D001UWA001.ant.amazon.com (10.13.138.214) From: "Babis Chalios" 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.47.3 From nobody Sat Feb 7 15:12:31 2026 Received: from pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.246.68.102]) (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 6D12A449ED0; Wed, 21 Jan 2026 14:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=44.246.68.102 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006077; cv=none; b=D/ikCnJxrO4n5sJRE2QB0mAxCpthpa9t4IVnLJdHHSg1TI6grs//Dt4SGJhWFu3rAy0PLKGNQF94nl633IorrPgUYcJnabNaVkSbqlWu8u5PZEZNtGTZ2elirt/1y0MUIL6vsjWlEAFlNuy1qbujEpr/k0UTKI3Q7comy6hhrOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006077; c=relaxed/simple; bh=V+qFlUU26dtxhI42O1LyyPXxUUYrP0KuA+/fr8CCTWo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fFbkZUKoBHlrfVtQVVPnDNfHvU5v1q+ziOGhvVOzQ6jONx4nc7XB4z4H/UR9lLONfw8Ka0tnHclBIArx8DdzM9x5+hr9tmDlDn3584ffM4nW8yBT7tNySk3XNxGYZjqmmDof3UTGFK+Ru6D4o46fHzBL5ozfzuqv+d/aGsha9Ic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=P+wPNkDh; arc=none smtp.client-ip=44.246.68.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="P+wPNkDh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769006074; x=1800542074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GnB0Zjrn1rkk2yBuHfgwsZRUTblWJqAEa2P5e7SgUS8=; b=P+wPNkDh/jpDeVbAm/57wdJv6KeFS1owp8F5uQpRRtq9Iq/td6A728Ry CsFzQlLGsluSbdnxLRsbr1S+f75m/5lqQM73w/nyMvTeXmih8y6JV1KvP Dy8KXqUWc+wK3TI6CmehDRGob32T/K4olsx/SedsHgM6v4aSJV1J2aDtk 7T1kBHLZHUv+WKKo4Whu+ARk0RXd+WhJixId/5uGj+/s+HfD+yRjHa1JF xCtCDaZ6soSWkw096L5ig+FCo4Hrxou+JbqyT2HgDEauVxbbh+pul64BY IJ7/jrKH9qvBi+AwxdYv/HmM5zqHI35sIe+YHKQcROQmb45QWnFmwl/b/ w==; X-CSE-ConnectionGUID: C4fGUt72Qdixu8U/aQwc9g== X-CSE-MsgGUID: Cu5NmpH2RCqP8y3vkUNV9g== X-IronPort-AV: E=Sophos;i="6.21,242,1763424000"; d="scan'208";a="11311079" Received: from ip-10-5-12-219.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.12.219]) by internal-pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 14:34:32 +0000 Received: from EX19MTAUWC002.ant.amazon.com [205.251.233.51:6551] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.27.220:2525] with esmtp (Farcaster) id 78ead78d-5660-4e66-8e07-c138e99f30b6; Wed, 21 Jan 2026 14:34:32 +0000 (UTC) X-Farcaster-Flow-ID: 78ead78d-5660-4e66-8e07-c138e99f30b6 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:31 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:28 +0000 From: Takahiro Itazuri To: , , , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v6 3/7] dt-bindings: ptp: Add amazon,vmclock Date: Wed, 21 Jan 2026 14:33:40 +0000 Message-ID: <20260121143402.3092-4-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121143402.3092-1-itazur@amazon.com> References: <20260121143402.3092-1-itazur@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D041UWA001.ant.amazon.com (10.13.139.124) To EX19D001UWA001.ant.amazon.com (10.13.138.214) 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 da9dbc1a4019..0dd35070fe9b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21025,6 +21025,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.47.3 From nobody Sat Feb 7 15:12:31 2026 Received: from pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.35.192.45]) (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 750B946AF34; Wed, 21 Jan 2026 14:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.35.192.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006086; cv=none; b=lVg+YpXZWSotfq70bgJivdFG+ihO5d4tZSX/CxCn0pmEph0eeX0soXoHdxyDDsz6GPhhWhb6F800Crm7RH2vFav41vwAFJh9uHttkSKnCCd25WBDO+fsiAP3ngEx+Ju7WzIY8D/flKDPvhHxXLD1LJ4JxwBHD5zrRGe+GafWwbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006086; c=relaxed/simple; bh=Wyjt5j0MSPUTGhX5/gxgjd9pNhNBVOCn12i3hU16UUE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DuC/PD1nZ9SSOXcgxIyMG+6S5gSH5hiskOiPk0CKtnGsOWBxDuDQNFdt7O6r93Rw9/GJXiF9ZNODUnDKPSGOWp/KjkXpj+XxsEyf+iSTPP67HIZdFuw2ik1mEUCO/8Zq5xiqvFlIY/uIvehfVjuc9ADSSKhQx2+x6h0droCOvAk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=nQMs9/OI; arc=none smtp.client-ip=52.35.192.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="nQMs9/OI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769006083; x=1800542083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uW31CrHkZb/NKZG8IVePzIRSaNVbZs1c92ImhXgCTzY=; b=nQMs9/OIf8O78wfswpTzbKmDDpwl+mbl23yIPzxrJTg6NpFEFF9IJEjC NmJhTFGfE/Gy/joWtnV39UgWPIVpSmQL9NFxZqoHcoSiZYib/jwZtn2wq gJ9OZSNPSH/7glnbsAzOVzNJbzFmEvzifT4XcWntckV5RDhQanbJZLjUe KKwn4fpV9f6QVTAmxwkmkdjD/CLzWNi7Oe5IGkP97mFNPSiARDxEPM7iO HdXAJo248LJkQ/SPcr3aklyh9X08wpnk3lpylY7IGMp2zaGYx/uL3wU59 iHhDoEe4NiAC+xADRfS1lpj3/yTvs3Anf4T29QAnrA95BUY2cH6pdQaAI w==; X-CSE-ConnectionGUID: 6ur7NnJSRD662DUteQOM1Q== X-CSE-MsgGUID: c/a+aS3BSTeEwi/hd+K/nQ== X-IronPort-AV: E=Sophos;i="6.21,242,1763424000"; d="scan'208";a="11093519" Received: from ip-10-5-0-115.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115]) by internal-pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 14:34:39 +0000 Received: from EX19MTAUWC002.ant.amazon.com [205.251.233.51:10765] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.27.220:2525] with esmtp (Farcaster) id 22e797d9-6f2d-4454-ac8c-6cbfa32f8b23; Wed, 21 Jan 2026 14:34:39 +0000 (UTC) X-Farcaster-Flow-ID: 22e797d9-6f2d-4454-ac8c-6cbfa32f8b23 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:38 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:35 +0000 From: Takahiro Itazuri To: , , , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v6 4/7] ptp: ptp_vmclock: Add device tree support Date: Wed, 21 Jan 2026 14:33:41 +0000 Message-ID: <20260121143402.3092-5-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121143402.3092-1-itazur@amazon.com> References: <20260121143402.3092-1-itazur@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D033UWA002.ant.amazon.com (10.13.139.10) To EX19D001UWA001.ant.amazon.com (10.13.138.214) 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 | 70 ++++++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index 38b2bacb755e..8605e441fad7 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,55 @@ 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 +654,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 +702,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 +739,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 +753,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.47.3 From nobody Sat Feb 7 15:12:31 2026 Received: from pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.34.181.151]) (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 B387B4BCAB0; Wed, 21 Jan 2026 14:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.34.181.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006091; cv=none; b=onRmjxkNadBXk5sFENedmRqjNIdXDL+X/Z5ZIQ1kwFHwfRsBIH0QIWz4SlrWqNCx+sHsU1NeoH4RsVhCdN/ngAuIHBljXS5+6kS2SVCemfRBBPXszNgsVlJVaDNtUw1uuShVWVx/chzKHUsZqQJoTWs12CLpISgETdkGh8fNEeY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006091; c=relaxed/simple; bh=BNVNoS/X+EeH0JkRQ6ZfkVSqrk6Vq3EjvhE/WAVPm3Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HSgVbDAXWMpSdhHr4Ahf5E7uoNQZZ20qZq8LM3WniDiFKNcpbyzUxjAavSWeIB+HOhmti79J56xnplsWoQfs8NTbp8p2QrTMjJlFpw010xRtLxHvH6hBkHlfbJ9dFx1jAVOpYqjLj7WX5o+g9SgjCJSROhzcfIjF0AWMODSEtfo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=nFjT/Kd6; arc=none smtp.client-ip=52.34.181.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="nFjT/Kd6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769006089; x=1800542089; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5FqRCHwtM2CGLbcYhd42nWIqDE7JkoWPCz6/NSC/xrQ=; b=nFjT/Kd6daq3Gnj6pJakKOf8abc3l2+mru0yR5+u2PuCivLeJOpTNcd+ ppSlpj4I8yIg4EzJuHJawZxf8kn8mIbIbf9uESkfJ+J9VFn/2WFp6p3ps VdoGgh8MzM/4Mr/SeHPmvWOT1DqM92vnvor24y1uyzOjp9na7iJCAKOTk hpL7UPxAZX85VN5L+B8w9TEkBfh+aPItkGeCYlFeTOoom4y4D2wNMO16T hzEaVL8njq1qqdJ0qH3mmuOS8wu7w7oOZPkQ/JKRTnXYc9M1879aeCYui t1GG8q61RsrxD+8JeME6SKbvlndSRXs0YCCDW0mtI6Tzh4wBdyr+cIXaG A==; X-CSE-ConnectionGUID: h5qSvot8QHawOXrIP3ZXsQ== X-CSE-MsgGUID: nrodrx8aSgqHwFXB7K87jA== X-IronPort-AV: E=Sophos;i="6.21,242,1763424000"; d="scan'208";a="11313589" Received: from ip-10-5-9-48.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.9.48]) by internal-pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 14:34:46 +0000 Received: from EX19MTAUWA002.ant.amazon.com [205.251.233.234:18929] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.41.221:2525] with esmtp (Farcaster) id 4bc89515-80eb-4bcf-8d15-5dc3e811d086; Wed, 21 Jan 2026 14:34:45 +0000 (UTC) X-Farcaster-Flow-ID: 4bc89515-80eb-4bcf-8d15-5dc3e811d086 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:45 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:42 +0000 From: Takahiro Itazuri To: , , , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v6 5/7] ptp: ptp_vmclock: add 'VMCLOCK' to ACPI device match Date: Wed, 21 Jan 2026 14:33:42 +0000 Message-ID: <20260121143402.3092-6-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121143402.3092-1-itazur@amazon.com> References: <20260121143402.3092-1-itazur@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D035UWA004.ant.amazon.com (10.13.139.109) To EX19D001UWA001.ant.amazon.com (10.13.138.214) 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 8605e441fad7..b5e264264051 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -749,6 +749,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.47.3 From nobody Sat Feb 7 15:12:31 2026 Received: from pdx-out-010.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-010.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.12.53.23]) (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 6E2E14BCAD5; Wed, 21 Jan 2026 14:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.12.53.23 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006097; cv=none; b=bqtcMWYgZm5Z0nR2Rc+CbGCvTb6HHdD4H2dB8iIEAMvUdJzY86glbOpNhKz73FtyXUqAtPL3beH6vrHKoA4MEE5hPMSgq/lj9E92BdBDjiwhl71RfX5GwihnTaEY9NF+QnXCJz830OrPdYN8tj5MNWwUpVC1gTiZu8/9F2986n4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006097; c=relaxed/simple; bh=zvY9YEG+wOzSsIgZFouqI4EOQZ2ONGmU/Ic/rZTtxy4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ydy/jLeJ01U08fK5R74d8x6lNU0oC9HVSSmYrvstRntaXO/dKYErJ3daHl8BSLlljGmxlTTxJxwHKebHwFo5S0Vwuhzo2uUwPLr7Mv2d4twsBiXGjzoQK6k4YL0Rkx8ND9qFT32HG/JYcyK7+G50vqEEa9u5ghFmAYfQTUNwHJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=pSBbPTQp; arc=none smtp.client-ip=52.12.53.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="pSBbPTQp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769006096; x=1800542096; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Tnl6MqmXsFXKs7o7pIswHuCAMSMn0lU/0P5sxp57FXE=; b=pSBbPTQppXTfXcjlolhZu+vSL/cPMNe52lc+Vca8x6k2zycksfZd+kc5 +XLn1eVyDjdFA//oQSH+67ZlmQQYFpeYZrMrFHkgyURp01foscO/Zj4Fo ff3pJJWWqtmF78RJ/9AkakACHvYRdNdVE8Xd7/8vBui/24Z1R7VHHmsj6 n+AQIX7fZMyyIoRn1GUe09UMQbPRGawU2eqQtbB1ls4XH9z6j94QEisOk yqyUhUDsdAGWAIXn8pJNgWp5Fj9sM31I1TsxWBv0hOQojs3opPuAmuXdx Jbp5j7cguL3o6BNqA5SjdH2c5s01YQOBEPT/E+mUw4TU6nwhhkhePBRnU g==; X-CSE-ConnectionGUID: muGqYszjRRueXSRfH2RDHw== X-CSE-MsgGUID: RvVEGyqhSSCT3oMZS3n8eA== X-IronPort-AV: E=Sophos;i="6.21,242,1763424000"; d="scan'208";a="11186516" Received: from ip-10-5-9-48.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.9.48]) by internal-pdx-out-010.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 14:34:53 +0000 Received: from EX19MTAUWB001.ant.amazon.com [205.251.233.51:25276] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.41.221:2525] with esmtp (Farcaster) id eb4cb863-62b9-4ba4-84ae-0280611100c6; Wed, 21 Jan 2026 14:34:53 +0000 (UTC) X-Farcaster-Flow-ID: eb4cb863-62b9-4ba4-84ae-0280611100c6 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWB001.ant.amazon.com (10.250.64.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:53 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:50 +0000 From: Takahiro Itazuri To: , , , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v6 6/7] ptp: ptp_vmclock: remove dependency on CONFIG_ACPI Date: Wed, 21 Jan 2026 14:33:43 +0000 Message-ID: <20260121143402.3092-7-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121143402.3092-1-itazur@amazon.com> References: <20260121143402.3092-1-itazur@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D035UWA002.ant.amazon.com (10.13.139.60) To EX19D001UWA001.ant.amazon.com (10.13.138.214) 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 | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 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 b5e264264051..55ec3cda3995 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,11 +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 static void vmclock_put_idx(void *data) @@ -651,9 +653,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.47.3 From nobody Sat Feb 7 15:12:31 2026 Received: from pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.35.192.45]) (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 EF4123A7F58; Wed, 21 Jan 2026 14:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.35.192.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006104; cv=none; b=oIyV7/VKs+fnxudjjJGaoW/bHjtbddsGCB804SZ5mpm2+xqXOYPgw6eSpGG/sYaBOL8WsQGM4XbEm8v3jYHShTmFUKLXttXIwZaOqHp84nEnOMn8Kg2vqvFc8MwoB5c8hme1a5KInHf/5I2QpgObc9sMC8Wj3ncX8JlLSizSdiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006104; c=relaxed/simple; bh=4kTJcLmYGzRCj4IKX4oNLKlCTvwFwEiSzIa5dY7keno=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=psBlANAyqCPb/+Tdqsl2AVXmVE6w+MKuWliRgxREuhSvngff5IC109sAVer3oF7p50vErnffY6fkmQiLpSH/tn1rm/rIMVRf9eKAVRineXLazAx3eEWPI5tRdpyDuec4jeEIBAGyLIQXz4YiRFiyvjp1H4fB4CmvNabyZA2JdJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=UODvhtRk; arc=none smtp.client-ip=52.35.192.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="UODvhtRk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769006102; x=1800542102; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0rhk6SMiUX4DX71gJT40pzZWSzRz9RPlP3yDXcP1Qj8=; b=UODvhtRk1GDZ5HXknWzBcUVt8lmZmP7r1Ik16hBfUU6OWkL3a/euCWsq o9e4e/rty55mMNAGSW7AVsjvkaCWE64yZhdjnVOosf8/NlnSjMzgsQgwq c5lo40zq+FeGCb3JU52gKNYFoPvZxkPpJPFRC7KHTskyb08f+dvguifVf 7AlV6m2NER6HhDol3QqA0fUx2YdLs4dsqnzcZQI4fd/dsG4MJnx+RS5Bk o+HM++5DInuWMITDfrkwTVkcTRTWqTm/xXaAfHe2dhbhXPn05YqrW192p JPc4Zq6GKr0MX1TEpO3z2lZkSCAJiLVSBzHdWUx34m7LPxql3m0CMYNv5 g==; X-CSE-ConnectionGUID: XfwFkXjbQFi3pm5sENoVEA== X-CSE-MsgGUID: +/0dyjK6QTuQ7fAQU9OwOg== X-IronPort-AV: E=Sophos;i="6.21,242,1763424000"; d="scan'208";a="11093535" Received: from ip-10-5-6-203.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.6.203]) by internal-pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 14:35:02 +0000 Received: from EX19MTAUWC002.ant.amazon.com [205.251.233.51:18279] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.14.244:2525] with esmtp (Farcaster) id 40835c61-feff-4f8f-89b1-4b3d3f82deb9; Wed, 21 Jan 2026 14:35:02 +0000 (UTC) X-Farcaster-Flow-ID: 40835c61-feff-4f8f-89b1-4b3d3f82deb9 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:35:00 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 14:34:57 +0000 From: Takahiro Itazuri To: , , , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v6 7/7] ptp: ptp_vmclock: return TAI not UTC Date: Wed, 21 Jan 2026 14:33:44 +0000 Message-ID: <20260121143402.3092-8-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121143402.3092-1-itazur@amazon.com> References: <20260121143402.3092-1-itazur@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D040UWB001.ant.amazon.com (10.13.138.82) To EX19D001UWA001.ant.amazon.com (10.13.138.214) 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 55ec3cda3995..6cf63a86c997 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.47.3