v4l2_ctrl_new_std() fails if the caller provides no 'step' parameter for
integer control, so define it to fix following error:
s5p_mfc_dec_ctrls_setup:1166: Adding control (1) failed
Fixes: c3042bff91 ("media: s5p-mfc: Use display delay and display enable std controls")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
(cherry picked from commit 61c6f04a98)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ifda5a90145658218ec4d4d5603cba46a22597988
The function software_node_notify() - the function that creates
and removes the symlinks between the node and the device - was
called unconditionally in device_add_software_node() and
device_remove_software_node(), but it needs to be called in
those functions only in the special case where the node is
added to a device that has already been registered.
This fixes NULL pointer dereference that happens if
device_remove_software_node() is used with device that was
never registered.
Fixes: b622b24519 ("software node: Allow node addition to already existing device")
Reported-and-tested-by: Dominik Brodowski <linux@dominikbrodowski.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 5dca69e26f)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I1caca7eaaf76e9b6e48151cecf2219743690ba93
commit 6579c8d97a ("clk: Mark fwnodes when their clock provider is added")
revealed that clk/bcm/clk-raspberrypi.c driver calls
devm_of_clk_add_hw_provider(), with a NULL dev->of_node, which resulted in a
NULL pointer dereference in of_clk_add_hw_provider() when calling
fwnode_dev_initialized().
Returning 0 is reducing the if conditions in driver code and is being
consistent with the CONFIG_OF=n inline stub that returns 0 when CONFIG_OF
is disabled. The downside is that drivers will maybe register clkdev lookups
when they don't need to and waste some memory.
Fixes: 6579c8d97a ("clk: Mark fwnodes when their clock provider is added")
Fixes: 3c9ea42802 ("clk: Mark fwnodes when their clock provider is added/removed")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Saravana Kannan <saravanak@google.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20210426065618.588144-1-tudor.ambarus@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit bb4031b8af)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I13085a7a65f8577833fccafbfc42a8227bc562d8
If the port is going to send Discover_Identity Message, vdm_sm_running
flag was intentionally set before entering Ready States in order to
avoid the conflict because the port and the port partner might start
AMS at almost the same time after entering Ready States.
However, the original design has a problem. When the port is doing
DR_SWAP from Device to Host, it raises the flag. Later in the
tcpm_send_discover_work, the flag blocks the procedure of sending the
Discover_Identity and it might never be cleared until disconnection.
Since there exists another flag send_discover representing that the port
is going to send Discover_Identity or not, it is enough to use that flag
to prevent the conflict. Also change the timing of the set/clear of
vdm_sm_running to indicate whether the VDM SM is actually running or
not.
Fixes: c34e85fa69 ("usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work")
Cc: stable <stable@vger.kernel.org>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Link: https://lore.kernel.org/r/20210826124201.1562502-1-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ef52b4a9fchttps://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Bug: 191450181
Signed-off-by: Kyle Tso <kyletso@google.com>
Change-Id: I8cb84dfce764428a8fb33897f29fd8d0eb1c388e
Commit a20dcf53ea ("usb: typec: tcpm: Respond Not_Supported if no
snk_vdo"), stops tcpm_pd_data_request() calling tcpm_handle_vdm_request()
when port->nr_snk_vdo is not set. But the VDM might be intended for an
altmode-driver, in which case nr_snk_vdo does not matter.
This change breaks the forwarding of connector hotplug (HPD) events
for displayport altmode on devices which don't set nr_snk_vdo.
tcpm_pd_data_request() is the only caller of tcpm_handle_vdm_request(),
so we can move the nr_snk_vdo check to inside it, at which point we
have already looked up the altmode device so we can check for this too.
Doing this check here also ensures that vdm_state gets set to
VDM_STATE_DONE if it was VDM_STATE_BUSY, even if we end up with
responding with PD_MSG_CTRL_NOT_SUPP later.
Note that tcpm_handle_vdm_request() was already sending
PD_MSG_CTRL_NOT_SUPP in some circumstances, after moving the nr_snk_vdo
check the same error-path is now taken when that check fails. So that
we have only one error-path for this and not two. Replace the
tcpm_queue_message(PD_MSG_CTRL_NOT_SUPP) used by the existing error-path
with the more robust tcpm_pd_handle_msg() from the (now removed) second
error-path.
Fixes: a20dcf53ea ("usb: typec: tcpm: Respond Not_Supported if no snk_vdo")
Cc: stable <stable@vger.kernel.org>
Cc: Kyle Tso <kyletso@google.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210816154632.381968-1-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 5571ea3117https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Bug: 191450181
Signed-off-by: Kyle Tso <kyletso@google.com>
Change-Id: Iaeb5164f96ab2b6ff5d6d37e8824a01b0b63ae63
During a USB cable disconnect, or soft disconnect scenario, a pending
SETUP transaction may not be completed, leading to the following
error:
dwc3 a600000.dwc3: timed out waiting for SETUP phase
If this occurs, then the entire pullup disable routine is skipped and
proper cleanup and halting of the controller does not complete.
Instead of returning an error (which is ignored from the UDC
perspective), allow the pullup disable routine to continue, which
will also handle disabling of EP0/1. This will end any active
transfers as well. Ensure to clear any delayed_status also, as the
timeout could happen within the STATUS stage.
Cc: <stable@vger.kernel.org>
Fixes: bb01473648 ("usb: dwc3: gadget: don't clear RUN/STOP when it's invalid to do so")
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Bug: 196421704
Link: https://lore.kernel.org/linux-usb/20210825042855.7977-1-wcheng@codeaurora.org/
Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Change-Id: Ia3077a4588f63a2bbe0cd97af1fd748228f2ed07
Export core function required for clk scaling post design change.
This would help make clk scaling part of vendor module.
Bug: 192337957
Link: https://lore.kernel.org/lkml/1571668177-3766-2-git-send-email-
rampraka@codeaurora.org/
Change-Id: I0c5eccb2052197b3a290f7322429cab679c5ade5
Signed-off-by: Nitin Rawat <nitirawa@codeaurora.org>
Signed-off-by: Ram Prakash Gupta <rampraka@codeaurora.org>
The QCOM PDC driver creates a bunch of unnecessary levels in
the interrupt hierarchy when dealing with non-wakeup-capable
interrupts. By definition, these lines are terminated at the
PDC level, and everything below this is completely fake.
This also results in additional complexity as most of the
callbacks have to check for the validity of the parent level.
Needless to say, this doesn't look very good.
Solve this by disconnecting the interrupt hierarchy below
the last valid level, and considerably simplify the handling
of all the other interrupts by avoiding now unnecessary cheks.
In most cases, the standard irq_*_parent() handlers are directly
used.
This also cures an issue reporting by Maulik where gpio_to_irq()
returns an error after having observed a set of invalid levels.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
Tested-by: Maulik Shah <mkshah@codeaurora.org>
Link: https://lore.kernel.org/r/1629705880-27877-3-git-send-email-mkshah@codeaurora.org
Bug: 196928089
(cherry picked from commit 9d4f24bfe0https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git irq/irqchip-next)
Change-Id: Idec7d3b80e0d170be425f1e24efd41ad451bff4e
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This change adds the dev_coredumpm() API to the symbol list
to allow for custom read and free functions to be called to
dump data.
Bug: 197318507
Change-Id: Ib84b25dd2f075ae9bf8919dcd76451fff5e86f2b
Signed-off-by: Siddharth Gupta <quic_sidgup@quicinc.com>
Originally the addr != NULL check was meant to take care of the case
where __kfence_pool == NULL (KFENCE is disabled). However, this does
not work for addresses where addr > 0 && addr < KFENCE_POOL_SIZE.
This can be the case on NULL-deref where addr > 0 && addr < PAGE_SIZE or
any other faulting access with addr < KFENCE_POOL_SIZE. While the
kernel would likely crash, the stack traces and report might be
confusing due to double faults upon KFENCE's attempt to unprotect such
an address.
Fix it by just checking that __kfence_pool != NULL instead.
Link: https://lkml.kernel.org/r/20210818130300.2482437-1-elver@google.com
Fixes: 0ce20dd840 ("mm: add Kernel Electric-Fence infrastructure")
Signed-off-by: Marco Elver <elver@google.com>
Reported-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Acked-by: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org> [5.12+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit a7cb5d23ea)
Bug: 196937223
Bug: 197197917
Test: local QEMU runs with init/main.c modified to access the NULL page
Signed-off-by: Alexander Potapenko <glider@google.com>
Change-Id: I6a339e8c6b4d2bdc3ee9bd575725489a8233aade
Expicitly set what is visible to userspace
Bug: 196046570
Test: passed netd test suites
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Iacec0ef8ae290e01f1b60508d8abcd40a3653c83
Initialize message buffer for quota2_log to avoid sending
random data.
Bug: 196046570
Test: passed netd test suites
Fixes: 10cda83af9 ("ANDROID: netfilter: xt_quota2: adding the
original quota2 from xtables-addons")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ic9f34aaa2593809b375fc649b74567190c99dc62
Make sure string only contains the characters specified by userspace.
Fix cherry-picked from xtables-extensions project
Signed-off-by: Sam Liddicott <sam@liddicott.com>
Bug: 196046570
Test: passed netd test suites
Fixes: 10cda83af9 ("ANDROID: netfilter: xt_quota2: adding the
original quota2 from xtables-addons")
Signed-off-by: Todd Kjos <tkjos@google.com>
(cherry picked from https://git.code.sf.net/p/xtables-addons/xtables-addons
bc2bcc383c70b293bd816c29523a952ca8736fb5)
Change-Id: I965448564906e5fbf0fe6d6414f44d9e257ea195
Add the below to ABI symbol list -
console_printk
kmsg_dump_get_line
send_sig_info
Bug: 197173550
Signed-off-by: linjunting <linjunting@oppo.com>
Change-Id: Ia515c994dbf31a4f4e902a11835a635ab2b319b7
If rcu_read_lock_sched tracing is enabled, the tracing subsystem can
perform a jump which needs to be checked by CFI. For example, stm_ftrace
source is enabled as a module and hooks into enabled ftrace events. This
can cause an recursive loop where find_shadow_check_fn ->
rcu_read_lock_sched -> (call to stm_ftrace generates cfi slowpath) ->
find_shadow_check_fn -> rcu_read_lock_sched -> ...
To avoid the recursion, either the ftrace codes needs to be marked with
__no_cfi or CFI should not trace. Use the "_notrace" in CFI to avoid
tracing so that CFI can guard ftrace.
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Cc: stable@vger.kernel.org
Fixes: cf68fffb66 ("add support for Clang CFI")
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210811155914.19550-1-quic_eberman@quicinc.com
Bug: 194223154
Change-Id: I7d112496c7f503f95ba69390f6454623cf6dfed2
(cherry picked from commit 14c4c8e415)
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
unix_gc() assumes that candidate sockets can never gain an external
reference (i.e. be installed into an fd) while the unix_gc_lock is
held. Except for MSG_PEEK this is guaranteed by modifying inflight
count under the unix_gc_lock.
MSG_PEEK does not touch any variable protected by unix_gc_lock (file
count is not), yet it needs to be serialized with garbage collection.
Do this by locking/unlocking unix_gc_lock:
1) increment file count
2) lock/unlock barrier to make sure incremented file count is visible
to garbage collection
3) install file into fd
This is a lock barrier (unlike smp_mb()) that ensures that garbage
collection is run completely before or completely after the barrier.
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit cbcf01128d)
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 196926917
Change-Id: Iaae09d2603c9a680b596d0501479296491ee3d64
Add initial i.MX symbol list file: abi_gki_aarch64_imx.
No new symbols added.
Bug: 194108974
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: Ic948edbb9a9b9ef866702e4901d714b0c89881bf
If rcu_print_task_stall() is invoked on an rcu_node structure that does
not contain any tasks blocking the current grace period, it takes an
early exit that fails to release that rcu_node structure's lock. This
results in a self-deadlock, which is detected by lockdep.
To reproduce this bug:
tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 3 --trust-make --configs "TREE03" --kconfig "CONFIG_PROVE_LOCKING=y" --bootargs "rcutorture.stall_cpu=30 rcutorture.stall_cpu_block=1 rcutorture.fwd_progress=0 rcutorture.test_boost=0"
This will also result in other complaints, including RCU's scheduler
hook complaining about blocking rather than preemption and an rcutorture
writer stall.
Only a partial RCU CPU stall warning message will be printed because of
the self-deadlock.
This commit therefore releases the lock on the rcu_print_task_stall()
function's early exit path.
Fixes: c583bcb8f5 ("rcu: Don't invoke try_invoke_on_locked_down_task() with irqs disabled")
Tested-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
BUG: 196874644
(cherry picked from commit dc87740c8ahttps://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev)
Signed-off-by: Cheng Jui Wang <cheng-jui.wang@mediatek.com>
Change-Id: I0942973e3fbac2d666d8eb9ed59b1701af13248a
The following scenario describes an echo test for
Samsung USBC Headset (AKG) with VID/PID (0x04e8/0xa051).
We first start a capture stream(USB IN transfer) in 96Khz/24bit/1ch mode.
In clock find source function, we get value 0x2 for clock selector
and 0x1 for clock source.
Kernel-4.14 behavior
Since clock source is valid so clock selector was not set again.
We pass through this function and start a playback stream(USB OUT transfer)
in 48Khz/32bit/2ch mode. This time we get value 0x1 for clock selector
and 0x1 for clock source. Finally clock id with this setting is 0x9.
Kernel-5.10 behavior
Clock selector was always set one more time even it is valid.
When we start a playback stream, we will get 0x2 for clock selector
and 0x1 for clock source. In this case clock id becomes 0xA.
This is an incorrect clock source setting and results in severe noises.
We see wrong data rate in USB IN transfer.
(From 288 bytes/ms becomes 144 bytes/ms) It should keep in 288 bytes/ms.
This earphone works fine on older kernel version load because
this is a newly-added behavior.
Bug: 196943902
Link: https://lore.kernel.org/patchwork/patch/1466711/
cherry picked from commit 4511781f95
Signed-off-by: chihhao.chen <chihhao.chen@mediatek.com>
Change-Id: I02731595572e3066fc1abda6009ca6c032b467e8
The logs attached to bug 196797012 show that the error handler has been
activated and also that a SECURITY PROTOCOL OUT command is being
retried but not why. Hence this patch that adds more logging.
Notes:
- The code that initializes the completion status to
OCS_INVALID_COMMAND_STATUS was introduced by the initial UFS commit.
See also 7a3e97b0dc ("[SCSI] ufshcd: UFS Host controller driver").
- The behavior to retry a command if the controller did not overwrite
the completion status was introduced by commit e8e7f27139 ("scsi:
ufs: Improve UFS fatal error handling") without explaining why. From
that commit:
+ case OCS_INVALID_COMMAND_STATUS:
+ result |= DID_REQUEUE << 16;
+ break;
Bug: 196797012
Change-Id: I86ce4149babde1daf07af94464b878e9e697b37b
Signed-off-by: Bart Van Assche <bvanassche@google.com>
For power and performance monitoring, need to known tasks' runtime for
loading estimation.
But now, other modules can't get task_scehd_runtime.
Export task_sched_runtime to let other modules get task_scehd_runtime.
Bug: 195914330
Signed-off-by: Poting Chen <poting.chen@mediatek.com>
Signed-off-by: Cheng Jui Wang <cheng-jui.wang@mediatek.com>
Change-Id: Ida5caf8ed0a32954fc0b0ed950f163c7ca493fef
There is a usecase in Android that an app process's memory is swapped
out by process_madvise() with MADV_PAGEOUT, such as the memory is
swapped to zram or a backing device. When the process is scheduled to
running, like switch to foreground, multiple page faults may cause the
app dropped frames.
To reduce the problem, SMS can read-ahead memory of the process
immediately when the app switches to forground.
Calling process_madvise() with MADV_WILLNEED can meet this need.
Link: https://lore.kernel.org/patchwork/patch/1472006/
Bug: 194967441
Signed-off-by: Kui Zhang <zhagnkui@oppo.com>
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: Ie4203ff76da74cf34498cfee6569a6c7fc624bb2
Mailbox channels for the base protocol are setup during probe.
There can be a scenario where probe fails to acquire the base
protocol due to a timeout leading to cleaning up of all device
managed memory including the scmi_mailbox structure setup during
mailbox_chan_setup function.
| arm-scmi soc:qcom,scmi: timed out in resp(caller: version_get+0x84/0x140)
| arm-scmi soc:qcom,scmi: unable to communicate with SCMI
| arm-scmi: probe of soc:qcom,scmi failed with error -110
Now when a message arrives at cpu slightly after the timeout, the mailbox
controller will try to call the rx_callback of the client and might end
up accessing freed memory.
| rx_callback+0x24/0x160
| mbox_chan_received_data+0x44/0x94
| __handle_irq_event_percpu+0xd4/0x240
This patch frees the mailbox channels setup during probe and adds some more
error handling in case the probe fails.
Link: https://lore.kernel.org/r/1628111999-21595-1-git-send-email-rishabhb@codeaurora.org
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Bug: 196063834
(cherry picked from commit 1e7cbfaa66
git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git/ for-next/scmi)
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
Change-Id: I3502b0905dd5e21e6189c125f182fd1fb29eaba8
Enable CONFIG_NFC to support GKI general android device.
When we set CONFIG_NFC=m for driver enable, nfc.ko module needs many
network ABI. So, make CONFIG_NFC=y in gki kernel to ensure all other
nfc device can use without adding ABI list.
- ABI list needed by nfc.ko (CONFIG_NFC=m)
add_wait_queue
add_wait_queue_exclusive
capable
class_dev_iter_exit
class_dev_iter_init
class_dev_iter_next
_copy_from_iter_full
datagram_poll
default_wake_function
lock_sock_nested
nla_strlcpy
proto_register
proto_unregister
__pskb_copy_fclone
release_sock
remove_wait_queue
security_sock_graft
sk_alloc
skb_copy_datagram_iter
skb_free_datagram
skb_recv_datagram
skb_unlink
sk_free
sock_alloc_send_skb
sock_init_data
sock_no_accept
sock_no_bind
sock_no_connect
sock_no_getname
sock_no_ioctl
sock_no_listen
sock_no_mmap
sock_no_sendmsg
sock_no_shutdown
sock_no_socketpair
sock_queue_rcv_skb
__sock_recv_timestamp
__sock_recv_wifi_status
sock_register
sock_unregister
Bug: 196480985
Change-Id: Ie6f0d4bec65c1e2663493e9165b7072dea7c5348
Signed-off-by: Hajun Sung <hajun.sung@samsung.com>
There is currently nothing preventing tasks from changing their per-task
clamp values in anyway that they like. The rationale is probably that
system administrators are still able to limit those clamps thanks to the
cgroup interface. However, this causes pain in a system where both
per-task and per-cgroup clamp values are expected to be under the
control of core system components (as is the case for Android).
To fix this, let's require CAP_SYS_NICE to change per-task clamp values.
There are ongoing discussions upstream about more flexible approaches
than this using the RLIMIT API -- see [1]. But the upstream discussion
has not converged yet, and this is way too late for UAPI changes in
android12-5.10 anyway, so let's apply this change which provides the
behaviour we want without actually impacting UAPIs.
[1] https://lore.kernel.org/lkml/20210623123441.592348-4-qperret@google.com/
Bug: 187186685
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: I749312a77306460318ac5374cf243d00b78120dd
blk_ksm_init_passthrough() is now used.
Bug: 191417025
Change-Id: I414f03df413e44230a7569ba284d39178fbfe104
Signed-off-by: Eric Biggers <ebiggers@google.com>
Enable CONFIG_SCSI_UFS_HPB such that the UFS HPB (Host Performance Booster)
feature can be used. From an Android test device running a kernel with this
patch applied:
$ cd /sys/devices/...ufs/host0
$ grep -aH . */*/hpb*/*
grep: target0:0:0/0:0:0:0/hpb_params/activation_thld: No such device
grep: target0:0:0/0:0:0:0/hpb_params/eviction_thld_enter: No such device
grep: target0:0:0/0:0:0:0/hpb_params/eviction_thld_exit: No such device
grep: target0:0:0/0:0:0:0/hpb_params/inflight_map_req: No such device
grep: target0:0:0/0:0:0:0/hpb_params/normalization_factor: No such device
grep: target0:0:0/0:0:0:0/hpb_params/read_timeout_expiries: No such device
grep: target0:0:0/0:0:0:0/hpb_params/read_timeout_ms: No such device
grep: target0:0:0/0:0:0:0/hpb_params/requeue_timeout_ms: No such device
grep: target0:0:0/0:0:0:0/hpb_params/timeout_polling_interval_ms: No such device
grep: target0:0:0/0:0:0:0/hpb_stats/hit_cnt: No such device
grep: target0:0:0/0:0:0:0/hpb_stats/map_req_cnt: No such device
grep: target0:0:0/0:0:0:0/hpb_stats/miss_cnt: No such device
grep: target0:0:0/0:0:0:0/hpb_stats/rb_active_cnt: No such device
grep: target0:0:0/0:0:0:0/hpb_stats/rb_inactive_cnt: No such device
grep: target0:0:0/0:0:0:0/hpb_stats/rb_noti_cnt: No such device
grep: target0:0:0/0:0:0:0/hpb_stats/umap_req_cnt: No such device
grep: target0:0:0/0:0:0:1/hpb_params/activation_thld: No such device
grep: target0:0:0/0:0:0:1/hpb_params/eviction_thld_enter: No such device
grep: target0:0:0/0:0:0:1/hpb_params/eviction_thld_exit: No such device
grep: target0:0:0/0:0:0:1/hpb_params/inflight_map_req: No such device
grep: target0:0:0/0:0:0:1/hpb_params/normalization_factor: No such device
grep: target0:0:0/0:0:0:1/hpb_params/read_timeout_expiries: No such device
grep: target0:0:0/0:0:0:1/hpb_params/read_timeout_ms: No such device
grep: target0:0:0/0:0:0:1/hpb_params/requeue_timeout_ms: No such device
grep: target0:0:0/0:0:0:1/hpb_params/timeout_polling_interval_ms: No such device
grep: target0:0:0/0:0:0:1/hpb_stats/hit_cnt: No such device
grep: target0:0:0/0:0:0:1/hpb_stats/map_req_cnt: No such device
grep: target0:0:0/0:0:0:1/hpb_stats/miss_cnt: No such device
grep: target0:0:0/0:0:0:1/hpb_stats/rb_active_cnt: No such device
grep: target0:0:0/0:0:0:1/hpb_stats/rb_inactive_cnt: No such device
grep: target0:0:0/0:0:0:1/hpb_stats/rb_noti_cnt: No such device
grep: target0:0:0/0:0:0:1/hpb_stats/umap_req_cnt: No such device
grep: target0:0:0/0:0:0:2/hpb_params/activation_thld: No such device
grep: target0:0:0/0:0:0:2/hpb_params/eviction_thld_enter: No such device
grep: target0:0:0/0:0:0:2/hpb_params/eviction_thld_exit: No such device
grep: target0:0:0/0:0:0:2/hpb_params/inflight_map_req: No such device
grep: target0:0:0/0:0:0:2/hpb_params/normalization_factor: No such device
grep: target0:0:0/0:0:0:2/hpb_params/read_timeout_expiries: No such device
grep: target0:0:0/0:0:0:2/hpb_params/read_timeout_ms: No such device
grep: target0:0:0/0:0:0:2/hpb_params/requeue_timeout_ms: No such device
grep: target0:0:0/0:0:0:2/hpb_params/timeout_polling_interval_ms: No such device
grep: target0:0:0/0:0:0:2/hpb_stats/hit_cnt: No such device
grep: target0:0:0/0:0:0:2/hpb_stats/map_req_cnt: No such device
grep: target0:0:0/0:0:0:2/hpb_stats/miss_cnt: No such device
grep: target0:0:0/0:0:0:2/hpb_stats/rb_active_cnt: No such device
grep: target0:0:0/0:0:0:2/hpb_stats/rb_inactive_cnt: No such device
grep: target0:0:0/0:0:0:2/hpb_stats/rb_noti_cnt: No such device
grep: target0:0:0/0:0:0:2/hpb_stats/umap_req_cnt: No such device
grep: target0:0:0/0:0:0:3/hpb_params/activation_thld: No such device
grep: target0:0:0/0:0:0:3/hpb_params/eviction_thld_enter: No such device
grep: target0:0:0/0:0:0:3/hpb_params/eviction_thld_exit: No such device
grep: target0:0:0/0:0:0:3/hpb_params/inflight_map_req: No such device
grep: target0:0:0/0:0:0:3/hpb_params/normalization_factor: No such device
grep: target0:0:0/0:0:0:3/hpb_params/read_timeout_expiries: No such device
grep: target0:0:0/0:0:0:3/hpb_params/read_timeout_ms: No such device
grep: target0:0:0/0:0:0:3/hpb_params/requeue_timeout_ms: No such device
grep: target0:0:0/0:0:0:3/hpb_params/timeout_polling_interval_ms: No such device
grep: target0:0:0/0:0:0:3/hpb_stats/hit_cnt: No such device
grep: target0:0:0/0:0:0:3/hpb_stats/map_req_cnt: No such device
grep: target0:0:0/0:0:0:3/hpb_stats/miss_cnt: No such device
grep: target0:0:0/0:0:0:3/hpb_stats/rb_active_cnt: No such device
grep: target0:0:0/0:0:0:3/hpb_stats/rb_inactive_cnt: No such device
grep: target0:0:0/0:0:0:3/hpb_stats/rb_noti_cnt: No such device
grep: target0:0:0/0:0:0:3/hpb_stats/umap_req_cnt: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/activation_thld: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/eviction_thld_enter: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/eviction_thld_exit: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/inflight_map_req: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/normalization_factor: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/read_timeout_expiries: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/read_timeout_ms: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/requeue_timeout_ms: No such device
grep: target0:0:0/0:0:0:49456/hpb_params/timeout_polling_interval_ms: No such device
grep: target0:0:0/0:0:0:49456/hpb_stats/hit_cnt: No such device
grep: target0:0:0/0:0:0:49456/hpb_stats/map_req_cnt: No such device
grep: target0:0:0/0:0:0:49456/hpb_stats/miss_cnt: No such device
grep: target0:0:0/0:0:0:49456/hpb_stats/rb_active_cnt: No such device
grep: target0:0:0/0:0:0:49456/hpb_stats/rb_inactive_cnt: No such device
grep: target0:0:0/0:0:0:49456/hpb_stats/rb_noti_cnt: No such device
grep: target0:0:0/0:0:0:49456/hpb_stats/umap_req_cnt: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/activation_thld: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/eviction_thld_enter: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/eviction_thld_exit: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/inflight_map_req: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/normalization_factor: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/read_timeout_expiries: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/read_timeout_ms: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/requeue_timeout_ms: No such device
grep: target0:0:0/0:0:0:49476/hpb_params/timeout_polling_interval_ms: No such device
grep: target0:0:0/0:0:0:49476/hpb_stats/hit_cnt: No such device
grep: target0:0:0/0:0:0:49476/hpb_stats/map_req_cnt: No such device
grep: target0:0:0/0:0:0:49476/hpb_stats/miss_cnt: No such device
grep: target0:0:0/0:0:0:49476/hpb_stats/rb_active_cnt: No such device
grep: target0:0:0/0:0:0:49476/hpb_stats/rb_inactive_cnt: No such device
grep: target0:0:0/0:0:0:49476/hpb_stats/rb_noti_cnt: No such device
grep: target0:0:0/0:0:0:49476/hpb_stats/umap_req_cnt: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/activation_thld: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/eviction_thld_enter: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/eviction_thld_exit: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/inflight_map_req: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/normalization_factor: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/read_timeout_expiries: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/read_timeout_ms: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/requeue_timeout_ms: No such device
grep: target0:0:0/0:0:0:49488/hpb_params/timeout_polling_interval_ms: No such device
grep: target0:0:0/0:0:0:49488/hpb_stats/hit_cnt: No such device
grep: target0:0:0/0:0:0:49488/hpb_stats/map_req_cnt: No such device
grep: target0:0:0/0:0:0:49488/hpb_stats/miss_cnt: No such device
grep: target0:0:0/0:0:0:49488/hpb_stats/rb_active_cnt: No such device
grep: target0:0:0/0:0:0:49488/hpb_stats/rb_inactive_cnt: No such device
grep: target0:0:0/0:0:0:49488/hpb_stats/rb_noti_cnt: No such device
grep: target0:0:0/0:0:0:49488/hpb_stats/umap_req_cnt: No such device
Bug: 194163838
Bug: 195507090
Change-Id: I1aab63c83445e243be190396c452a4203e93dbc1
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Move the ufshpb_dev member into a new structure such that enabling HPB
does not affect the layout of other members of struct ufs_hba. This change
does not affect the ABI since UFS HPB support is currently disabled.
The only function that allocates a struct ufs_hba instance is
ufshcd_alloc_host() and that function allocates struct ufs_hba dynamically.
Modify that function such that it also allocates memory for the HPB data if
necessary.
Bug: 194163838
Bug: 195507090
Test: Built the kernel with this patch applied and installed it on an Android device.
Change-Id: Ia4c5ba07ae343576373ec116553c5fdee8f75a94
Signed-off-by: Bart Van Assche <bvanassche@google.com>
commit 77ec462536 upstream.
(The upstream patch was not marked as fixed but this can fix
Fixes: 28b1a824a4 ("arm64: vdso: Substitute gettimeofday() with C implementation")
sysbench memory comparison:
- Before: 3072.00 MB transferred (2601.11 MB/sec)
- After: 3072.00 MB transferred (3217.86 MB/sec)
)
We can avoid the expensive ISB instruction after reading the counter in
the vDSO gettime functions by creating a fake address hazard against a
dummy stack read, just like we do inside the kernel.
Bug: 195968646
Fixes: 28b1a824a4 ("arm64: vdso: Substitute gettimeofday() with C implementation")
Signed-off-by: Will Deacon <will@kernel.org>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Link: https://lore.kernel.org/r/20210318170738.7756-5-will@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
CC: stable@vger.kernel.org
(cherry picked from commit 77ec462536)
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Change-Id: I891873626c27060e7ead724754096a7c5f59e4e6