lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD2QZ9b9+TP1YnpL0DkNqn5kdgxseMooBr8xJ9fMu+0tgtX=vA@mail.gmail.com>
Date: Wed, 22 Oct 2025 22:57:56 +0530
From: Ajay Kaher <ajay.kaher@...adcom.com>
To: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
Cc: kuba@...nel.org, davem@...emloft.net, richardcochran@...il.com, 
	nick.shi@...adcom.com, alexey.makhalov@...adcom.com, andrew+netdev@...n.ch, 
	edumazet@...gle.com, pabeni@...hat.com, jiashengjiangcool@...il.com, 
	andrew@...n.ch, viswanathiyyappan@...il.com, wei.fang@....com, 
	rmk+kernel@...linux.org.uk, vladimir.oltean@....com, cjubran@...dia.com, 
	dtatulea@...dia.com, tariqt@...dia.com, netdev@...r.kernel.org, 
	bcm-kernel-feedback-list@...adcom.com, linux-kernel@...r.kernel.org, 
	florian.fainelli@...adcom.com, vamsi-krishna.brahmajosyula@...adcom.com, 
	tapas.kundu@...adcom.com, shubham-sg.gupta@...adcom.com, 
	karen.wang@...adcom.com, hari-krishna.ginka@...adcom.com
Subject: Re: [PATCH v2 1/2] ptp/ptp_vmw: Implement PTP clock adjustments ops

On Wed, Oct 22, 2025 at 4:43 PM Vadim Fedorenko
<vadim.fedorenko@...ux.dev> wrote:
>
> On 22/10/2025 11:51, Ajay Kaher wrote:
> > Implement PTP clock ops that set time and frequency of the underlying
> > clock. On supported versions of VMware precision clock virtual device,
> > new commands can adjust its time and frequency, allowing time transfer
> > from a virtual machine to the underlying hypervisor.
> >
> > In case of error, vmware_hypercall doesn't return Linux defined errno,
> > converting it to -EIO.
> >
> > Cc: Shubham Gupta <shubham-sg.gupta@...adcom.com>
> > Cc: Nick Shi <nick.shi@...adcom.com>
> > Tested-by: Karen Wang <karen.wang@...adcom.com>
> > Tested-by: Hari Krishna Ginka <hari-krishna.ginka@...adcom.com>
> > Signed-off-by: Ajay Kaher <ajay.kaher@...adcom.com>
> > ---
> >   drivers/ptp/ptp_vmw.c | 39 +++++++++++++++++++++++++++++----------
> >   1 file changed, 29 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/ptp/ptp_vmw.c b/drivers/ptp/ptp_vmw.c
> > index 20ab05c4d..7d117eee4 100644
> > --- a/drivers/ptp/ptp_vmw.c
> > +++ b/drivers/ptp/ptp_vmw.c
> > @@ -1,6 +1,7 @@
> >   // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
> >   /*
> > - * Copyright (C) 2020 VMware, Inc., Palo Alto, CA., USA
> > + * Copyright (C) 2020-2023 VMware, Inc., Palo Alto, CA., USA
> > + * Copyright (C) 2024-2025 Broadcom Ltd.
> >    *
> >    * PTP clock driver for VMware precision clock virtual device.
> >    */
> > @@ -16,20 +17,36 @@
> >
> >   #define VMWARE_CMD_PCLK(nr) ((nr << 16) | 97)
> >   #define VMWARE_CMD_PCLK_GETTIME VMWARE_CMD_PCLK(0)
> > +#define VMWARE_CMD_PCLK_SETTIME VMWARE_CMD_PCLK(1)
> > +#define VMWARE_CMD_PCLK_ADJTIME VMWARE_CMD_PCLK(2)
> > +#define VMWARE_CMD_PCLK_ADJFREQ VMWARE_CMD_PCLK(3)
> >
> >   static struct acpi_device *ptp_vmw_acpi_device;
> >   static struct ptp_clock *ptp_vmw_clock;
> >
> > +/*
> > + * Helpers for reading and writing to precision clock device.
> > + */
> >
> > -static int ptp_vmw_pclk_read(u64 *ns)
> > +static int ptp_vmw_pclk_read(int cmd, u64 *ns)
> >   {
> >       u32 ret, nsec_hi, nsec_lo;
> >
> > -     ret = vmware_hypercall3(VMWARE_CMD_PCLK_GETTIME, 0,
> > -                             &nsec_hi, &nsec_lo);
> > +     ret = vmware_hypercall3(cmd, 0, &nsec_hi, &nsec_lo);
> >       if (ret == 0)
> >               *ns = ((u64)nsec_hi << 32) | nsec_lo;
> > -     return ret;
> > +
> > +     return ret != 0 ? -EIO : 0;
> > +}
>
> Why do you need to introduce this change? VMWARE_CMD_PCLK_GETTIME is
> the only command used in read() in both patches of this patchset.
>

Vadim, thanks for looking into patches.

I have added ptp_vmw_pclk_write() where cmd has been passed as argument.
Keeping the same format for ptp_vmw_pclk_read() as well, also may be useful
in future.

Let me know if you think it's better to keep ptp_vmw_pclk_read() as it
is. I will
revert in v3.

-Ajay

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5414 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ