From 1b517291bff1ced5c85fb73deff1e369806aff26 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 7 Mar 2024 17:23:14 +0900 Subject: [PATCH 01/16] RISCV: config: tizen_visionfive2: Enable HID_MULTITOUCH To support usb touchscreen, enable CONFIG_HID_MULTITOUCH. Change-Id: I341e1a7951e704b0d16a98caea881305137c56cd Signed-off-by: Seung-Woo Kim --- arch/riscv/configs/tizen_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/configs/tizen_visionfive2_defconfig b/arch/riscv/configs/tizen_visionfive2_defconfig index 74629c9..f72e89b 100644 --- a/arch/riscv/configs/tizen_visionfive2_defconfig +++ b/arch/riscv/configs/tizen_visionfive2_defconfig @@ -310,6 +310,7 @@ CONFIG_SND_SOC_WM8960=y CONFIG_SND_SIMPLE_CARD=y CONFIG_HIDRAW=y CONFIG_UHID=y +CONFIG_HID_MULTITOUCH=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y -- 2.7.4 From cf5bccd3476119ba0c2bf9001f20d7b5840f4ef8 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 7 Mar 2024 18:05:39 +0900 Subject: [PATCH 02/16] RISCV: config: tizen_visionfive2: enable DRM_LOAD_EDID_FIRMWARE Enable CONFIG_DRM_LOAD_EDID_FIRMWARE from tizen defconfigs to support drm.edid_firmware paremeter. Adding "drm.edid_firmware=edid/1920x1080.bin" to cmdline makes all connected display connector has the 1920x1080 mode. Kernel has prebuilt edids, 800x600.bin, 1024x768.bin, 1280x1024.bin, 1600x1200.bin, 1680x1050.bin and 1920x1080.bin and to use other mode edids, put custom edid files into path /lib/firmware/edid/. Note: to build custom edid binary, please refer tools/edid/. Change-Id: Ia87be1d9f7a5e6af38201dc432fc046478e80dae Signed-off-by: Seung-Woo Kim --- arch/riscv/configs/tizen_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/configs/tizen_visionfive2_defconfig b/arch/riscv/configs/tizen_visionfive2_defconfig index f72e89b..ec813e2 100644 --- a/arch/riscv/configs/tizen_visionfive2_defconfig +++ b/arch/riscv/configs/tizen_visionfive2_defconfig @@ -293,6 +293,7 @@ CONFIG_USB_VIDEO_CLASS=y CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_V4L_MEM2MEM_DRIVERS=y CONFIG_VIDEO_WAVE_VPU=m +CONFIG_DRM_LOAD_EDID_FIRMWARE=y CONFIG_DRM_VERISILICON=y CONFIG_DRM_VERISILICON_STARFIVE_HDMI=y CONFIG_DRM_IMG_ROGUE=y -- 2.7.4 From d6492bf94d9a6b0384129b0a5d16eba574c31366 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 8 Mar 2024 14:45:26 +0900 Subject: [PATCH 03/16] drm/edid/firmware: Add built-in edid/1280x720.bin firmware Add built-in edid/1280x720.bin firmware to drm_edid_loader. The mode is generated from tools/edid/ with below edid data: /* 1280x720: Modeline "1280x720" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync */ #define HSYNC_POL 1 #define VSYNC_POL 1 #define YPULSE (63+5) #define XPULSE 128 #define YPIX 720 #define XPIX 1280 #define VFREQ 60 #define DPI 96 #define CLOCK 74500 #define VERSION 1 #define REVISION 3 #define XOFFSET 64 #define YOFFSET (63+3) #define XY_RATIO XY_RATIO_16_9 #define YBLANK 28 #define XBLANK 384 #define TIMING_NAME "1280x720" #include "edid.S" Change-Id: Idfc610102a35494ee54aca06af411cfd9d737b0f Signed-off-by: Seung-Woo Kim --- drivers/gpu/drm/drm_edid_load.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c index 5d9ef26..654c01b 100644 --- a/drivers/gpu/drm/drm_edid_load.c +++ b/drivers/gpu/drm/drm_edid_load.c @@ -39,10 +39,11 @@ int __drm_get_edid_firmware_path(char *buf, size_t bufsize) } EXPORT_SYMBOL(__drm_get_edid_firmware_path); -#define GENERIC_EDIDS 6 +#define GENERIC_EDIDS 7 static const char * const generic_edid_name[GENERIC_EDIDS] = { "edid/800x600.bin", "edid/1024x768.bin", + "edid/1280x720.bin", "edid/1280x1024.bin", "edid/1600x1200.bin", "edid/1680x1050.bin", @@ -89,6 +90,24 @@ static const u8 generic_edid[GENERIC_EDIDS][128] = { { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x16, 0x01, 0x03, 0x6d, 0x21, 0x12, 0x78, + 0xea, 0x5e, 0xc0, 0xa4, 0x59, 0x4a, 0x98, 0x25, + 0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0x81, 0xc0, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1a, 0x1d, + 0x00, 0x80, 0x51, 0xd0, 0x1c, 0x20, 0x40, 0x80, + 0x24, 0x00, 0x4d, 0xbb, 0x10, 0x00, 0x00, 0x1e, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x4c, 0x69, 0x6e, + 0x75, 0x78, 0x20, 0x23, 0x30, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x3b, + 0x3d, 0x2b, 0x2d, 0x08, 0x00, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, + 0x00, 0x31, 0x32, 0x38, 0x30, 0x78, 0x37, 0x32, + 0x30, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0x6c, + }, + { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x16, 0x01, 0x03, 0x6d, 0x2c, 0x23, 0x78, 0xea, 0x5e, 0xc0, 0xa4, 0x59, 0x4a, 0x98, 0x25, 0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0x81, 0x80, -- 2.7.4 From 163de2e4bc2cd939bb937d3ff12ff685b0cb32f7 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Tue, 12 Mar 2024 19:33:31 +0900 Subject: [PATCH 04/16] RISCV: configs: tizen_visoinfive2: Disable RISCV_ISA_V config Visionfive2 doesn't support V extenstion. It needs to disable its configuration. Change-Id: I6b6ddc5b7027cdd6bd411f53df787e22e48993af Signed-off-by: Jaehoon Chung --- arch/riscv/configs/tizen_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/configs/tizen_visionfive2_defconfig b/arch/riscv/configs/tizen_visionfive2_defconfig index ec813e2..26460dd 100644 --- a/arch/riscv/configs/tizen_visionfive2_defconfig +++ b/arch/riscv/configs/tizen_visionfive2_defconfig @@ -29,6 +29,7 @@ CONFIG_PROFILING=y CONFIG_SOC_SIFIVE=y CONFIG_SOC_STARFIVE=y CONFIG_SMP=y +# CONFIG_RISCV_ISA_V is not set CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y -- 2.7.4 From 46cea3ea9d804a8644b544e9e5f0326bd4a706da Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Tue, 12 Mar 2024 19:57:28 +0900 Subject: [PATCH 05/16] perf: riscv_pmu_sbi: Set SYSCTL_LEGACY by default This patch is workaround for VisionFive2. During running ubrowser, SIGILL is occurred. To prevent the SIGILL, sysctl_perf_user_acces is set SYSCTL_LEGACY by default. Change-Id: Idbfcbfd27a9286c8e23529fd793b99c4023a449f Signed-off-by: Jaehoon Chung --- drivers/perf/riscv_pmu_sbi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index cd8a2b9..5e29226 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -51,8 +51,9 @@ static const struct attribute_group *riscv_pmu_attr_groups[] = { NULL, }; -/* Allow user mode access by default */ -static int sysctl_perf_user_access __read_mostly = SYSCTL_USER_ACCESS; +/* WORKAROUND: Allow legacy mode by default when SOC is starfive */ +static int sysctl_perf_user_access __read_mostly = SYSCTL_LEGACY; + /* * RISC-V doesn't have heterogeneous harts yet. This need to be part of -- 2.7.4 From 05cfa30b86e3bdfbecb332a56bb06b60537f8142 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Thu, 14 Mar 2024 10:13:39 +0900 Subject: [PATCH 06/16] RISCV: dts: starfive: Change the pinmux value about mclk_ext_pins mclk_ext_pins is using by i2stx0. Vendor kernel is set to GPOUT_HIGH / GOPEN_ENABLE. Change-Id: I65e1ffb79ec3b6c7b875074348b92e7cb399251a Signed-off-by: Jaehoon Chung --- arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi index 732d74a..436b885 100644 --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi @@ -648,8 +648,8 @@ mclk_ext_pins: mclk-ext-0 { mclk-ext-pins { - pinmux = ; input-enable; }; -- 2.7.4 From 39ca97b085263283cdf2cbecf5bd568d4b6bb117 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Thu, 14 Mar 2024 15:25:39 +0900 Subject: [PATCH 07/16] RISCV: configs: tizen_visionfive2: Change a module about PWMDAC Change a module about PWMDAC. Its devices is always registered to card0. So, HDMI-audio is always registered to card1. It's played from card0 by default during playing audio. As loading pwmdac as module, it will be registered to card1. Change-Id: I3f97cd4584061732cfa88cf90792c0534967a3b7 Signed-off-by: Jaehoon Chung --- arch/riscv/configs/tizen_visionfive2_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/configs/tizen_visionfive2_defconfig b/arch/riscv/configs/tizen_visionfive2_defconfig index 26460dd..5b9b59f 100644 --- a/arch/riscv/configs/tizen_visionfive2_defconfig +++ b/arch/riscv/configs/tizen_visionfive2_defconfig @@ -306,8 +306,9 @@ CONFIG_SND_USB_AUDIO=y CONFIG_SND_SOC=y CONFIG_SND_DESIGNWARE_I2S=y CONFIG_SND_SOC_STARFIVE=y -CONFIG_SND_SOC_JH7110_PWMDAC=y +CONFIG_SND_SOC_JH7110_PWMDAC=m CONFIG_SND_SOC_JH7110_TDM=y +CONFIG_SND_SOC_SPDIF=y CONFIG_SND_SOC_WM8960=y CONFIG_SND_SIMPLE_CARD=y CONFIG_HIDRAW=y -- 2.7.4 From 0ec2e167023a41d23bdf1740404933611d03e2d5 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 22 Mar 2024 18:27:33 +0900 Subject: [PATCH 08/16] script: build: Add to build linux-tizen-modules Add to build and install linux-tizen-modules in local build script. To build linux-tizne-modules, it is required to clone tizen git platform/kernel/linux-tizen-modules-source and platform/kernel/linux-tizen-modules in parent path. Change-Id: I1e8b799d53a4d8e5f614b20250fa718f5cc48aa4 Signed-off-by: Seung-Woo Kim --- build.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/build.sh b/build.sh index 3239bec..db9d5829 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,8 @@ MOD_IMG="usr/modules.img" MOD_SIZE=20 NCPUS=`grep ^processor /proc/cpuinfo | wc -l` NCPUS=$(($NCPUS * 2)) +BUILD_ROOT=$PWD +KERNEL_PATH=`basename ${BUILD_ROOT}` # Check this system has ccache check_ccache() @@ -14,6 +16,43 @@ check_ccache() fi } +function mk_tizen_modules() +{ + if [ -e ${BUILD_ROOT}/../linux-tizen-modules-source ]; then + pushd ${BUILD_ROOT}/../linux-tizen-modules-source + + ln -s ${PWD}/include kernel + + export BUILD_logger=m + export LOGGER_MAIN_BUFFER_SIZE=256 + export LOGGER_EVENTS_BUFFER_SIZE=256 + export LOGGER_RADIO_BUFFER_SIZE=256 + export LOGGER_SYSTEM_BUFFER_SIZE=256 + + export BUILD_proc_tsm=n + export BUILD_kdbus=n + export BUILD_zlogger=m + + ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILER}" make -C kernel KERNELDIR=${BUILD_ROOT} + + rm -f kernel/include + + ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILER}" make -C kernel modules_install KERNELDIR=${BUILD_ROOT} INSTALL_MOD_PATH=../${KERNEL_PATH}/${MOD_DIR} INSTALL_MOD_STRIP=1 INSTALL_MOD_DIR=extra + + popd + + if [ -e ${BUILD_ROOT}/../linux-tizen-modules ]; then + mkdir -p ${MOD_DIR}/lib/modules/modules-load.d + cp ${BUILD_ROOT}/../linux-tizen-modules/conf/tizen-modules-visionfive2.conf ${MOD_DIR}/lib/modules/modules-load.d + fi + else + echo "linux-tizen-modules-source/linux-tizen-modules are not cloned in parent path, so skip building linux-tizen-modules." + echo "To build linux-tizen-modules, please use below command:" + echo " git clone git://git.tizen.org/platform/kernel/linux-tizen-modules-source -b tizen ../linux-tizen-modules-source" + echo " git clone git://git.tizen.org/platform/kernel/linux-tizen-modules -b tizen ../linux-tizen-modules" + fi +} + function mk_modules() { [ -e /usr/bin/make_ext4fs ] && USE_MAKE_EXT4FS=1 if [ "$USE_MAKE_EXT4FS" != "1" ]; then @@ -32,6 +71,9 @@ function mk_modules() { make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" modules_install INSTALL_MOD_PATH=${MOD_DIR} INSTALL_MOD_STRIP=1 + # build and install linux-tizen-modules if cloned in parent path + mk_tizen_modules + if [ "$USE_MAKE_EXT4FS" == "1" ]; then /usr/bin/make_ext4fs -b 4096 -L modules -l ${MOD_SIZE}M $MOD_IMG ${MOD_DIR}/lib/modules/ else -- 2.7.4 From 61350fcb7a25041945ca6a2ae126b9ab7258ab25 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 26 Mar 2024 11:23:49 +0900 Subject: [PATCH 09/16] script: build: Use twice the number of CPUs for cuncurrent compile It is safe to run twice the number of CPUs for concurrent compile and it already calculates for it. So, Use twice the number of CPUs. Change-Id: I5eb5bb80730ffb8c381244c9bf09e5dc77d2c634 Signed-off-by: Seung-Woo Kim --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index db9d5829..fa2332d 100755 --- a/build.sh +++ b/build.sh @@ -104,7 +104,7 @@ ARCH=riscv if ! [ -e .config ] ; then make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" tizen_visionfive2_defconfig fi -make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" -j8 +make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" -j ${NCPUS} if [ ! -f "./arch/riscv/boot/Image" ]; then echo "Build fail" exit 1 -- 2.7.4 From c5166b4e528a4c6863cbebd52589a0f9a9ea1497 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Tue, 30 Apr 2024 14:16:46 +0900 Subject: [PATCH 10/16] RISCV: configs: tizen_visionfive2: Enable RT2800USB config Enable RT2800USB configuration to use RALINK WiFi dongle. Change-Id: I14156a1e8171db659dbdeae547c93332dbe32660 Signed-off-by: Jaehoon Chung --- arch/riscv/configs/tizen_visionfive2_defconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/configs/tizen_visionfive2_defconfig b/arch/riscv/configs/tizen_visionfive2_defconfig index 5b9b59f..d17f728 100644 --- a/arch/riscv/configs/tizen_visionfive2_defconfig +++ b/arch/riscv/configs/tizen_visionfive2_defconfig @@ -237,6 +237,10 @@ CONFIG_USB_RTL8152=y CONFIG_USB_LAN78XX=y CONFIG_USB_USBNET=y CONFIG_MT7601U=m +CONFIG_RT2X00=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y CONFIG_RTL_CARDS=m CONFIG_RTL8192CU=m # CONFIG_RTLWIFI_DEBUG is not set -- 2.7.4 From ad23e439ffa101339bd3f02902241882f30708c7 Mon Sep 17 00:00:00 2001 From: Anuj Jain Date: Fri, 10 May 2024 15:21:46 +0530 Subject: [PATCH 11/16] Revert "Bluetooth: Store advertising handle so it can be re-enabled" This reverts commit 7087c4f69487f017722df7d299ef9b7709996b79. Patch revert is needed as it is the cause for GATT Server TCT fail. Change-Id: I60d69db88b4573bcf493239fe81910e2ac1d5b87 Signed-off-by: Anuj Jain Signed-off-by: Jaehoon Chung --- include/net/bluetooth/hci_core.h | 1 - net/bluetooth/hci_event.c | 39 ++++++++++++++------------------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 24de664..d46f1ab 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -716,7 +716,6 @@ struct hci_conn { __u8 init_addr_type; bdaddr_t resp_addr; __u8 resp_addr_type; - __u8 adv_instance; __u16 handle; __u16 sync_handle; __u16 state; diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 452d322..0fdf91a 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2982,13 +2982,12 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status) goto unlock; if (status) { + u8 type = conn->type; mgmt_disconnect_failed(hdev, &conn->dst, conn->type, conn->dst_type, status); - if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) { - hdev->cur_adv_instance = conn->adv_instance; + if (type == LE_LINK) hci_enable_advertising(hdev); - } /* Inform sockets conn is gone before we delete it */ hci_disconn_cfm(conn, HCI_ERROR_UNSPECIFIED); @@ -3614,6 +3613,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data, struct hci_conn_params *params; struct hci_conn *conn; bool mgmt_connected; + u8 type; bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); @@ -3667,8 +3667,10 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data, break; } } + type = conn->type; hci_disconn_cfm(conn, ev->reason); + hci_conn_del(conn); /* Re-enable advertising if necessary, since it might * have been disabled by the connection. From the @@ -3680,12 +3682,10 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data, * or until a connection is created or until the Advertising * is timed out due to Directed Advertising." */ - if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) { - hdev->cur_adv_instance = conn->adv_instance; + + if (type == LE_LINK) hci_enable_advertising(hdev); - } - hci_conn_del(conn); #ifdef TIZEN_BT if (conn->type == ACL_LINK && !hci_conn_num(hdev, ACL_LINK)) { @@ -6256,13 +6256,6 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, conn->sec_level = BT_SECURITY_LOW; conn->state = BT_CONFIG; - /* Store current advertising instance as connection advertising instance - * when sotfware rotation is in use so it can be re-enabled when - * disconnected. - */ - if (!ext_adv_capable(hdev)) - conn->adv_instance = hdev->cur_adv_instance; - conn->le_conn_interval = interval; conn->le_conn_latency = latency; conn->le_supv_timeout = supervision_timeout; @@ -6343,7 +6336,7 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data, { struct hci_evt_le_ext_adv_set_term *ev = data; struct hci_conn *conn; - struct adv_info *adv, *n; + struct adv_info *n; bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); @@ -6361,9 +6354,10 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data, hci_dev_lock(hdev); - adv = hci_find_adv_instance(hdev, ev->handle); if (ev->status) { + struct adv_info *adv; + adv = hci_find_adv_instance(hdev, ev->handle); if (!adv) goto unlock; @@ -6381,15 +6375,9 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data, goto unlock; } - if (adv) - adv->enabled = false; - conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle)); if (conn) { - /* Store handle in the connection so the correct advertising - * instance can be re-enabled when disconnected. - */ - conn->adv_instance = ev->handle; + struct adv_info *adv_instance; if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM || bacmp(&conn->resp_addr, BDADDR_ANY)) @@ -6400,8 +6388,9 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data, goto unlock; } - if (adv) - bacpy(&conn->resp_addr, &adv->random_addr); + adv_instance = hci_find_adv_instance(hdev, ev->handle); + if (adv_instance) + bacpy(&conn->resp_addr, &adv_instance->random_addr); } unlock: -- 2.7.4 From bc3a15920ec11b01be4894cfb6a86d94fd067602 Mon Sep 17 00:00:00 2001 From: Mateusz Bieganski Date: Mon, 13 May 2024 16:39:09 +0200 Subject: [PATCH 12/16] RISCV: configs: tizen_visionfive2: Enable FTRACE_SYSCALLS switch Enable FTRACE_SYSCALLS switch, for debug and profiling purposes. Change-Id: Iccfb832ca569ffe2621f5a9aa5ebb02418ec3007 Signed-off-by: Mateusz Bieganski --- arch/riscv/configs/tizen_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/configs/tizen_visionfive2_defconfig b/arch/riscv/configs/tizen_visionfive2_defconfig index d17f728..af21370 100644 --- a/arch/riscv/configs/tizen_visionfive2_defconfig +++ b/arch/riscv/configs/tizen_visionfive2_defconfig @@ -435,6 +435,7 @@ CONFIG_DEBUG_PLIST=y CONFIG_DEBUG_SG=y # CONFIG_RCU_TRACE is not set CONFIG_RCU_EQS_DEBUG=y +CONFIG_FTRACE_SYSCALLS=y CONFIG_BLK_DEV_IO_TRACE=y # CONFIG_RUNTIME_TESTING_MENU is not set CONFIG_MEMTEST=y -- 2.7.4 From 033b457bed3db4788d0806d55b12280f19deee3f Mon Sep 17 00:00:00 2001 From: Mateusz Bieganski Date: Mon, 27 May 2024 13:33:04 +0200 Subject: [PATCH 13/16] RISCV: config: tizen_visionfive2: enable CONFIG_UNIX_DIAG In order to better understand interprocess communication, it is often useful to know filename/inode of the other endpoint, and the process that has it opened. With CONFIG_UNIX_DIAG flag enabled, the '+E' parameter of 'lsof' works as expected. Change-Id: I44f6692c95cb93f31f7804bcaab5e30b27669cc3 Signed-off-by: Mateusz Bieganski --- arch/riscv/configs/tizen_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/configs/tizen_visionfive2_defconfig b/arch/riscv/configs/tizen_visionfive2_defconfig index af21370..5274fbd1 100644 --- a/arch/riscv/configs/tizen_visionfive2_defconfig +++ b/arch/riscv/configs/tizen_visionfive2_defconfig @@ -44,6 +44,7 @@ CONFIG_MODULE_UNLOAD=y # CONFIG_IOSCHED_BFQ is not set CONFIG_NET=y CONFIG_PACKET=y +CONFIG_UNIX_DIAG=y CONFIG_XFRM_USER=y CONFIG_NET_KEY=y CONFIG_IP_MULTICAST=y -- 2.7.4 From 275733ff01f0b9a19103e5316009277d32e7eb8b Mon Sep 17 00:00:00 2001 From: Sun Haiyong Date: Mon, 4 Dec 2023 16:20:55 +0800 Subject: [PATCH 14/16] perf top: Remove needless malloc(0) call that triggers -Walloc-size MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit GCC 14 introduces a new -Walloc-size included in -Wextra which errors out like: builtin-top.c: In function ‘prompt_integer’: builtin-top.c:360:21: error: allocation of insufficient size ‘0’ for type ‘char’ with size ‘1’ [-Werror=alloc-size] 360 | char *buf = malloc(0), *p; | ^~~~~~ Just set it to NULL, getline() will do the allocation. cherry-picked from commit 79baac8acfc60a7a5114f6d60731e28c242ef8ce Change-Id: I3065836e0e7c352eb7dd7a82b73d4392b8142221 Signed-off-by: Sun Haiyong Signed-off-by: Yanteng Si Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20231204082055.91877-1-siyanteng@loongson.cn Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index ea8c7ec..3960c4d 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -357,7 +357,7 @@ static void perf_top__print_sym_table(struct perf_top *top) static void prompt_integer(int *target, const char *msg) { - char *buf = malloc(0), *p; + char *buf = NULL, *p; size_t dummy = 0; int tmp; -- 2.7.4 From 056e616d308587ac7e2cea7a1a7414a060bce15b Mon Sep 17 00:00:00 2001 From: Sun Haiyong Date: Sat, 6 Jan 2024 17:41:29 +0800 Subject: [PATCH 15/16] perf tools: Fix calloc() arguments to address error introduced in gcc-14 the definition of calloc is as follows: void *calloc(size_t nmemb, size_t size); number of members is in the first parameter and the size is in the second parameter. Fix error messages on gcc 14 20240102: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] Committer notes: I noticed this on fedora 40 and rawhide. cherry-picked from commit 7bbe8f0071dfa23fcc3b2864ec9f3b1aeb7ab2df Change-Id: Ia96dbd404a3f9339e7e402465eaaa1b98c9d507c Signed-off-by: Sun Haiyong Acked-by: Namhyung Kim Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20240106094129.3337057-1-siyanteng@loongson.cn Signed-off-by: Yanteng Si Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-record.c | 4 ++-- tools/perf/util/hist.c | 4 ++-- tools/perf/util/metricgroup.c | 2 +- tools/perf/util/synthetic-events.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 34bb31f..ddb2473 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -4051,8 +4051,8 @@ int cmd_record(int argc, const char **argv) } if (rec->switch_output.num_files) { - rec->switch_output.filenames = calloc(sizeof(char *), - rec->switch_output.num_files); + rec->switch_output.filenames = calloc(rec->switch_output.num_files, + sizeof(char *)); if (!rec->switch_output.filenames) { err = -EINVAL; goto out_opts; diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index ac8c0ef4..e5405ce 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -491,8 +491,8 @@ static int hist_entry__init(struct hist_entry *he, } if (symbol_conf.res_sample) { - he->res_samples = calloc(sizeof(struct res_sample), - symbol_conf.res_sample); + he->res_samples = calloc(symbol_conf.res_sample, + sizeof(struct res_sample)); if (!he->res_samples) goto err_srcline; } diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index bb5faaa..df1595b 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -286,7 +286,7 @@ static int setup_metric_events(const char *pmu, struct hashmap *ids, *out_metric_events = NULL; ids_size = hashmap__size(ids); - metric_events = calloc(sizeof(void *), ids_size + 1); + metric_events = calloc(ids_size + 1, sizeof(void *)); if (!metric_events) return -ENOMEM; diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c index a0579c7..7577e63 100644 --- a/tools/perf/util/synthetic-events.c +++ b/tools/perf/util/synthetic-events.c @@ -1039,11 +1039,11 @@ int perf_event__synthesize_threads(struct perf_tool *tool, if (thread_nr > n) thread_nr = n; - synthesize_threads = calloc(sizeof(pthread_t), thread_nr); + synthesize_threads = calloc(thread_nr, sizeof(pthread_t)); if (synthesize_threads == NULL) goto free_dirent; - args = calloc(sizeof(*args), thread_nr); + args = calloc(thread_nr, sizeof(*args)); if (args == NULL) goto free_threads; -- 2.7.4 From 4c6699f21346842a6da031cc50ac3b4117b5d1ea Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 21 Dec 2023 11:47:45 +0300 Subject: [PATCH 16/16] btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send() When compiling with gcc version 14.0.0 20231220 (experimental) and W=1, I've noticed the following warning: fs/btrfs/send.c: In function 'btrfs_ioctl_send': fs/btrfs/send.c:8208:44: warning: 'kvcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 8208 | sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots), | ^ Since 'n' and 'size' arguments of 'kvcalloc()' are multiplied to calculate the final size, their actual order doesn't affect the result and so this is not a bug. But it's still worth to fix it. Signed-off-by: Dmitry Antipov Reviewed-by: David Sterba Signed-off-by: David Sterba (cherry picked from commit 6ff09b6b8c2fb6b3edda4ffaa173153a40653067) Signed-off-by: Jaehoon Chung Change-Id: I30403a32f70d9760f2ce200f8195b87ad62baf4e --- fs/btrfs/send.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index db94eef..c367b1f 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -8205,8 +8205,8 @@ long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg) goto out; } - sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots), - arg->clone_sources_count + 1, + sctx->clone_roots = kvcalloc(arg->clone_sources_count + 1, + sizeof(*sctx->clone_roots), GFP_KERNEL); if (!sctx->clone_roots) { ret = -ENOMEM; -- 2.7.4