[baolu:iommu/next/20200514 4/16] drivers/iommu/intel-svm.c:369 intel_svm_bind_gpasid() error: 'svm' dereferencing possible ERR_PTR()
by Dan Carpenter
tree: baolu/iommu/next/20200514
head: 28c528ddc9501f8caba71dba375bd1d35403dd4b
commit: 64e95c1afbadc5601bc100f6424b1848888613f7 [4/16] iommu/vt-d: Add bind guest PASID support
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/iommu/intel-svm.c:369 intel_svm_bind_gpasid() error: 'svm' dereferencing possible ERR_PTR()
git remote add baolu git://bee.sh.intel.com/git/blu2/usb.git
git remote update baolu
git checkout 64e95c1afbadc5601bc100f6424b1848888613f7
vim +/svm +369 drivers/iommu/intel-svm.c
64e95c1afbadc5 Jacob Pan 2020-05-14 229 int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
64e95c1afbadc5 Jacob Pan 2020-05-14 230 struct iommu_gpasid_bind_data *data)
64e95c1afbadc5 Jacob Pan 2020-05-14 231 {
64e95c1afbadc5 Jacob Pan 2020-05-14 232 struct intel_iommu *iommu = intel_svm_device_to_iommu(dev);
64e95c1afbadc5 Jacob Pan 2020-05-14 233 struct dmar_domain *dmar_domain;
64e95c1afbadc5 Jacob Pan 2020-05-14 234 struct intel_svm_dev *sdev;
64e95c1afbadc5 Jacob Pan 2020-05-14 235 struct intel_svm *svm;
64e95c1afbadc5 Jacob Pan 2020-05-14 236 int ret = 0;
64e95c1afbadc5 Jacob Pan 2020-05-14 237
64e95c1afbadc5 Jacob Pan 2020-05-14 238 if (WARN_ON(!iommu) || !data)
64e95c1afbadc5 Jacob Pan 2020-05-14 239 return -EINVAL;
64e95c1afbadc5 Jacob Pan 2020-05-14 240
64e95c1afbadc5 Jacob Pan 2020-05-14 241 if (data->version != IOMMU_GPASID_BIND_VERSION_1 ||
64e95c1afbadc5 Jacob Pan 2020-05-14 242 data->format != IOMMU_PASID_FORMAT_INTEL_VTD)
64e95c1afbadc5 Jacob Pan 2020-05-14 243 return -EINVAL;
64e95c1afbadc5 Jacob Pan 2020-05-14 244
64e95c1afbadc5 Jacob Pan 2020-05-14 245 if (dev_is_pci(dev)) {
64e95c1afbadc5 Jacob Pan 2020-05-14 246 /* VT-d supports devices with full 20 bit PASIDs only */
64e95c1afbadc5 Jacob Pan 2020-05-14 247 if (pci_max_pasids(to_pci_dev(dev)) != PASID_MAX)
64e95c1afbadc5 Jacob Pan 2020-05-14 248 return -EINVAL;
64e95c1afbadc5 Jacob Pan 2020-05-14 249 } else {
64e95c1afbadc5 Jacob Pan 2020-05-14 250 return -ENOTSUPP;
64e95c1afbadc5 Jacob Pan 2020-05-14 251 }
64e95c1afbadc5 Jacob Pan 2020-05-14 252
64e95c1afbadc5 Jacob Pan 2020-05-14 253 /*
64e95c1afbadc5 Jacob Pan 2020-05-14 254 * We only check host PASID range, we have no knowledge to check
64e95c1afbadc5 Jacob Pan 2020-05-14 255 * guest PASID range.
64e95c1afbadc5 Jacob Pan 2020-05-14 256 */
64e95c1afbadc5 Jacob Pan 2020-05-14 257 if (data->hpasid <= 0 || data->hpasid >= PASID_MAX)
64e95c1afbadc5 Jacob Pan 2020-05-14 258 return -EINVAL;
64e95c1afbadc5 Jacob Pan 2020-05-14 259
64e95c1afbadc5 Jacob Pan 2020-05-14 260 dmar_domain = to_dmar_domain(domain);
64e95c1afbadc5 Jacob Pan 2020-05-14 261
64e95c1afbadc5 Jacob Pan 2020-05-14 262 mutex_lock(&pasid_mutex);
64e95c1afbadc5 Jacob Pan 2020-05-14 263 svm = ioasid_find(NULL, data->hpasid, NULL);
64e95c1afbadc5 Jacob Pan 2020-05-14 264 if (IS_ERR(svm)) {
64e95c1afbadc5 Jacob Pan 2020-05-14 265 ret = PTR_ERR(svm);
64e95c1afbadc5 Jacob Pan 2020-05-14 266 goto out;
^^^^^^^^
Goto out is always a warning sign... The label name should say what the
goto does like "goto unlock;"
64e95c1afbadc5 Jacob Pan 2020-05-14 267 }
64e95c1afbadc5 Jacob Pan 2020-05-14 268
64e95c1afbadc5 Jacob Pan 2020-05-14 269 if (svm) {
64e95c1afbadc5 Jacob Pan 2020-05-14 270 /*
64e95c1afbadc5 Jacob Pan 2020-05-14 271 * If we found svm for the PASID, there must be at
64e95c1afbadc5 Jacob Pan 2020-05-14 272 * least one device bond, otherwise svm should be freed.
64e95c1afbadc5 Jacob Pan 2020-05-14 273 */
64e95c1afbadc5 Jacob Pan 2020-05-14 274 if (WARN_ON(list_empty(&svm->devs))) {
64e95c1afbadc5 Jacob Pan 2020-05-14 275 ret = -EINVAL;
64e95c1afbadc5 Jacob Pan 2020-05-14 276 goto out;
64e95c1afbadc5 Jacob Pan 2020-05-14 277 }
64e95c1afbadc5 Jacob Pan 2020-05-14 278
64e95c1afbadc5 Jacob Pan 2020-05-14 279 for_each_svm_dev(sdev, svm, dev) {
64e95c1afbadc5 Jacob Pan 2020-05-14 280 /*
64e95c1afbadc5 Jacob Pan 2020-05-14 281 * For devices with aux domains, we should allow
64e95c1afbadc5 Jacob Pan 2020-05-14 282 * multiple bind calls with the same PASID and pdev.
64e95c1afbadc5 Jacob Pan 2020-05-14 283 */
64e95c1afbadc5 Jacob Pan 2020-05-14 284 if (iommu_dev_feature_enabled(dev,
64e95c1afbadc5 Jacob Pan 2020-05-14 285 IOMMU_DEV_FEAT_AUX)) {
64e95c1afbadc5 Jacob Pan 2020-05-14 286 sdev->users++;
64e95c1afbadc5 Jacob Pan 2020-05-14 287 } else {
64e95c1afbadc5 Jacob Pan 2020-05-14 288 dev_warn_ratelimited(dev,
64e95c1afbadc5 Jacob Pan 2020-05-14 289 "Already bound with PASID %u\n",
64e95c1afbadc5 Jacob Pan 2020-05-14 290 svm->pasid);
64e95c1afbadc5 Jacob Pan 2020-05-14 291 ret = -EBUSY;
64e95c1afbadc5 Jacob Pan 2020-05-14 292 }
64e95c1afbadc5 Jacob Pan 2020-05-14 293 goto out;
64e95c1afbadc5 Jacob Pan 2020-05-14 294 }
64e95c1afbadc5 Jacob Pan 2020-05-14 295 } else {
64e95c1afbadc5 Jacob Pan 2020-05-14 296 /* We come here when PASID has never been bond to a device. */
64e95c1afbadc5 Jacob Pan 2020-05-14 297 svm = kzalloc(sizeof(*svm), GFP_KERNEL);
64e95c1afbadc5 Jacob Pan 2020-05-14 298 if (!svm) {
64e95c1afbadc5 Jacob Pan 2020-05-14 299 ret = -ENOMEM;
64e95c1afbadc5 Jacob Pan 2020-05-14 300 goto out;
This is also a problem.
64e95c1afbadc5 Jacob Pan 2020-05-14 301 }
64e95c1afbadc5 Jacob Pan 2020-05-14 302 /* REVISIT: upper layer/VFIO can track host process that bind
64e95c1afbadc5 Jacob Pan 2020-05-14 303 * the PASID. ioasid_set = mm might be sufficient for vfio to
64e95c1afbadc5 Jacob Pan 2020-05-14 304 * check pasid VMM ownership. We can drop the following line
64e95c1afbadc5 Jacob Pan 2020-05-14 305 * once VFIO and IOASID set check is in place.
64e95c1afbadc5 Jacob Pan 2020-05-14 306 */
64e95c1afbadc5 Jacob Pan 2020-05-14 307 svm->mm = get_task_mm(current);
64e95c1afbadc5 Jacob Pan 2020-05-14 308 svm->pasid = data->hpasid;
64e95c1afbadc5 Jacob Pan 2020-05-14 309 if (data->flags & IOMMU_SVA_GPASID_VAL) {
64e95c1afbadc5 Jacob Pan 2020-05-14 310 svm->gpasid = data->gpasid;
64e95c1afbadc5 Jacob Pan 2020-05-14 311 svm->flags |= SVM_FLAG_GUEST_PASID;
64e95c1afbadc5 Jacob Pan 2020-05-14 312 }
64e95c1afbadc5 Jacob Pan 2020-05-14 313 ioasid_set_data(data->hpasid, svm);
64e95c1afbadc5 Jacob Pan 2020-05-14 314 INIT_LIST_HEAD_RCU(&svm->devs);
64e95c1afbadc5 Jacob Pan 2020-05-14 315 mmput(svm->mm);
64e95c1afbadc5 Jacob Pan 2020-05-14 316 }
64e95c1afbadc5 Jacob Pan 2020-05-14 317 sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
64e95c1afbadc5 Jacob Pan 2020-05-14 318 if (!sdev) {
64e95c1afbadc5 Jacob Pan 2020-05-14 319 ret = -ENOMEM;
64e95c1afbadc5 Jacob Pan 2020-05-14 320 goto out;
64e95c1afbadc5 Jacob Pan 2020-05-14 321 }
64e95c1afbadc5 Jacob Pan 2020-05-14 322 sdev->dev = dev;
64e95c1afbadc5 Jacob Pan 2020-05-14 323
64e95c1afbadc5 Jacob Pan 2020-05-14 324 /* Only count users if device has aux domains */
64e95c1afbadc5 Jacob Pan 2020-05-14 325 if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX))
64e95c1afbadc5 Jacob Pan 2020-05-14 326 sdev->users = 1;
64e95c1afbadc5 Jacob Pan 2020-05-14 327
64e95c1afbadc5 Jacob Pan 2020-05-14 328 /* Set up device context entry for PASID if not enabled already */
64e95c1afbadc5 Jacob Pan 2020-05-14 329 ret = intel_iommu_enable_pasid(iommu, sdev->dev);
64e95c1afbadc5 Jacob Pan 2020-05-14 330 if (ret) {
64e95c1afbadc5 Jacob Pan 2020-05-14 331 dev_err_ratelimited(dev, "Failed to enable PASID capability\n");
64e95c1afbadc5 Jacob Pan 2020-05-14 332 kfree(sdev);
64e95c1afbadc5 Jacob Pan 2020-05-14 333 goto out;
64e95c1afbadc5 Jacob Pan 2020-05-14 334 }
64e95c1afbadc5 Jacob Pan 2020-05-14 335
64e95c1afbadc5 Jacob Pan 2020-05-14 336 /*
64e95c1afbadc5 Jacob Pan 2020-05-14 337 * PASID table is per device for better security. Therefore, for
64e95c1afbadc5 Jacob Pan 2020-05-14 338 * each bind of a new device even with an existing PASID, we need to
64e95c1afbadc5 Jacob Pan 2020-05-14 339 * call the nested mode setup function here.
64e95c1afbadc5 Jacob Pan 2020-05-14 340 */
64e95c1afbadc5 Jacob Pan 2020-05-14 341 spin_lock(&iommu->lock);
64e95c1afbadc5 Jacob Pan 2020-05-14 342 ret = intel_pasid_setup_nested(iommu,
64e95c1afbadc5 Jacob Pan 2020-05-14 343 dev,
64e95c1afbadc5 Jacob Pan 2020-05-14 344 (pgd_t *)data->gpgd,
64e95c1afbadc5 Jacob Pan 2020-05-14 345 data->hpasid,
64e95c1afbadc5 Jacob Pan 2020-05-14 346 &data->vtd,
64e95c1afbadc5 Jacob Pan 2020-05-14 347 dmar_domain,
64e95c1afbadc5 Jacob Pan 2020-05-14 348 data->addr_width);
64e95c1afbadc5 Jacob Pan 2020-05-14 349 spin_unlock(&iommu->lock);
64e95c1afbadc5 Jacob Pan 2020-05-14 350 if (ret) {
64e95c1afbadc5 Jacob Pan 2020-05-14 351 dev_err_ratelimited(dev, "Failed to set up PASID %llu in nested mode, Err %d\n",
64e95c1afbadc5 Jacob Pan 2020-05-14 352 data->hpasid, ret);
64e95c1afbadc5 Jacob Pan 2020-05-14 353 /*
64e95c1afbadc5 Jacob Pan 2020-05-14 354 * PASID entry should be in cleared state if nested mode
64e95c1afbadc5 Jacob Pan 2020-05-14 355 * set up failed. So we only need to clear IOASID tracking
64e95c1afbadc5 Jacob Pan 2020-05-14 356 * data such that free call will succeed.
64e95c1afbadc5 Jacob Pan 2020-05-14 357 */
64e95c1afbadc5 Jacob Pan 2020-05-14 358 kfree(sdev);
64e95c1afbadc5 Jacob Pan 2020-05-14 359 goto out;
64e95c1afbadc5 Jacob Pan 2020-05-14 360 }
64e95c1afbadc5 Jacob Pan 2020-05-14 361
64e95c1afbadc5 Jacob Pan 2020-05-14 362 svm->flags |= SVM_FLAG_GUEST_MODE;
64e95c1afbadc5 Jacob Pan 2020-05-14 363
64e95c1afbadc5 Jacob Pan 2020-05-14 364 init_rcu_head(&sdev->rcu);
64e95c1afbadc5 Jacob Pan 2020-05-14 365 list_add_rcu(&sdev->list, &svm->devs);
64e95c1afbadc5 Jacob Pan 2020-05-14 366 out:
64e95c1afbadc5 Jacob Pan 2020-05-14 367 if (list_empty(&svm->devs)) {
^^^^^^^^^^
Oops.
64e95c1afbadc5 Jacob Pan 2020-05-14 368 ioasid_set_data(data->hpasid, NULL);
64e95c1afbadc5 Jacob Pan 2020-05-14 @369 kfree(svm);
64e95c1afbadc5 Jacob Pan 2020-05-14 370 }
64e95c1afbadc5 Jacob Pan 2020-05-14 371
64e95c1afbadc5 Jacob Pan 2020-05-14 372 mutex_unlock(&pasid_mutex);
64e95c1afbadc5 Jacob Pan 2020-05-14 373 return ret;
64e95c1afbadc5 Jacob Pan 2020-05-14 374 }
64e95c1afbadc5 Jacob Pan 2020-05-14 375
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
[hch-misc:kernel_setsockopt 6/32] net/core/sock.c:758:19: warning: comparison is always true due to limited range of data type
by kbuild test robot
tree: git://git.infradead.org/users/hch/misc.git kernel_setsockopt
head: 43d0f0870df329db68ecbae8e699615ff0c009f1
commit: f7fa6070e761f3e00b46dac42bd9d550367e26a7 [6/32] net: add sock_set_sndtimeo
config: um-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
git checkout f7fa6070e761f3e00b46dac42bd9d550367e26a7
# save the attached .config to linux build tree
make ARCH=um
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
In file included from include/linux/kernel.h:11:0,
from include/linux/unaligned/access_ok.h:5,
from arch/x86/include/asm/unaligned.h:9,
from net/core/sock.c:88:
include/asm-generic/fixmap.h: In function 'fix_to_virt':
include/asm-generic/fixmap.h:32:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
^
include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
if (!(condition)) ^~~~~~~~~
include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
^~~~~~~~~~~~
In file included from include/linux/uaccess.h:11:0,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:34,
from include/linux/huge_mm.h:8,
from include/linux/mm.h:679,
from include/linux/bvec.h:13,
from include/linux/skbuff.h:17,
from include/linux/ip.h:16,
from include/net/ip.h:22,
from include/linux/errqueue.h:6,
from net/core/sock.c:91:
arch/um/include/asm/uaccess.h: In function '__access_ok':
arch/um/include/asm/uaccess.h:17:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
(((unsigned long) (addr) >= FIXADDR_USER_START) && ^
arch/um/include/asm/uaccess.h:45:3: note: in expansion of macro '__access_ok_vsyscall'
__access_ok_vsyscall(addr, size) ||
^~~~~~~~~~~~~~~~~~~~
net/core/sock.c: In function 'sock_set_sndtimeo':
>> net/core/sock.c:758:19: warning: comparison is always true due to limited range of data type [-Wtype-limits]
if (secs && secs < MAX_SCHEDULE_TIMEOUT / HZ - 1)
^
vim +758 net/core/sock.c
754
755 void sock_set_sndtimeo(struct sock *sk, unsigned int secs)
756 {
757 lock_sock(sk);
> 758 if (secs && secs < MAX_SCHEDULE_TIMEOUT / HZ - 1)
759 sk->sk_sndtimeo = secs * HZ;
760 else
761 sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
762 release_sock(sk);
763 }
764 EXPORT_SYMBOL(sock_set_sndtimeo);
765
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
[avpatel:riscv_clint_v1 8/9] drivers/clocksource/timer-clint.c:45:15: error: variable 'clint_ipi_ops' has initializer but incomplete type
by kbuild test robot
tree: https://github.com/avpatel/linux.git riscv_clint_v1
head: a3dcfcb9ca3fec50ed0e957c648a050f934a7e70
commit: cae3a9a14e033b2c9ce074eb6ee6d607b5a7202b [8/9] clocksource/drivers: Add CLINT driver
config: riscv-allnoconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout cae3a9a14e033b2c9ce074eb6ee6d607b5a7202b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/clocksource/timer-clint.c:45:15: error: variable 'clint_ipi_ops' has initializer but incomplete type
45 | static struct riscv_ipi_ops clint_ipi_ops = {
| ^~~~~~~~~~~~~
>> drivers/clocksource/timer-clint.c:46:3: error: 'struct riscv_ipi_ops' has no member named 'ipi_inject'
46 | .ipi_inject = clint_send_ipi,
| ^~~~~~~~~~
>> drivers/clocksource/timer-clint.c:46:16: warning: excess elements in struct initializer
46 | .ipi_inject = clint_send_ipi,
| ^~~~~~~~~~~~~~
drivers/clocksource/timer-clint.c:46:16: note: (near initialization for 'clint_ipi_ops')
>> drivers/clocksource/timer-clint.c:47:3: error: 'struct riscv_ipi_ops' has no member named 'ipi_clear'
47 | .ipi_clear = clint_clear_ipi,
| ^~~~~~~~~
drivers/clocksource/timer-clint.c:47:15: warning: excess elements in struct initializer
47 | .ipi_clear = clint_clear_ipi,
| ^~~~~~~~~~~~~~~
drivers/clocksource/timer-clint.c:47:15: note: (near initialization for 'clint_ipi_ops')
drivers/clocksource/timer-clint.c: In function 'clint_timer_init_dt':
>> drivers/clocksource/timer-clint.c:172:2: error: implicit declaration of function 'riscv_set_ipi_ops' [-Werror=implicit-function-declaration]
172 | riscv_set_ipi_ops(&clint_ipi_ops);
| ^~~~~~~~~~~~~~~~~
drivers/clocksource/timer-clint.c: At top level:
>> drivers/clocksource/timer-clint.c:45:29: error: storage size of 'clint_ipi_ops' isn't known
45 | static struct riscv_ipi_ops clint_ipi_ops = {
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/clint_ipi_ops +45 drivers/clocksource/timer-clint.c
44
> 45 static struct riscv_ipi_ops clint_ipi_ops = {
> 46 .ipi_inject = clint_send_ipi,
> 47 .ipi_clear = clint_clear_ipi,
48 };
49
50 #ifdef CONFIG_64BIT
51 #define clint_get_cycles() readq_relaxed(clint_time_val)
52 #else
53 #define clint_get_cycles() readl_relaxed(clint_time_val)
54 #define clint_get_cycles_hi() readl_relaxed(((u32 *)clint_time_val) + 1)
55 #endif
56
57 #ifdef CONFIG_64BIT
58 static u64 clint_get_cycles64(void)
59 {
60 return clint_get_cycles();
61 }
62 #else /* CONFIG_64BIT */
63 static u64 clint_get_cycles64(void)
64 {
65 u32 hi, lo;
66
67 do {
68 hi = clint_get_cycles_hi();
69 lo = clint_get_cycles();
70 } while (hi != clint_get_cycles_hi());
71
72 return ((u64)hi << 32) | lo;
73 }
74 #endif /* CONFIG_64BIT */
75
76 static int clint_clock_next_event(unsigned long delta,
77 struct clock_event_device *ce)
78 {
79 void __iomem *r = clint_time_cmp +
80 cpuid_to_hartid_map(smp_processor_id());
81
82 csr_set(CSR_IE, IE_TIE);
83 writeq_relaxed(clint_get_cycles64() + delta, r);
84 return 0;
85 }
86
87 static DEFINE_PER_CPU(struct clock_event_device, clint_clock_event) = {
88 .name = "clint_clockevent",
89 .features = CLOCK_EVT_FEAT_ONESHOT,
90 .rating = 100,
91 .set_next_event = clint_clock_next_event,
92 };
93
94 static u64 clint_rdtime(struct clocksource *cs)
95 {
96 return readq_relaxed(clint_time_val);
97 }
98
99 static u64 notrace clint_sched_clock(void)
100 {
101 return readq_relaxed(clint_time_val);
102 }
103
104 static struct clocksource clint_clocksource = {
105 .name = "clint_clocksource",
106 .rating = 300,
107 .mask = CLOCKSOURCE_MASK(64),
108 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
109 .read = clint_rdtime,
110 };
111
112 static int clint_timer_starting_cpu(unsigned int cpu)
113 {
114 struct clock_event_device *ce = per_cpu_ptr(&clint_clock_event, cpu);
115
116 ce->cpumask = cpumask_of(cpu);
117 clockevents_config_and_register(ce, clint_freq, 100, 0x7fffffff);
118
119 csr_set(CSR_IE, IE_TIE);
120 return 0;
121 }
122
123 static int clint_timer_dying_cpu(unsigned int cpu)
124 {
125 csr_clear(CSR_IE, IE_TIE);
126 return 0;
127 }
128
129 /* called directly from the low-level interrupt handler */
130 void riscv_timer_interrupt(void)
131 {
132 struct clock_event_device *evdev = this_cpu_ptr(&clint_clock_event);
133
134 csr_clear(CSR_IE, IE_TIE);
135 evdev->event_handler(evdev);
136 }
137
138 static int __init clint_timer_init_dt(struct device_node *np)
139 {
140 int rc;
141 void __iomem *base;
142
143 base = of_iomap(np, 0);
144 if (!base) {
145 pr_err("%pOFP: could not map registers\n", np);
146 return -ENODEV;
147 }
148
149 clint_ipi_base = base + CLINT_IPI_OFF;
150 clint_time_cmp = base + CLINT_TIME_CMP_OFF;
151 clint_time_val = base + CLINT_TIME_VAL_OFF;
152 clint_freq = riscv_timebase;
153
154 rc = clocksource_register_hz(&clint_clocksource, clint_freq);
155 if (rc) {
156 iounmap(base);
157 pr_err("%pOFP: clocksource register failed [%d]\n", np, rc);
158 return rc;
159 }
160
161 sched_clock_register(clint_sched_clock, 64, clint_freq);
162
163 rc = cpuhp_setup_state(CPUHP_AP_CLINT_TIMER_STARTING,
164 "clockevents/clint/timer:starting",
165 clint_timer_starting_cpu, clint_timer_dying_cpu);
166 if (rc) {
167 iounmap(base);
168 pr_err("%pOFP: cpuhp setup state failed [%d]\n", np, rc);
169 return rc;
170 }
171
> 172 riscv_set_ipi_ops(&clint_ipi_ops);
173 clint_clear_ipi();
174
175 pr_info("%pOFP: timer running at %ld Hz\n", np, clint_freq);
176
177 return 0;
178 }
179
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
[linux-sof-driver:pr/2088 1/11] drivers/soundwire/qcom.c:881:2: error: implicit declaration of function 'sdw_delete_bus_master'
by kbuild test robot
tree: https://github.com/thesofproject/linux pr/2088
head: b7b26d7f347a38bdf2a75ce61f25a5e5cddaff66
commit: 3f2a586205030f4f1159bfd21f278690e6afdd22 [1/11] soundwire: bus: rename sdw_bus_master_add/delete, add arguments
config: arm64-sof-customedconfig-nobloat-imx-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 3f2a586205030f4f1159bfd21f278690e6afdd22
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
drivers/soundwire/qcom.c: In function 'qcom_swrm_remove':
>> drivers/soundwire/qcom.c:881:2: error: implicit declaration of function 'sdw_delete_bus_master' [-Werror=implicit-function-declaration]
881 | sdw_delete_bus_master(&ctrl->bus);
| ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/sdw_delete_bus_master +881 drivers/soundwire/qcom.c
02efb49aa805cee Srinivas Kandagatla 2020-01-13 875
02efb49aa805cee Srinivas Kandagatla 2020-01-13 876 static int qcom_swrm_remove(struct platform_device *pdev)
02efb49aa805cee Srinivas Kandagatla 2020-01-13 877 {
02efb49aa805cee Srinivas Kandagatla 2020-01-13 878 struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
5156c376c827fdc Pierre-Louis Bossart 2020-03-17 879 int err;
02efb49aa805cee Srinivas Kandagatla 2020-01-13 880
02efb49aa805cee Srinivas Kandagatla 2020-01-13 @881 sdw_delete_bus_master(&ctrl->bus);
5156c376c827fdc Pierre-Louis Bossart 2020-03-17 882 err = sdw_master_device_del(ctrl->md);
5156c376c827fdc Pierre-Louis Bossart 2020-03-17 883 if (err < 0)
5156c376c827fdc Pierre-Louis Bossart 2020-03-17 884 dev_err(&pdev->dev, "master device del failed %d\n", err);
02efb49aa805cee Srinivas Kandagatla 2020-01-13 885 clk_disable_unprepare(ctrl->hclk);
02efb49aa805cee Srinivas Kandagatla 2020-01-13 886
02efb49aa805cee Srinivas Kandagatla 2020-01-13 887 return 0;
02efb49aa805cee Srinivas Kandagatla 2020-01-13 888 }
02efb49aa805cee Srinivas Kandagatla 2020-01-13 889
:::::: The code at line 881 was first introduced by commit
:::::: 02efb49aa805cee643a643ab61a1118c2fd08b80 soundwire: qcom: add support for SoundWire controller
:::::: TO: Srinivas Kandagatla <srinivas.kandagatla(a)linaro.org>
:::::: CC: Vinod Koul <vkoul(a)kernel.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
Re: [PATCH v2 1/4] counter: Internalize sysfs interface code
by kbuild test robot
Hi William,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.7-rc6 next-20200519]
[cannot apply to stm32/stm32-next linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/William-Breathitt-Gray/Introduce...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 12bf0b632ed090358cbf03e323e5342212d0b2e4
config: arm64-randconfig-r026-20200519 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/counter/counter-sysfs.c:850:5: warning: no previous prototype for function 'counter_sysfs_add' [-Wmissing-prototypes]
int counter_sysfs_add(struct counter_device *const counter)
^
drivers/counter/counter-sysfs.c:850:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int counter_sysfs_add(struct counter_device *const counter)
^
static
>> drivers/counter/counter-sysfs.c:876:6: warning: no previous prototype for function 'counter_sysfs_free' [-Wmissing-prototypes]
void counter_sysfs_free(struct counter_device *const counter)
^
drivers/counter/counter-sysfs.c:876:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void counter_sysfs_free(struct counter_device *const counter)
^
static
2 warnings generated.
vim +/counter_sysfs_add +850 drivers/counter/counter-sysfs.c
849
> 850 int counter_sysfs_add(struct counter_device *const counter)
851 {
852 int err;
853
854 /* Initialize Synapse names list */
855 INIT_LIST_HEAD(&counter->dynamic_names_list);
856
857 /* Prepare device attributes */
858 err = counter_groups_list_prepare(counter);
859 if (err)
860 goto err_free_names;
861
862 /* Organize device attributes to groups and match to device */
863 err = counter_groups_prepare(counter);
864 if (err)
865 goto err_free_groups_list;
866
867 return 0;
868
869 err_free_groups_list:
870 counter_groups_list_free(counter);
871 err_free_names:
872 counter_dynamic_names_free(&counter->dynamic_names_list);
873 return err;
874 }
875
> 876 void counter_sysfs_free(struct counter_device *const counter)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
[linux-next:master 8243/10701] ld: drivers/usb/typec/tps6598x.c:208: undefined reference to `usb_role_switch_set_role'
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: fb57b1fabcb28f358901b2df90abd2b48abc1ca8
commit: 18a6c866bb191f360a16db6a79e005247dd3fd70 [8243/10701] usb: typec: tps6598x: Add USB role switching logic
config: x86_64-randconfig-a005-20200519 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
git checkout 18a6c866bb191f360a16db6a79e005247dd3fd70
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
ld: drivers/usb/typec/tps6598x.o: in function `tps6598x_set_data_role':
drivers/usb/typec/tps6598x.c:208: undefined reference to `usb_role_switch_set_role'
>> ld: drivers/usb/typec/tps6598x.c:208: undefined reference to `usb_role_switch_set_role'
ld: drivers/usb/typec/tps6598x.o: in function `tps6598x_remove':
drivers/usb/typec/tps6598x.c:604: undefined reference to `usb_role_switch_put'
ld: drivers/usb/typec/tps6598x.o: in function `tps6598x_set_data_role':
drivers/usb/typec/tps6598x.c:208: undefined reference to `usb_role_switch_set_role'
ld: drivers/usb/typec/tps6598x.o: in function `tps6598x_probe':
drivers/usb/typec/tps6598x.c:522: undefined reference to `fwnode_usb_role_switch_get'
ld: drivers/usb/typec/tps6598x.c:591: undefined reference to `usb_role_switch_put'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
drivers/mux/adgs1408.c:112:34: warning: unused variable 'adgs1408_of_match'
by kbuild test robot
Hi Chris,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 115a54162a6c0d0ef2aef25ebd0b61fc5e179ebe
commit: e9e40543ad5b38b848879768359fd13650529961 spi: Add generic SPI multiplexer
date: 3 months ago
config: x86_64-randconfig-r022-20200519 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout e9e40543ad5b38b848879768359fd13650529961
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
drivers/mux/adgs1408.c:62:12: warning: cast to smaller integer type 'enum adgs1408_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast]
chip_id = (enum adgs1408_chip_id)of_device_get_match_data(dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mux/adgs1408.c:112:34: warning: unused variable 'adgs1408_of_match' [-Wunused-const-variable]
static const struct of_device_id adgs1408_of_match[] = {
^
2 warnings generated.
vim +/adgs1408_of_match +112 drivers/mux/adgs1408.c
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 111
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 @112 static const struct of_device_id adgs1408_of_match[] = {
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 113 { .compatible = "adi,adgs1408", .data = (void *)ADGS1408, },
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 114 { .compatible = "adi,adgs1409", .data = (void *)ADGS1409, },
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 115 { }
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 116 };
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 117 MODULE_DEVICE_TABLE(of, adgs1408_of_match);
8b9ce6954c05e3 Mircea Caprioru 2018-08-01 118
:::::: The code at line 112 was first introduced by commit
:::::: 8b9ce6954c05e3e4115f54444c7eaf2aa2dd5e65 mux: adgs1408: new driver for Analog Devices ADGS1408/1409 mux
:::::: TO: Mircea Caprioru <mircea.caprioru(a)analog.com>
:::::: CC: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
[tip:x86/entry 4/80] drivers/xen/events/events_base.c:1664:6: warning: no previous prototype for 'xen_setup_callback_vector'
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/entry
head: 095b7a3e7745e6fb7cf0a1c09967c4f43e76f8f4
commit: fad1940a6a856f59b073e8650e02052ce531154c [4/80] x86/xen: Split HVM vector callback setup and interrupt gate allocation
config: arm-randconfig-r013-20200519 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout fad1940a6a856f59b073e8650e02052ce531154c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/xen/events/events_base.c:1664:6: warning: no previous prototype for 'xen_setup_callback_vector' [-Wmissing-prototypes]
1664 | void xen_setup_callback_vector(void) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +/xen_setup_callback_vector +1664 drivers/xen/events/events_base.c
1654
1655 static __init void xen_alloc_callback_vector(void)
1656 {
1657 if (!xen_have_vector_callback)
1658 return;
1659
1660 pr_info("Xen HVM callback vector for event delivery is enabled\n");
1661 alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, xen_hvm_callback_vector);
1662 }
1663 #else
> 1664 void xen_setup_callback_vector(void) {}
1665 static inline void xen_alloc_callback_vector(void) {}
1666 #endif
1667
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
[linux-next:master 3933/10701] kernel/bpf/verifier.c:296:13: sparse: sparse: incorrect type in argument 1 (different address spaces)
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: fb57b1fabcb28f358901b2df90abd2b48abc1ca8
commit: 6f8a57ccf8511724e6f48d732cb2940889789ab2 [3933/10701] bpf: Make verifier log more relevant by default
config: m68k-randconfig-s002-20200520 (attached as .config)
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-193-gb8fad4bc-dirty
git checkout 6f8a57ccf8511724e6f48d732cb2940889789ab2
# save the attached .config to linux build tree
make C=1 ARCH=m68k CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
kernel/bpf/verifier.c:296:13: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:296:13: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:296:13: sparse: sparse: cast removes address space '<asn:1>' of expression
>> kernel/bpf/verifier.c:296:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got char [noderef] <asvoid * @@
kernel/bpf/verifier.c:296:13: sparse: expected void *
kernel/bpf/verifier.c:296:13: sparse: got char [noderef] <asn:1> *
kernel/bpf/verifier.c:7405:37: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:7405:37: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:7405:37: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:7405:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got unsigned int [noderef] <asvoid * @@
kernel/bpf/verifier.c:7405:37: sparse: expected void *
kernel/bpf/verifier.c:7405:37: sparse: got unsigned int [noderef] <asn:1> *
kernel/bpf/verifier.c:7522:37: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:7522:37: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:7522:37: sparse: sparse: cast removes address space '<asn:1>' of expression
kernel/bpf/verifier.c:7522:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got unsigned int [noderef] <asvoid * @@
kernel/bpf/verifier.c:7522:37: sparse: expected void *
kernel/bpf/verifier.c:7522:37: sparse: got unsigned int [noderef] <asn:1> *
kernel/bpf/verifier.c:9706:76: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c:10081:81: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c:10085:81: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c:10089:81: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c:10093:79: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c:10097:78: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c:10101:79: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c:10144:38: sparse: sparse: subtraction of functions? Share your drugs
vim +296 kernel/bpf/verifier.c
287
288 static void bpf_vlog_reset(struct bpf_verifier_log *log, u32 new_pos)
289 {
290 char zero = 0;
291
292 if (!bpf_verifier_log_needed(log))
293 return;
294
295 log->len_used = new_pos;
> 296 if (put_user(zero, log->ubuf + new_pos))
297 log->ubuf = NULL;
298 }
299
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months
Re: [PATCH v4 5/7] firmware: smccc: Refactor SMCCC specific bits into separate file
by kbuild test robot
Hi Sudeep,
I love your patch! Perhaps something to improve:
[auto build test WARNING on soc/for-next]
[also build test WARNING on arm64/for-next/core linus/master v5.7-rc6 next-20200519]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Sudeep-Holla/firmware-smccc-Add-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
config: arm64-randconfig-r026-20200519 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/firmware/smccc/smccc.c:14:13: warning: no previous prototype for function 'arm_smccc_version_init' [-Wmissing-prototypes]
void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)
^
drivers/firmware/smccc/smccc.c:14:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)
^
static
1 warning generated.
vim +/arm_smccc_version_init +14 drivers/firmware/smccc/smccc.c
13
> 14 void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)
15 {
16 smccc_version = version;
17 smccc_conduit = conduit;
18 }
19
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 4 months