Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    
https://github.com/0day-ci/linux/commits/sundeep-lkml-gmail-com/Add-PTP-support-for-Octeontx2/20200707-163310
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
d47a72152097d7be7cfc453d205196c0aa976c33
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

All error/warnings (new ones prefixed by >>):

>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:14:22: error: field 
>> 'cycle_counter' has incomplete type
      14 |  struct cyclecounter cycle_counter;
         |                      ^~~~~~~~~~~~~
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:15:21: error: field 
>> 'time_counter' has incomplete type
      15 |  struct timecounter time_counter;
         |                     ^~~~~~~~~~~~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from include/linux/ptp_clock_kernel.h:11,
                    from 
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:4:
   drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c: In function 
'ptp_cc_read':
>> include/linux/kernel.h:1003:32: error: dereferencing pointer to incomplete 
>> type 'const struct cyclecounter'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro 
'__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro 
'_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 
'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:44:25: note: in 
>> expansion of macro 'container_of'
      44 |  struct otx2_ptp *ptp = container_of(cc, struct otx2_ptp, 
cycle_counter);
         |                         ^~~~~~~~~~~~
   drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c: In function 
'otx2_ptp_adjtime':
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:77:2: error: implicit 
>> declaration of function 'timecounter_adjtime' 
>> [-Werror=implicit-function-declaration]
      77 |  timecounter_adjtime(&ptp->time_counter, delta);
         |  ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c: In function 
'otx2_ptp_gettime':
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:92:9: error: implicit 
>> declaration of function 'timecounter_read'; did you mean 'refcount_read'? 
>> [-Werror=implicit-function-declaration]
      92 |  nsec = timecounter_read(&ptp->time_counter);
         |         ^~~~~~~~~~~~~~~~
         |         refcount_read
   drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c: In function 
'otx2_ptp_settime':
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:111:2: error: implicit 
>> declaration of function 'timecounter_init'; did you mean 'timerqueue_init'? 
>> [-Werror=implicit-function-declaration]
     111 |  timecounter_init(&ptp->time_counter, &ptp->cycle_counter, nsec);
         |  ^~~~~~~~~~~~~~~~
         |  timerqueue_init
   drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c: In function 
'otx2_ptp_init':
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:156:4: error: 
>> dereferencing pointer to incomplete type 'struct cyclecounter'
     156 |  cc->read = ptp_cc_read;
         |    ^~
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:157:13: error: 
>> implicit declaration of function 'CYCLECOUNTER_MASK' 
>> [-Werror=implicit-function-declaration]
     157 |  cc->mask = CYCLECOUNTER_MASK(64);
         |             ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c: In function 
'otx2_ptp_tstamp2time':
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c:216:10: error: 
>> implicit declaration of function 'timecounter_cyc2time' 
>> [-Werror=implicit-function-declaration]
     216 |  *tsns = timecounter_cyc2time(&pfvf->ptp->time_counter, tstamp);
         |          ^~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/cycle_counter +14 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c

     8  
     9  struct otx2_ptp {
    10          struct ptp_clock_info ptp_info;
    11          struct ptp_clock *ptp_clock;
    12          struct otx2_nic *nic;
    13  
  > 14          struct cyclecounter cycle_counter;
  > 15          struct timecounter time_counter;
    16  };
    17  
    18  static int otx2_ptp_adjfine(struct ptp_clock_info *ptp_info, long 
scaled_ppm)
    19  {
    20          struct otx2_ptp *ptp = container_of(ptp_info, struct otx2_ptp,
    21                                              ptp_info);
    22          struct ptp_req *req;
    23          int err;
    24  
    25          if (!ptp->nic)
    26                  return -ENODEV;
    27  
    28          req = otx2_mbox_alloc_msg_ptp_op(&ptp->nic->mbox);
    29          if (!req)
    30                  return -ENOMEM;
    31  
    32          req->op = PTP_OP_ADJFINE;
    33          req->scaled_ppm = scaled_ppm;
    34  
    35          err = otx2_sync_mbox_msg(&ptp->nic->mbox);
    36          if (err)
    37                  return err;
    38  
    39          return 0;
    40  }
    41  
    42  static u64 ptp_cc_read(const struct cyclecounter *cc)
    43  {
  > 44          struct otx2_ptp *ptp = container_of(cc, struct otx2_ptp, 
cycle_counter);
    45          struct ptp_req *req;
    46          struct ptp_rsp *rsp;
    47          int err;
    48  
    49          if (!ptp->nic)
    50                  return 0;
    51  
    52          req = otx2_mbox_alloc_msg_ptp_op(&ptp->nic->mbox);
    53          if (!req)
    54                  return 0;
    55  
    56          req->op = PTP_OP_GET_CLOCK;
    57  
    58          err = otx2_sync_mbox_msg(&ptp->nic->mbox);
    59          if (err)
    60                  return 0;
    61  
    62          rsp = (struct ptp_rsp *)otx2_mbox_get_rsp(&ptp->nic->mbox.mbox, 
0,
    63                                                    &req->hdr);
    64          if (IS_ERR(rsp))
    65                  return 0;
    66  
    67          return rsp->clk;
    68  }
    69  
    70  static int otx2_ptp_adjtime(struct ptp_clock_info *ptp_info, s64 delta)
    71  {
    72          struct otx2_ptp *ptp = container_of(ptp_info, struct otx2_ptp,
    73                                              ptp_info);
    74          struct otx2_nic *pfvf = ptp->nic;
    75  
    76          mutex_lock(&pfvf->mbox.lock);
  > 77          timecounter_adjtime(&ptp->time_counter, delta);
    78          mutex_unlock(&pfvf->mbox.lock);
    79  
    80          return 0;
    81  }
    82  
    83  static int otx2_ptp_gettime(struct ptp_clock_info *ptp_info,
    84                              struct timespec64 *ts)
    85  {
    86          struct otx2_ptp *ptp = container_of(ptp_info, struct otx2_ptp,
    87                                              ptp_info);
    88          struct otx2_nic *pfvf = ptp->nic;
    89          u64 nsec;
    90  
    91          mutex_lock(&pfvf->mbox.lock);
  > 92          nsec = timecounter_read(&ptp->time_counter);
    93          mutex_unlock(&pfvf->mbox.lock);
    94  
    95          *ts = ns_to_timespec64(nsec);
    96  
    97          return 0;
    98  }
    99  
   100  static int otx2_ptp_settime(struct ptp_clock_info *ptp_info,
   101                              const struct timespec64 *ts)
   102  {
   103          struct otx2_ptp *ptp = container_of(ptp_info, struct otx2_ptp,
   104                                              ptp_info);
   105          struct otx2_nic *pfvf = ptp->nic;
   106          u64 nsec;
   107  
   108          nsec = timespec64_to_ns(ts);
   109  
   110          mutex_lock(&pfvf->mbox.lock);
 > 111          timecounter_init(&ptp->time_counter, &ptp->cycle_counter, nsec);
   112          mutex_unlock(&pfvf->mbox.lock);
   113  
   114          return 0;
   115  }
   116  
   117  static int otx2_ptp_enable(struct ptp_clock_info *ptp_info,
   118                             struct ptp_clock_request *rq, int on)
   119  {
   120          return -EOPNOTSUPP;
   121  }
   122  
   123  int otx2_ptp_init(struct otx2_nic *pfvf)
   124  {
   125          struct otx2_ptp *ptp_ptr;
   126          struct cyclecounter *cc;
   127          struct ptp_req *req;
   128          int err;
   129  
   130          mutex_lock(&pfvf->mbox.lock);
   131          /* check if PTP block is available */
   132          req = otx2_mbox_alloc_msg_ptp_op(&pfvf->mbox);
   133          if (!req) {
   134                  mutex_unlock(&pfvf->mbox.lock);
   135                  return -ENOMEM;
   136          }
   137  
   138          req->op = PTP_OP_GET_CLOCK;
   139  
   140          err = otx2_sync_mbox_msg(&pfvf->mbox);
   141          if (err) {
   142                  mutex_unlock(&pfvf->mbox.lock);
   143                  return err;
   144          }
   145          mutex_unlock(&pfvf->mbox.lock);
   146  
   147          ptp_ptr = kzalloc(sizeof(*ptp_ptr), GFP_KERNEL);
   148          if (!ptp_ptr) {
   149                  err = -ENOMEM;
   150                  goto error;
   151          }
   152  
   153          ptp_ptr->nic = pfvf;
   154  
   155          cc = &ptp_ptr->cycle_counter;
 > 156          cc->read = ptp_cc_read;
 > 157          cc->mask = CYCLECOUNTER_MASK(64);
   158          cc->mult = 1;
   159          cc->shift = 0;
   160  
   161          timecounter_init(&ptp_ptr->time_counter, 
&ptp_ptr->cycle_counter,
   162                           ktime_to_ns(ktime_get_real()));
   163  
   164          ptp_ptr->ptp_info = (struct ptp_clock_info) {
   165                  .owner          = THIS_MODULE,
   166                  .name           = "OcteonTX2 PTP",
   167                  .max_adj        = 1000000000ull,
   168                  .n_ext_ts       = 0,
   169                  .n_pins         = 0,
   170                  .pps            = 0,
   171                  .adjfine        = otx2_ptp_adjfine,
   172                  .adjtime        = otx2_ptp_adjtime,
   173                  .gettime64      = otx2_ptp_gettime,
   174                  .settime64      = otx2_ptp_settime,
   175                  .enable         = otx2_ptp_enable,
   176          };
   177  
   178          ptp_ptr->ptp_clock = ptp_clock_register(&ptp_ptr->ptp_info, 
pfvf->dev);
   179          if (IS_ERR(ptp_ptr->ptp_clock)) {
   180                  err = PTR_ERR(ptp_ptr->ptp_clock);
   181                  kfree(ptp_ptr);
   182                  goto error;
   183          }
   184  
   185          pfvf->ptp = ptp_ptr;
   186  
   187  error:
   188          return err;
   189  }
   190  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to