arm64: dts: qcom: sdm845: narrow LLCC address space
Subsystems (5)
Sasha Levin
maintainerPATCH 1/17 arm64: dts: qcom: sdm845: narrow LLCC address space
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 300b5f661eebefb8571841b78091343eb87eca54 ]
The Last Level Cache Controller (LLCC) device does not need to access entire LLCC address space. Currently driver uses only hardware info and status registers which both reside in LLCC0_COMMON range (offset 0x30000, size 0x1000). Narrow the address space to allow binding other drivers to rest of LLCC address space.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +1 -1
@@ -1796,7 +1796,7 @@ uart15: serial@a9c000 { system-cache-controller@1100000 { compatible = "qcom,sdm845-llcc"; - reg = <0 0x01100000 0 0x200000>, <0 0x01300000 0 0x50000>; + reg = <0 0x01100000 0 0x31000>, <0 0x01300000 0 0x50000>; reg-names = "llcc_base", "llcc_broadcast_base"; interrupts = <GIC_SPI 582 IRQ_TYPE_LEVEL_HIGH>; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/17 ARM: dts: imx7d-sdb: config the max pressure for tsc2046
From: Haibo Chen <[email protected]>
[ Upstream commit e7c4ebe2f9cd68588eb24ba4ed122e696e2d5272 ]
Use the general touchscreen method to config the max pressure for touch tsc2046(data sheet suggest 8 bit pressure), otherwise, for ABS_PRESSURE, when config the same max and min value, weston will meet the following issue,
[17:19:39.183] event1 - ADS7846 Touchscreen: is tagged by udev as: Touchscreen [17:19:39.183] event1 - ADS7846 Touchscreen: kernel bug: device has min == max on ABS_PRESSURE [17:19:39.183] event1 - ADS7846 Touchscreen: was rejected [17:19:39.183] event1 - not using input device '/dev/input/event1'
This will then cause the APP weston-touch-calibrator can't list touch devices.
root@imx6ul7d:~# weston-touch-calibrator could not load cursor 'dnd-move' could not load cursor 'dnd-copy' could not load cursor 'dnd-none' No devices listed.
And accroding to binding Doc, "ti,x-max", "ti,y-max", "ti,pressure-max" belong to the deprecated properties, so remove them. Also for "ti,x-min", "ti,y-min", "ti,x-plate-ohms", the value set in dts equal to the default value in driver, so are redundant, also remove here.
--- arch/arm/boot/dts/imx7d-sdb.dts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/arm/boot/dts/imx7d-sdb.dts +1 -6
@@ -199,12 +199,7 @@ tsc2046@0 { interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/17 soc: mediatek: Let PMIC Wrapper and SCPSYS depend on OF
In reply to Sasha LevinFrom: Jean Delvare <[email protected]>
[ Upstream commit 2778caedb5667239823a29148dfc48b26a8b3c2a ]
With the following configuration options:CONFIG_OF is not setCONFIG_MTK_PMIC_WRAP=yCONFIG_MTK_SCPSYS=y
we get the following build warnings:
CC drivers/soc/mediatek/mtk-pmic-wrap.odrivers/soc/mediatek/mtk-pmic-wrap.c:2138:34: warning: ‘of_pwrap_match_tbl’ defined but not used [-Wunused-const-variable=] drivers/soc/mediatek/mtk-pmic-wrap.c:1953:34: warning: ‘of_slave_match_tbl’ defined but not used [-Wunused-const-variable=]
CC drivers/soc/mediatek/mtk-scpsys.odrivers/soc/mediatek/mtk-scpsys.c:1084:34: warning: ‘of_scpsys_match_tbl’ defined but not used [-Wunused-const-variable=]
Looking at the code, both drivers can only bind to OF-defined device nodes, so these drivers are useless without OF and should therefore depend on it.
Also drop of_match_ptr() from both drivers. We already know what it will resolve to, so we might as well save cpp some work.
Developers or QA teams who wish to test-build the code can still do so by enabling CONFIG_OF, which is available on all architectures and has no dependencies.
--- drivers/soc/mediatek/Kconfig | 2 ++ drivers/soc/mediatek/mtk-pmic-wrap.c | 2 +- drivers/soc/mediatek/mtk-scpsys.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/soc/mediatek/Kconfig +2 -0
@@ -28,6 +28,7 @@ config MTK_INFRACFG config MTK_PMIC_WRAP tristate "MediaTek PMIC Wrapper Support" depends on RESET_CONTROLLER + depends on OF select REGMAP help Say yes here to add support for MediaTek PMIC Wrapper found
@@ -37,6 +38,7 @@ config MTK_PMIC_WRAP config MTK_SCPSYS bool "MediaTek SCPSYS Support" default ARCH_MEDIATEK + depends on OF select REGMAP select MTK_INFRACFG select PM_GENERIC_DOMAINS if PM
drivers/soc/mediatek/mtk-pmic-wrap.c +1 -1
@@ -2174,7 +2174,7 @@ static int pwrap_probe(struct platform_device *pdev)static struct platform_driver pwrap_drv = { .driver = { .name ="mt-pmic-pwrap" , - .of_match_table =of_match_ptr (of_pwrap_match_tbl), + .of_match_table = of_pwrap_match_tbl, }, .probe = pwrap_probe, };
drivers/soc/mediatek/mtk-scpsys.c +1 -1
@@ -1141,7 +1141,7 @@ static struct platform_driver scpsys_drv = { .name = "mtk-scpsys", .suppress_bind_attrs = true, .owner = THIS_MODULE, - .of_match_table = of_match_ptr(of_scpsys_match_tbl), + .of_match_table = of_scpsys_match_tbl, }, };builtin_platform_driver (scpsys_drv);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/17 ARM: dts: imx6q: add missing properties for sram
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit b11d083c5dcec7c42fe982c854706d404ddd3a5f ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6q.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6q.dtsi +3 -0
@@ -163,6 +163,9 @@ soc { ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/17 ARM: dts: imx6dl: add missing properties for sram
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit f5848b95633d598bacf0500e0108dc5961af88c0 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6dl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6dl.dtsi +3 -0
@@ -84,6 +84,9 @@ soc { ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/17 ARM: dts: imx6qp: add missing properties for sram
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 088fe5237435ee2f7ed4450519b2ef58b94c832f ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@940000: '#address-cells' is a required property sram@940000: '#size-cells' is a required property sram@940000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6qp.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6qp.dtsi +6 -0
@@ -9,12 +9,18 @@ soc { ocram2: sram@940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/17 ARM: dts: imx6sl: add missing properties for sram
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 60c9213a1d9941a8b33db570796c3f9be8984974 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6sl.dtsi +3 -0
@@ -114,6 +114,9 @@ soc { ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/17 ARM: dts: imx6sll: add missing properties for sram
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 7492a83ed9b7a151e2dd11d64b06da7a7f0fa7f9 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sll.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6sll.dtsi +3 -0
@@ -115,6 +115,9 @@ soc { ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/17 ARM: dts: imx6sx: add missing properties for sram
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 415432c008b2bce8138841356ba444631cabaa50 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6sx.dtsi +6 -0
@@ -161,12 +161,18 @@ soc { ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/17 kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 5c152c2f66f9368394b89ac90dc7483476ef7b88 ]
When arm64 signal context data overflows the base struct sigcontext it gets placed in an extra buffer pointed to by a record of type EXTRA_CONTEXT in the base struct sigcontext which is required to be the last record in the base struct sigframe. The current validation code attempts to check this by using GET_RESV_NEXT_HEAD() to step forward from the current record to the next but that is a macro which assumes it is being provided with a struct _aarch64_ctx and uses the size there to skip forward to the next record. Instead validate_extra_context() passes it a struct extra_context which has a separate size field. This compiles but results in us trying to validate a termination record in completely the wrong place, at best failing validation and at worst just segfaulting. Fix this by passing the struct _aarch64_ctx we meant to into the macro.
--- tools/testing/selftests/arm64/signal/testcases/testcases.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/signal/testcases/testcases.c +1 -1
@@ -33,7 +33,7 @@ bool validate_extra_context(struct extra_context *extra, char **err)return false;fprintf (stderr,"Validating EXTRA...\n" ); - term =GET_RESV_NEXT_HEAD (extra); + term =GET_RESV_NEXT_HEAD (&extra->head);if (!term || term->magic || term->size) { *err ="Missing terminator after EXTRA context" ;return false;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/17 arm64: dts: imx8mq-librem5: Add bq25895 as max17055's power supply
In reply to Sasha LevinFrom: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 6effe295e1a87408033c29dbcea9d5a5c8b937d5 ]
This allows the userspace to notice that there's not enough current provided to charge the battery, and also fixes issues with 0% SOC values being considered invalid.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +1 -0
@@ -899,6 +899,7 @@ bat: fuel-gauge@36 { interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/17 ARM: orion: fix include path
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 63872304bdb3decd5454f4dd210c25395278ed13 ]
Now that CONFIG_ARCH_MULTIPLATFORM can be disabled anywhere, there is a build failure for plat-orion:
arch/arm/plat-orion/irq.c:19:10: fatal error: plat/irq.h: No such file or directory
Make the include path unconditional.
--- arch/arm/plat-orion/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/plat-orion/Makefile +1 -1
@@ -2,7 +2,7 @@ # # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include +ccflags-y := -I$(srctree)/$(src)/include orion-gpio-$(CONFIG_GPIOLIB) += gpio.o obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/17 btrfs: scrub: try to fix super block errors
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit f9eab5f0bba76742af654f33d517bf62a0db8f12 ]
[BUG]
The following script shows that, although scrub can detect super block errors, it never tries to fix it:
mkfs.btrfs -f -d raid1 -m raid1 $dev1 $dev2 xfs_io -c "pwrite 67108864 4k" $dev2
mount $dev1 $mnt
btrfs scrub start -B $dev2
btrfs scrub start -Br $dev2
umount $mnt
The first scrub reports the super error correctly:
scrub done for f3289218-abd3-41ac-a630-202f766c0859
Scrub started: Tue Aug 2 14:44:11 2022
Status: finished
Duration: 0:00:00
Total to scrub: 1.26GiB
Rate: 0.00B/s
Error summary: super=1
Corrected: 0
Uncorrectable: 0
Unverified: 0But the second read-only scrub still reports the same super error:
Scrub started: Tue Aug 2 14:44:11 2022
Status: finished
Duration: 0:00:00
Total to scrub: 1.26GiB
Rate: 0.00B/s
Error summary: super=1
Corrected: 0
Uncorrectable: 0
Unverified: 0[CAUSE]
The comments already shows that super block can be easily fixed by committing a transaction:
/*
* If we find an error in a super block, we just report it.
* They will get written with the next transaction commit
* anyway
*/
But the truth is, such assumption is not always true, and since scrub should try to repair every error it found (except for read-only scrub), we should really actively commit a transaction to fix this.
[FIX]
Just commit a transaction if we found any super block errors, after everything else is done.
We cannot do this just after scrub_supers(), as btrfs_commit_transaction() will try to pause and wait for the running scrub, thus we can not call it with scrub_lock hold.
--- fs/btrfs/scrub.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
fs/btrfs/scrub.c +36 -0
@@ -3811,6 +3811,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,int ret;struct btrfs_device *dev;unsigned int nofs_flag; +bool need_commit = false;if (btrfs_fs_closing (fs_info))return -EAGAIN ;
@@ -3924,6 +3925,12 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,*/ nofs_flag =memalloc_nofs_save ();if (!is_dev_replace) { +u64 old_super_errors; + +spin_lock (&sctx->stat_lock); + old_super_errors = sctx->stat.super_errors; +spin_unlock (&sctx->stat_lock); +btrfs_info (fs_info,"scrub: started on devid %llu" , devid);/* * by holding device list mutex, we can
@@ -3932,6 +3939,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,mutex_lock (&fs_info->fs_devices->device_list_mutex); ret =scrub_supers (sctx, dev);mutex_unlock (&fs_info->fs_devices->device_list_mutex); + +spin_lock (&sctx->stat_lock); +/* +* Super block errors found, but we can not commit transaction +* at current context, since btrfs_commit_transaction() needs +* to pause the current running scrub (hold by ourselves). +*/ +if (sctx->stat.super_errors > old_super_errors && !sctx->readonly) + need_commit = true; +spin_unlock (&sctx->stat_lock); }if (!ret)
@@ -3958,6 +3975,25 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,scrub_workers_put (fs_info);scrub_put_ctx (sctx); +/* +* We found some super block errors before, now try to force a +* transaction commit, as scrub has finished. +*/ +if (need_commit) { +struct btrfs_trans_handle *trans; + + trans =btrfs_start_transaction (fs_info->tree_root,0 ); +if (IS_ERR (trans)) { + ret =PTR_ERR (trans); +btrfs_err (fs_info, +"scrub: failed to start transaction to fix super block errors: %d" , ret); +return ret; + } + ret =btrfs_commit_transaction (trans); +if (ret <0 ) +btrfs_err (fs_info, +"scrub: failed to commit transaction to fix super block errors: %d" , ret); + }return ret; out:scrub_workers_put (fs_info);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/17 btrfs: check superblock to ensure the fs was not modified at thaw time
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit a05d3c9153145283ce9c58a1d7a9056fbb85f6a1 ]
[BACKGROUND]
There is an incident report that, one user hibernated the system, with one btrfs on removable device still mounted.
Then by some incident, the btrfs got mounted and modified by another system/OS, then back to the hibernated system.
After resuming from the hibernation, new write happened into the victim btrfs.
Now the fs is completely broken, since the underlying btrfs is no longer the same one before the hibernation, and the user lost their data due to various transid mismatch.
[REPRODUCER]
We can emulate the situation using the following small script:
truncate -s 1G $dev
mkfs.btrfs -f $dev
mount $dev $mnt
fsstress -w -d $mnt -n 500
sync
xfs_freeze -f $mnt
cp $dev $dev.backup
# There is no way to mount the same cloned fs on the same system,
# as the conflicting fsid will be rejected by btrfs. # Thus here we have to wipe the fs using a different btrfs. mkfs.btrfs -f $dev.backup
dd if=$dev.backup of=$dev bs=1M
xfs_freeze -u $mnt
fsstress -w -d $mnt -n 20
umount $mnt
btrfs check $dev
The final fsck will fail due to some tree blocks has incorrect fsid.
This is enough to emulate the problem hit by the unfortunate user.
[ENHANCEMENT]
Although such case should not be that common, it can still happen from time to time.
From the view of btrfs, we can detect any unexpected super block change, and if there is any unexpected change, we just mark the fs read-only, and thaw the fs.
By this we can limit the damage to minimal, and I hope no one would lose their data by this anymore.
--- fs/btrfs/disk-io.c | 25 ++++++++++++++----- fs/btrfs/disk-io.h | 4 +++- fs/btrfs/super.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/volumes.c | 2 +- 4 files changed, 83 insertions(+), 8 deletions(-)
fs/btrfs/disk-io.c +19 -6
@@ -2400,8 +2400,8 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info)* 1, 2 2nd and 3rd backup copy * -1 skip bytenr check */ -static int validate_super (struct btrfs_fs_info *fs_info, -struct btrfs_super_block *sb,int mirror_num) +int btrfs_validate_super (struct btrfs_fs_info *fs_info, +struct btrfs_super_block *sb,int mirror_num) {u64 nodesize =btrfs_super_nodesize (sb);u64 sectorsize =btrfs_super_sectorsize (sb);
@@ -2576,7 +2576,7 @@ static int validate_super(struct btrfs_fs_info *fs_info,*/ static int btrfs_validate_mount_super (struct btrfs_fs_info *fs_info) { -return validate_super (fs_info, fs_info->super_copy,0 ); +return btrfs_validate_super (fs_info, fs_info->super_copy,0 ); }/*
@@ -2590,7 +2590,7 @@ static int btrfs_validate_write_super(struct btrfs_fs_info *fs_info, {int ret; - ret =validate_super (fs_info, sb,-1 ); + ret =btrfs_validate_super (fs_info, sb,-1 );if (ret <0 ) goto out;if (!btrfs_supported_super_csum (btrfs_super_csum_type (sb))) {
@@ -3500,7 +3500,7 @@ static void btrfs_end_super_write(struct bio *bio) }struct btrfs_super_block *btrfs_read_dev_one_super (struct block_device *bdev, -int copy_num) +int copy_num,bool drop_cache) {struct btrfs_super_block *super;struct page *page;
@@ -3511,6 +3511,19 @@ struct btrfs_super_block *btrfs_read_dev_one_super(struct block_device *bdev,if (bytenr +BTRFS_SUPER_INFO_SIZE >=i_size_read (bdev->bd_inode))return ERR_PTR (-EINVAL ); +if (drop_cache) { +/* This should only be called with the primary sb. */ +ASSERT (copy_num ==0 ); + +/* +* Drop the page of the primary superblock, so later read will +* always read from the device. +*/ +invalidate_inode_pages2_range (mapping, + bytenr >>PAGE_SHIFT , + (bytenr +BTRFS_SUPER_INFO_SIZE ) >>PAGE_SHIFT ); + } + page =read_cache_page_gfp (mapping, bytenr >>PAGE_SHIFT ,GFP_NOFS );if (IS_ERR (page))return ERR_CAST (page);
@@ -3542,7 +3555,7 @@ struct btrfs_super_block *btrfs_read_dev_super(struct block_device *bdev)* later supers, using BTRFS_SUPER_MIRROR_MAX instead */ for (i =0 ; i <1 ; i++) { - super =btrfs_read_dev_one_super (bdev, i); + super =btrfs_read_dev_one_super (bdev, i, false);if (IS_ERR (super))continue ;
fs/btrfs/disk-io.h +3 -1
@@ -54,10 +54,12 @@ int __cold open_ctree(struct super_block *sb,struct btrfs_fs_devices *fs_devices, char *options);void __cold close_ctree (struct btrfs_fs_info *fs_info); +int btrfs_validate_super (struct btrfs_fs_info *fs_info, +struct btrfs_super_block *sb,int mirror_num);int write_all_supers (struct btrfs_fs_info *fs_info,int max_mirrors);struct btrfs_super_block *btrfs_read_dev_super (struct block_device *bdev);struct btrfs_super_block *btrfs_read_dev_one_super (struct block_device *bdev, -int copy_num); +int copy_num,bool drop_cache);int btrfs_commit_super (struct btrfs_fs_info *fs_info);struct btrfs_root *btrfs_read_tree_root (struct btrfs_root *tree_root,struct btrfs_key *key);
fs/btrfs/super.c +60 -0
71 lines not on this page · raw message
fs/btrfs/volumes.c +1 -1
@@ -2069,7 +2069,7 @@ void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,struct page *page;int ret; - disk_super =btrfs_read_dev_one_super (bdev, copy_num); + disk_super =btrfs_read_dev_one_super (bdev, copy_num, false);if (IS_ERR (disk_super))continue ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/17 btrfs: add KCSAN annotations for unlocked access to block_rsv->full
In reply to Sasha LevinFrom: David Sterba <[email protected]>
[ Upstream commit 748f553c3c4c4f175c6c834358632aff802d72cf ]
KCSAN reports that there's unlocked access mixed with locked access, which is technically correct but is not a bug. To avoid false alerts at least from KCSAN, add annotation and use a wrapper whenever ->full is accessed for read outside of lock.
It is used as a fast check and only advisory. In the worst case the block reserve is found !full and becomes full in the meantime, but properly handled.
Depending on the value of ->full, btrfs_block_rsv_release decides where to return the reservation, and block_rsv_release_bytes handles a NULL pointer for block_rsv and if it's not NULL then it double checks the full status under a lock.
--- fs/btrfs/block-rsv.c | 2 +- fs/btrfs/block-rsv.h | 9 +++++++++ fs/btrfs/transaction.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-)
fs/btrfs/block-rsv.c +1 -1
@@ -285,7 +285,7 @@ u64 btrfs_block_rsv_release(struct btrfs_fs_info *fs_info,*/ if (block_rsv == delayed_rsv) target = global_rsv; -else if (block_rsv != global_rsv && !delayed_rsv->full) +else if (block_rsv != global_rsv && !btrfs_block_rsv_full (delayed_rsv)) target = delayed_rsv;if (target && block_rsv->space_info != target->space_info)
fs/btrfs/block-rsv.h +9 -0
@@ -90,4 +90,13 @@ static inline void btrfs_unuse_block_rsv(struct btrfs_fs_info *fs_info, btrfs_block_rsv_release(fs_info, block_rsv, 0, NULL); } +/* +* Fast path to check if the reserve is full, may be carefully used outside of +* locks. +*/ +static inline bool btrfs_block_rsv_full (const struct btrfs_block_rsv *rsv) +{ +return data_race (rsv->full); +} +#endif /* BTRFS_BLOCK_RSV_H */
fs/btrfs/transaction.c +2 -2
@@ -608,7 +608,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items,*/ num_bytes =btrfs_calc_insert_metadata_size (fs_info, num_items);if (flush ==BTRFS_RESERVE_FLUSH_ALL && - delayed_refs_rsv->full ==0 ) { +btrfs_block_rsv_full (delayed_refs_rsv) ==0 ) { delayed_refs_bytes = num_bytes; num_bytes <<=1 ; }
@@ -633,7 +633,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items,if (rsv->space_info->force_alloc) do_chunk_alloc = true; }else if (num_items ==0 && flush ==BTRFS_RESERVE_FLUSH_ALL && - !delayed_refs_rsv->full) { + !btrfs_block_rsv_full (delayed_refs_rsv)) {/* * Some people call with btrfs_start_transaction(root, 0) * because they can be throttled, but have some other mechanism
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/17 arm64: dts: uniphier: Add USB-device support for PXs3 reference board
In reply to Sasha LevinFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit 19fee1a1096d21ab1f1e712148b5417bda2939a2 ]
PXs3 reference board can change each USB port 0 and 1 to device mode with jumpers. Prepare devicetree sources for USB port 0 and 1.
This specifies dr_mode, pinctrl, and some quirks and removes nodes for unused phys and vbus-supply properties.
--- arch/arm/boot/dts/uniphier-pinctrl.dtsi | 10 +++++ arch/arm64/boot/dts/socionext/Makefile | 4 +- .../socionext/uniphier-pxs3-ref-gadget0.dts | 41 +++++++++++++++++++ .../socionext/uniphier-pxs3-ref-gadget1.dts | 40 ++++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts create mode 100644 arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts
arch/arm/boot/dts/uniphier-pinctrl.dtsi +10 -0
@@ -196,11 +196,21 @@ pinctrl_usb0: usb0 { function = "usb0"; }; + pinctrl_usb0_device: usb0-device { + groups = "usb0_device"; + function = "usb0"; + }; + pinctrl_usb1: usb1 { groups = "usb1"; function = "usb1"; }; + pinctrl_usb1_device: usb1-device { + groups = "usb1_device"; + function = "usb1"; + }; + pinctrl_usb2: usb2 { groups = "usb2"; function = "usb2";
arch/arm64/boot/dts/socionext/Makefile +3 -1
@@ -5,4 +5,6 @@ dtb-$(CONFIG_ARCH_UNIPHIER) += \ uniphier-ld20-akebi96.dtb \ uniphier-ld20-global.dtb \ uniphier-ld20-ref.dtb \ - uniphier-pxs3-ref.dtb + uniphier-pxs3-ref.dtb \ + uniphier-pxs3-ref-gadget0.dtb \ + uniphier-pxs3-ref-gadget1.dtb
arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts new file +41 -0
41 lines not on this page · raw message
arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// +// Device Tree Source for UniPhier PXs3 Reference Board (for USB-Device #1) +// +// Copyright (C) 2021 Socionext Inc. +// Author: Kunihiko Hayashi <[email protected]> + +/dts-v1/; +#include "uniphier-pxs3-ref.dts" + +/ { + model = "UniPhier PXs3 Reference Board (USB-Device #1)"; +}; + +/* I2C3 pinctrl is shared with USB*VBUSIN */ +&i2c3 { + status = "disabled"; +}; + +&usb1 { + status = "okay"; + dr_mode = "peripheral"; + pinctrl-0 = <&pinctrl_usb1_device>; + snps,dis_enblslpm_quirk; + snps,dis_u2_susphy_quirk; + snps,dis_u3_susphy_quirk; + snps,usb2_gadget_lpm_disable; + phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb1_hsphy0>, <&usb1_ssphy0>; +}; + +&usb1_hsphy0 { + /delete-property/ vbus-supply; +}; + +&usb1_ssphy0 { + /delete-property/ vbus-supply; +}; + +/delete-node/ &usb1_hsphy1;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 17/17 selftests/cpu-hotplug: Use return instead of exit
In reply to Sasha LevinFrom: Zhao Gongyi <[email protected]>
[ Upstream commit 972cf4ce51ef5532d56822af17defb148aac0ccb ]
Some cpus will be left in offline state when online function exits in some error conditions. Use return instead of exit to fix it.
--- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +8 -5
@@ -4,6 +4,7 @@ SYSFS= # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 +retval=0 prerequisite() {
@@ -102,10 +103,10 @@ online_cpu_expect_success() if ! online_cpu $cpu; then echo $FUNCNAME $cpu: unexpected fail >&2 - exit 1 + retval=1 elif ! cpu_is_online $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi }
@@ -128,10 +129,10 @@ offline_cpu_expect_success() if ! offline_cpu $cpu; then echo $FUNCNAME $cpu: unexpected fail >&2 - exit 1 + retval=1 elif ! cpu_is_offline $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi }
@@ -201,7 +202,7 @@ if [ $allcpus -eq 0 ]; then offline_cpu_expect_success $present_max online_cpu $present_max fi - exit 0 + exit $retval else echo "Full scope test: all hotplug cpus" echo -e "\t online all offline cpus"
@@ -291,3 +292,5 @@ done echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error /sbin/modprobe -q -r cpu-notifier-error-inject + +exit $retval
Signature · 1 line
2.35.1