Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'xtensa-20220804' of https://github.com/jcmvbkbc/linux-xtensa

Pull xtensa updates from Max Filippov:

- support KCOV

- enable ARCH_HAS_GCOV_PROFILE_ALL

- minor ISS network driver cleanups

* tag 'xtensa-20220804' of https://github.com/jcmvbkbc/linux-xtensa:
xtensa: enable ARCH_HAS_GCOV_PROFILE_ALL
xtensa: enable KCOV support
xtensa: iss: fix handling error cases in iss_net_configure()
xtensa: iss/network: provide release() callback
xtensa: iss/network: drop 'devices' list

+34 -37
+1 -1
Documentation/features/debug/gcov-profile-all/arch-support.txt
··· 27 27 | sparc: | TODO | 28 28 | um: | ok | 29 29 | x86: | ok | 30 - | xtensa: | TODO | 30 + | xtensa: | ok | 31 31 -----------------------
+1 -1
Documentation/features/debug/kcov/arch-support.txt
··· 27 27 | sparc: | TODO | 28 28 | um: | ok | 29 29 | x86: | ok | 30 - | xtensa: | TODO | 30 + | xtensa: | ok | 31 31 -----------------------
+2
arch/xtensa/Kconfig
··· 6 6 select ARCH_HAS_CURRENT_STACK_POINTER 7 7 select ARCH_HAS_DEBUG_VM_PGTABLE 8 8 select ARCH_HAS_DMA_PREP_COHERENT if MMU 9 + select ARCH_HAS_GCOV_PROFILE_ALL 10 + select ARCH_HAS_KCOV 9 11 select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU 10 12 select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU 11 13 select ARCH_HAS_DMA_SET_UNCACHED if MMU
+2
arch/xtensa/boot/lib/Makefile
··· 17 17 18 18 KASAN_SANITIZE := n 19 19 KCSAN_SANITIZE := n 20 + KCOV_INSTRUMENT := n 21 + GCOV_PROFILE := n 20 22 21 23 CFLAGS_REMOVE_inflate.o += -fstack-protector -fstack-protector-strong 22 24 CFLAGS_REMOVE_zmem.o += -fstack-protector -fstack-protector-strong
+28 -35
arch/xtensa/platforms/iss/network.c
··· 37 37 #define ETH_HEADER_OTHER 14 38 38 #define ISS_NET_TIMER_VALUE (HZ / 10) 39 39 40 - 41 - static DEFINE_SPINLOCK(devices_lock); 42 - static LIST_HEAD(devices); 43 - 44 40 /* ------------------------------------------------------------------------- */ 45 41 46 42 /* We currently only support the TUNTAP transport protocol. */ ··· 66 70 /* This structure contains out private information for the driver. */ 67 71 68 72 struct iss_net_private { 69 - struct list_head device_list; 70 - 71 73 spinlock_t lock; 72 74 struct net_device *dev; 73 75 struct platform_device pdev; ··· 466 472 .ndo_set_rx_mode = iss_net_set_multicast_list, 467 473 }; 468 474 469 - static int iss_net_configure(int index, char *init) 475 + static void iss_net_pdev_release(struct device *dev) 476 + { 477 + struct platform_device *pdev = to_platform_device(dev); 478 + struct iss_net_private *lp = 479 + container_of(pdev, struct iss_net_private, pdev); 480 + 481 + free_netdev(lp->dev); 482 + } 483 + 484 + static void iss_net_configure(int index, char *init) 470 485 { 471 486 struct net_device *dev; 472 487 struct iss_net_private *lp; 473 - int err; 474 488 475 489 dev = alloc_etherdev(sizeof(*lp)); 476 490 if (dev == NULL) { 477 491 pr_err("eth_configure: failed to allocate device\n"); 478 - return 1; 492 + return; 479 493 } 480 494 481 495 /* Initialize private element. */ 482 496 483 497 lp = netdev_priv(dev); 484 498 *lp = (struct iss_net_private) { 485 - .device_list = LIST_HEAD_INIT(lp->device_list), 486 499 .dev = dev, 487 500 .index = index, 488 501 }; ··· 510 509 if (!tuntap_probe(lp, index, init)) { 511 510 pr_err("%s: invalid arguments. Skipping device!\n", 512 511 dev->name); 513 - goto errout; 512 + goto err_free_netdev; 514 513 } 515 514 516 515 pr_info("Netdevice %d (%pM)\n", index, dev->dev_addr); ··· 518 517 /* sysfs register */ 519 518 520 519 if (!driver_registered) { 521 - platform_driver_register(&iss_net_driver); 520 + if (platform_driver_register(&iss_net_driver)) 521 + goto err_free_netdev; 522 522 driver_registered = 1; 523 523 } 524 524 525 - spin_lock(&devices_lock); 526 - list_add(&lp->device_list, &devices); 527 - spin_unlock(&devices_lock); 528 - 529 525 lp->pdev.id = index; 530 526 lp->pdev.name = DRIVER_NAME; 531 - platform_device_register(&lp->pdev); 527 + lp->pdev.dev.release = iss_net_pdev_release; 528 + if (platform_device_register(&lp->pdev)) 529 + goto err_free_netdev; 532 530 SET_NETDEV_DEV(dev, &lp->pdev.dev); 533 531 534 532 dev->netdev_ops = &iss_netdev_ops; ··· 536 536 dev->irq = -1; 537 537 538 538 rtnl_lock(); 539 - err = register_netdevice(dev); 540 - rtnl_unlock(); 541 - 542 - if (err) { 539 + if (register_netdevice(dev)) { 540 + rtnl_unlock(); 543 541 pr_err("%s: error registering net device!\n", dev->name); 544 - /* XXX: should we call ->remove() here? */ 545 - free_netdev(dev); 546 - return 1; 542 + platform_device_unregister(&lp->pdev); 543 + return; 547 544 } 545 + rtnl_unlock(); 548 546 549 547 timer_setup(&lp->tl, iss_net_user_timer_expire, 0); 550 548 551 - return 0; 549 + return; 552 550 553 - errout: 554 - /* FIXME: unregister; free, etc.. */ 555 - return -EIO; 551 + err_free_netdev: 552 + free_netdev(dev); 556 553 } 557 554 558 555 /* ------------------------------------------------------------------------- */ ··· 571 574 572 575 static int __init iss_net_setup(char *str) 573 576 { 574 - struct iss_net_private *device = NULL; 577 + struct iss_net_init *device = NULL; 575 578 struct iss_net_init *new; 576 579 struct list_head *ele; 577 580 char *end; ··· 592 595 } 593 596 str = end; 594 597 595 - spin_lock(&devices_lock); 596 - 597 - list_for_each(ele, &devices) { 598 - device = list_entry(ele, struct iss_net_private, device_list); 598 + list_for_each(ele, &eth_cmd_line) { 599 + device = list_entry(ele, struct iss_net_init, list); 599 600 if (device->index == n) 600 601 break; 601 602 } 602 - 603 - spin_unlock(&devices_lock); 604 603 605 604 if (device && device->index == n) { 606 605 pr_err("Device %u already configured\n", n);