Revert "Synchronize codes for OnePlus 8T Oxygen OS 11.0.8.11.KB05AA and OnePlus 8 Oxygen OS 11.0.5.5.IN21AA and OnePlus 8 Pro Oxygen OS 11.0.5.5.IN11AA"

This reverts commit d9a92ce977.

Reason for revert: <INSERT REASONING HERE>

OP9R kernel code seprate from OP8 kernel code

Change-Id: Ic8cdd1a0d6dffb0a574d92ea1f0b5aeb976deb50
This commit is contained in:
yu huang 2021-04-20 23:56:58 +08:00
parent d9a92ce977
commit 131c68be22
95 changed files with 1455 additions and 1995 deletions

View File

@ -100,7 +100,6 @@ config ARM64
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
select GENERIC_TIME_VSYSCALL
select GENERIC_GETTIMEOFDAY
select HANDLE_DOMAIN_IRQ
select HARDIRQS_SW_RESEND
select HAVE_ACPI_APEI if (ACPI && EFI)
@ -139,8 +138,6 @@ config ARM64
select HAVE_GENERIC_DMA_COHERENT
select HAVE_HW_BREAKPOINT if PERF_EVENTS
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZ4
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP if NUMA
select HAVE_NMI
@ -155,7 +152,6 @@ config ARM64
select HAVE_SYSCALL_TRACEPOINTS
select HAVE_KPROBES
select HAVE_KRETPROBES
select HAVE_GENERIC_VDSO
select IOMMU_DMA if IOMMU_SUPPORT
select IRQ_DOMAIN
select IRQ_FORCED_THREADING
@ -547,22 +543,6 @@ config ARM64_ERRATUM_1542418
If unsure, say Y.
config ARM64_ERRATUM_1542419
bool "Neoverse-N1: workaround mis-ordering of instruction fetches"
default y
help
This option adds a workaround for ARM Neoverse-N1 erratum
1542419.
Affected Neoverse-N1 cores could execute a stale instruction when
modified by another CPU. The workaround depends on a firmware
counterpart.
Workaround the issue by hiding the DIC feature from EL0. This
forces user-space to perform cache maintenance.
If unsure, say Y.
config CAVIUM_ERRATUM_22375
bool "Cavium erratum 22375, 24313"
default y
@ -823,7 +803,7 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE
# a multiplatform kernel, we just want the highest value required by the
# selected platforms.
config ARCH_NR_GPIO
int "Number of GPIOs in the system"
int
default 1280 if ARCH_QCOM
default 256
help
@ -943,37 +923,6 @@ config ARCH_MEMORY_PROBE
config CC_HAVE_SHADOW_CALL_STACK
def_bool $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18)
config ARM64_DMA_USE_IOMMU
bool "ARM64 DMA iommu integration"
select ARM_HAS_SG_CHAIN
select NEED_SG_DMA_LENGTH
help
Enable using iommu through the standard dma apis.
dma_alloc_coherent() will allocate scatter-gather memory
which is made virtually contiguous via iommu.
Enable if system contains IOMMU hardware.
if ARM64_DMA_USE_IOMMU
config ARM64_DMA_IOMMU_ALIGNMENT
int "Maximum PAGE_SIZE order of alignment for DMA IOMMU buffers"
range 4 9
default 9
help
DMA mapping framework by default aligns all buffers to the smallest
PAGE_SIZE order which is greater than or equal to the requested buffer
size. This works well for buffers up to a few hundreds kilobytes, but
for larger buffers it just a waste of address space. Drivers which has
relatively small addressing window (like 64Mib) might run out of
virtual space with just a few allocations.
With this parameter you can specify the maximum PAGE_SIZE order for
DMA IOMMU buffers. Larger buffers will be aligned only to this
specified order. The order is expressed as a power of two multiplied
by the PAGE_SIZE.
endif
config SECCOMP
bool "Enable seccomp to safely compute untrusted bytecode"
---help---
@ -1139,19 +1088,6 @@ config ARM64_TAGGED_ADDR_ABI
to system calls as pointer arguments. For details, see
Documentation/arm64/tagged-address-abi.rst.
config COMPAT_VDSO
bool "Enable vDSO for 32-bit applications"
depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != ""
select GENERIC_COMPAT_VDSO
default y
help
Place in the process address space of 32-bit applications an
ELF shared object providing fast implementations of gettimeofday
and clock_gettime.
You must have a 32-bit build of glibc 2.22 or later for programs
to seamlessly take advantage of this.
menuconfig ARMV8_DEPRECATED
bool "Emulate deprecated/obsolete ARMv8 instructions"
depends on COMPAT
@ -1604,34 +1540,6 @@ config COMPAT
If you want to execute 32-bit userspace applications, say Y.
config KUSER_HELPERS
bool "Enable kuser helpers page for 32 bit applications."
depends on COMPAT
default y
help
Warning: disabling this option may break 32-bit user programs.
Provide kuser helpers to compat tasks. The kernel provides
helper code to userspace in read only form at a fixed location
to allow userspace to be independent of the CPU type fitted to
the system. This permits binaries to be run on ARMv4 through
to ARMv8 without modification.
See Documentation/arm/kernel_user_helpers.txt for details.
However, the fixed address nature of these helpers can be used
by ROP (return orientated programming) authors when creating
exploits.
If all of the binaries and libraries which run on your platform
are built specifically for your platform, and make no use of
these helpers, then you can turn this option off to hinder
such exploits. However, in that case, if a binary or library
relying on those helpers is run, it will not function correctly.
Say N here only if you are absolutely certain that you do not
need these helpers; otherwise, the safe option is to say Y.
config SYSVIPC_COMPAT
def_bool y
depends on COMPAT && SYSVIPC

View File

@ -54,10 +54,10 @@ KBUILD_CFLAGS += -mno-implicit-float
else
KBUILD_CFLAGS += -mgeneral-regs-only
endif
KBUILD_CFLAGS += $(lseinstr) $(brokengasinst) $(compat_vdso)
KBUILD_CFLAGS += $(lseinstr) $(brokengasinst)
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_CFLAGS += $(call cc-disable-warning, psabi)
KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) $(compat_vdso)
KBUILD_AFLAGS += $(lseinstr) $(brokengasinst)
KBUILD_CFLAGS += $(call cc-option,-mabi=lp64)
KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)
@ -199,9 +199,6 @@ ifeq ($(KBUILD_EXTMOD),)
prepare: vdso_prepare
vdso_prepare: prepare0
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h
$(if $(CONFIG_COMPAT_VDSO),$(Q)$(MAKE) \
$(build)=arch/arm64/kernel/vdso32 \
include/generated/vdso32-offsets.h)
endif
define archhelp

View File

@ -101,6 +101,7 @@
};
};
/* @bsp, Battery & Charging config STRAT */
&qupv3_se16_i2c {
oneplus_fastchg@26{
op,4320mAh_4p45_support;
@ -200,8 +201,9 @@
&kona_mtp_batterydata {
#include "OP-fg-batterydata-4320mah.dtsi"
};
/* @bsp, Battery & Charging config EDN */
/* @bsp, 2019/09/24 usb config START*/
&usb2_phy0 {
qcom,param-override-seq =
<0x67 0x6c/*Disconnection voltage +21.56%*/
@ -360,3 +362,4 @@
status = "disabled";
};
};
/* @bsp, 2019/09/24 usb config END*/

View File

@ -1,4 +1,5 @@
/*this is for different project dtsi*/
/* @bsp, 2019/09/10 Wireless Charging porting STRAT */
&op_wlchg {
status = "okay";
op,max-voltage-mv = <4550>;
@ -103,6 +104,7 @@
otg_en-gpio = <&pm8150l_gpios 4 0x00>;
vbus-gpio = <&tlmm 172 0x00>;
};
/* @bsp, 2019/09/10 Wireless Charging porting END */
&qupv3_se13_i2c {
status = "ok";
sec-s6sy761@48 {
@ -121,6 +123,7 @@
};
};
/* @bsp, Battery & Charging config STRAT */
&qupv3_se16_i2c {
oneplus_fastchg@26{
op,4510mAh_4p45_support;
@ -220,7 +223,9 @@
&kona_mtp_batterydata {
#include "OP-fg-batterydata-4510mah.dtsi"
};
/* @bsp, Battery & Charging config END */
/* @bsp, 2019/10/08 usb config START*/
&usb2_phy0 {
qcom,param-override-seq =
<0x67 0x6c/*Disconnection voltage +21.56%*/
@ -381,3 +386,4 @@
status = "disabled";
};
};
/* @bsp, 2019/10/08 usb config END*/

View File

@ -1,6 +1,7 @@
/*this is for different project dtsi*/
#include "instantnoodle.dtsi"
#include "kona-thermal.dtsi"
/* @bsp, Battery & Charging config STRAT */
&qupv3_se16_i2c {
oneplus_fastchg@26{
op,4300mAh_4p45_support;
@ -101,6 +102,7 @@
&kona_mtp_batterydata {
#include "OP-fg-batterydata-4300mah.dtsi"
};
/* @bsp, Battery & Charging config STRAT */
/delete-node/ &skin_therm_19821;
/delete-node/ &msm_therm_19821;

View File

@ -769,6 +769,7 @@
};
};
/* @bsp, 2019/07/08 Battery & Charging porting STRAT */
&qupv3_se16_i2c {
qcom,clk-freq-out = <100000>;
status = "ok";
@ -1261,6 +1262,7 @@
};
};
};
/* @bsp, 2019/07/08 Battery & Charging porting END */
&spmi_bus {
qcom,pm8150@0 {
@ -1315,7 +1317,10 @@
qca,bt-vdd-rfa1-voltage-level = <1900000 2040000>;
};
/* @bsp, usb config START */
/* @bsp, As QRD-DVT have this config, keep the same config
* for ldo18 power suspend
*/
&usb_qmp_dp_phy {
vdd-supply = <&pm8150_l18>;
qcom,vdd-voltage-level = <0 912000 912000>;
@ -1330,6 +1335,7 @@
};
};
};
/* @bsp, usb config END */
&wdog{
qcom,bark-time = <15000>;

View File

@ -203,6 +203,7 @@
};
};
};
/* @bsp, Battery & Charging config STRAT */
&qupv3_se16_i2c {
oneplus_fastchg@0a{
op,swarp_supported;
@ -313,7 +314,9 @@
&kona_mtp_batterydata {
#include "OP-fg-batterydata-4500mah.dtsi"
};
/* @bsp, Battery & Charging config EDN */
/* @bsp, 2019/09/24 usb config START*/
&usb2_phy0 {
qcom,param-override-seq =
<0x67 0x6c/*Disconnection voltage +21.56%*/
@ -477,3 +480,4 @@
status = "disabled";
};
};
/* @bsp, 2019/09/24 usb config END*/

View File

@ -769,6 +769,7 @@
};
};
/* @bsp, 2019/07/08 Battery & Charging porting STRAT */
&qupv3_se16_i2c {
qcom,clk-freq-out = <100000>;
status = "ok";
@ -1261,6 +1262,7 @@
};
};
};
/* @bsp, 2019/07/08 Battery & Charging porting END */
&spmi_bus {
qcom,pm8150@0 {
@ -1315,6 +1317,10 @@
qca,bt-vdd-rfa1-voltage-level = <1900000 2040000>;
};
/* @bsp, usb config START */
/* @bsp, As QRD-DVT have this config, keep the same config
* for ldo18 power suspend
*/
&usb_qmp_dp_phy {
vdd-supply = <&pm8150_l18>;
qcom,vdd-voltage-level = <0 912000 912000>;
@ -1329,6 +1335,7 @@
};
};
};
/* @bsp, usb config END */
&wdog{
qcom,bark-time = <15000>;

View File

@ -203,6 +203,7 @@
};
};
};
/* @bsp, Battery & Charging config STRAT */
&qupv3_se16_i2c {
oneplus_fastchg@0a{
op,swarp_supported;
@ -229,7 +230,7 @@
pd-temp-ibatmax = <0 500 2000 2000 3000 3000 600 0>;
pd-temp-ibatmax_thr_ma = <0 500 1000 1000 1500 1500 600 0>;
/* vbatmax setting for different temp regions */
vbatmax-little-cold-mv = <3950>;
vbatmax-little-cold-mv = <3980>;
vbatmax-cool-mv = <4435>;
vbatmax-little-cool-mv = <4435>;
vbatmax-pre-normal-mv = <4435>;
@ -313,7 +314,9 @@
&kona_mtp_batterydata {
#include "OP-fg-batterydata-4500mah.dtsi"
};
/* @bsp, Battery & Charging config EDN */
/* @bsp, 2019/09/24 usb config START*/
&usb2_phy0 {
qcom,param-override-seq =
<0x67 0x6c/*Disconnection voltage +21.56%*/
@ -477,3 +480,4 @@
status = "disabled";
};
};
/* @bsp, 2019/09/24 usb config END*/

View File

@ -133,6 +133,7 @@
};
};
//#ifdef VENDOR_EDIT /* Jianchao.Shi@BSP.CHG.Basic, 2018/04/05, sjc Add for charging */
qupv3_se2_i2c_pulldown: qupv3_se2_i2c_pulldown {
mux {
pins = "gpio45", "gpio46";
@ -160,6 +161,7 @@
input-enable;
};
};
//#endif
charging_switch1_active: charging_switch1_active {
mux {
@ -465,9 +467,11 @@
&qupv3_se2_i2c {
status = "ok";
qcom,clk-freq-out = <100000>;
//#ifdef VENDOR_EDIT /* Jianchao.Shi@PSW.BSP.CHG.Basic, 2018/04/05, sjc Add for charging */
pinctrl-names = "default", "sleep", "pulldown", "pullup";
pinctrl-2 = <&qupv3_se2_i2c_pulldown>;
pinctrl-3 = <&qupv3_se2_i2c_pullup>;
//#endif //VENDOR_EDIT
/*
oplus_short-ic@58 {
status = "okay";

View File

@ -2,7 +2,6 @@ CONFIG_AUDIT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT=y
CONFIG_IRQ_TIME_ACCOUNTING=y
CONFIG_TASKSTATS=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
@ -10,18 +9,17 @@ CONFIG_PSI=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_IKHEADERS=y
CONFIG_CGROUPS=y
CONFIG_MEMCG=y
CONFIG_MEMCG_SWAP=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_SCHED=y
# CONFIG_FAIR_GROUP_SCHED is not set
CONFIG_CGROUP_FREEZER=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_BPF=y
CONFIG_NAMESPACES=y
# CONFIG_UTS_NS is not set
# CONFIG_PID_NS is not set
CONFIG_SCHED_AUTOGROUP=y
CONFIG_SCHED_TUNE=y
CONFIG_BLK_DEV_INITRD=y
# CONFIG_RD_BZIP2 is not set
@ -50,7 +48,6 @@ CONFIG_SCHED_MC=y
CONFIG_NR_CPUS=32
CONFIG_SECCOMP=y
CONFIG_PARAVIRT=y
# CONFIG_ARM64_TAGGED_ADDR_ABI is not set
CONFIG_ARMV8_DEPRECATED=y
CONFIG_SWP_EMULATION=y
CONFIG_CP15_BARRIER_EMULATION=y
@ -66,7 +63,6 @@ CONFIG_ENERGY_MODEL=y
CONFIG_CPU_IDLE=y
CONFIG_ARM_CPUIDLE=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_TIMES=y
CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
@ -97,7 +93,6 @@ CONFIG_CLEANCACHE=y
CONFIG_CMA=y
CONFIG_CMA_AREAS=16
CONFIG_ZSMALLOC=y
CONFIG_MM_EVENT_STAT=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
@ -110,9 +105,7 @@ CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IPGRE=y
CONFIG_NET_IPVTI=y
CONFIG_INET_ESP=y
CONFIG_INET_UDP_DIAG=y
@ -124,9 +117,7 @@ CONFIG_INET6_ESP=y
CONFIG_INET6_IPCOMP=y
CONFIG_IPV6_MIP6=y
CONFIG_IPV6_VTI=y
CONFIG_IPV6_GRE=y
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_NETFILTER=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_SECMARK=y
@ -199,7 +190,6 @@ CONFIG_IP6_NF_MANGLE=y
CONFIG_IP6_NF_RAW=y
CONFIG_TIPC=y
CONFIG_L2TP=y
CONFIG_BRIDGE=y
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_HTB=y
CONFIG_NET_SCH_INGRESS=y
@ -216,8 +206,6 @@ CONFIG_CFG80211=y
CONFIG_MAC80211=y
CONFIG_RFKILL=y
# CONFIG_UEVENT_HELPER is not set
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
# CONFIG_FW_CACHE is not set
# CONFIG_ALLOW_DEV_COREDUMP is not set
CONFIG_DMA_CMA=y
@ -230,9 +218,8 @@ CONFIG_UID_SYS_STATS=y
CONFIG_SCSI=y
# CONFIG_SCSI_PROC_FS is not set
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_SG=y
CONFIG_SCSI_UFSHCD=m
CONFIG_SCSI_UFSHCD_PLATFORM=m
CONFIG_SCSI_UFSHCD=y
CONFIG_SCSI_UFSHCD_PLATFORM=y
CONFIG_SCSI_UFS_CRYPTO=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
@ -247,7 +234,6 @@ CONFIG_DM_BOW=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
CONFIG_TUN=y
CONFIG_VETH=y
# CONFIG_ETHERNET is not set
CONFIG_PHYLIB=y
CONFIG_PPP=y
@ -299,39 +285,31 @@ CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_MSM_GENI_EARLY_CONSOLE=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_CAVIUM is not set
# CONFIG_DEVPORT is not set
# CONFIG_I2C_COMPAT is not set
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_HELPER_AUTO is not set
CONFIG_SPI=y
CONFIG_SPMI=y
# CONFIG_SPMI_MSM_PMIC_ARB is not set
CONFIG_PINCTRL_AMD=y
CONFIG_GPIO_SYSFS=y
CONFIG_POWER_AVS=y
CONFIG_POWER_RESET_HISI=y
# CONFIG_HWMON is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_STATISTICS=y
CONFIG_THERMAL_WRITABLE_TRIPS=y
CONFIG_THERMAL_GOV_USER_SPACE=y
CONFIG_CPU_THERMAL=y
CONFIG_DEVFREQ_THERMAL=y
CONFIG_THERMAL_EMULATION=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
CONFIG_MFD_ACT8945A=y
CONFIG_MFD_SYSCON=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_PROXY_CONSUMER=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_CONTROLLER=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
# CONFIG_VGA_ARB is not set
CONFIG_DRM=y
# CONFIG_DRM_FBDEV_EMULATION is not set
@ -344,6 +322,7 @@ CONFIG_SND=y
CONFIG_SND_HRTIMER=y
CONFIG_SND_DYNAMIC_MINORS=y
# CONFIG_SND_SUPPORT_OLD_API is not set
# CONFIG_SND_VERBOSE_PROCFS is not set
# CONFIG_SND_DRIVERS is not set
CONFIG_SND_USB_AUDIO=y
CONFIG_SND_SOC=y
@ -359,7 +338,6 @@ CONFIG_HID_SONY=y
CONFIG_HID_STEAM=y
CONFIG_USB_HIDDEV=y
CONFIG_USB_OTG=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_GADGET=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_UEVENT=y
@ -372,15 +350,14 @@ CONFIG_TYPEC=y
CONFIG_MMC=y
# CONFIG_PWRSEQ_EMMC is not set
# CONFIG_PWRSEQ_SIMPLE is not set
CONFIG_MMC_CRYPTO=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TRANSIENT=y
CONFIG_EDAC=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_SYSTOHC is not set
CONFIG_RTC_DRV_PL030=y
CONFIG_RTC_DRV_PL031=y
CONFIG_DMADEVICES=y
@ -392,14 +369,12 @@ CONFIG_COMMON_CLK_SCPI=y
# CONFIG_COMMON_CLK_XGENE is not set
CONFIG_HWSPINLOCK=y
CONFIG_MAILBOX=y
CONFIG_IOMMU_IO_PGTABLE_FAST=y
CONFIG_ARM_SMMU=m
CONFIG_REMOTEPROC=y
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
CONFIG_ARM_SMMU=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
CONFIG_DEVFREQ_GOV_POWERSAVE=y
CONFIG_DEVFREQ_GOV_USERSPACE=y
CONFIG_DEVFREQ_GOV_PASSIVE=y
CONFIG_EXTCON=y
CONFIG_IIO=y
CONFIG_PWM=y
CONFIG_QCOM_PDC=y
@ -487,8 +462,6 @@ CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
CONFIG_HARDENED_USERCOPY=y
CONFIG_FORTIFY_SOURCE=y
CONFIG_STATIC_USERMODEHELPER=y
CONFIG_SECURITY_SELINUX=y
CONFIG_INIT_STACK_ALL=y
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
@ -511,4 +484,5 @@ CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_PANIC_TIMEOUT=5
CONFIG_SCHEDSTATS=y
# CONFIG_DEBUG_PREEMPT is not set
CONFIG_DEBUG_LIST=y
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_STM=y

View File

@ -282,8 +282,6 @@ CONFIG_MHI_NETDEV=y
CONFIG_MHI_UCI=y
CONFIG_MHI_SATELLITE=y
CONFIG_ZRAM=y
CONFIG_ZRAM_WRITEBACK=y
CONFIG_ZWB_HANDLE=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=16
CONFIG_BLK_DEV_RAM=y
@ -486,7 +484,6 @@ CONFIG_USB_ISP1760=y
CONFIG_USB_ISP1760_HOST_ROLE=y
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CP210X=y
CONFIG_USB_SERIAL_FTDI_SIO=y
CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_USB_LINK_LAYER_TEST=y
CONFIG_USB_REDRIVER_NB7VPQ904M=y
@ -734,7 +731,6 @@ CONFIG_IPC_LOGGING=y
CONFIG_DEBUG_ALIGN_RODATA=y
CONFIG_DEFRAG=y
CONFIG_FSC=y
CONFIG_OP_FREEZER=y
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y
@ -783,7 +779,6 @@ CONFIG_ONEPLUS_HEALTHINFO=y
CONFIG_CONTROL_CENTER=y
CONFIG_HOUSTON=y
CONFIG_UXCHAIN=y
CONFIG_UXCHAIN_V2=y
#CONFIG_WB_KERNEL_LOG is not set
CONFIG_GPIO_SWITCH=y
CONFIG_REGULATOR_DEMO=y
@ -796,4 +791,3 @@ CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60
CONFIG_HUNG_TASK_ENHANCE=y
CONFIG_TPD=y
CONFIG_TPP=y

View File

@ -296,8 +296,6 @@ CONFIG_MHI_NETDEV=y
CONFIG_MHI_UCI=y
CONFIG_MHI_SATELLITE=y
CONFIG_ZRAM=y
CONFIG_ZRAM_WRITEBACK=y
CONFIG_ZWB_HANDLE=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=16
CONFIG_BLK_DEV_RAM=y
@ -502,7 +500,6 @@ CONFIG_USB_ISP1760=y
CONFIG_USB_ISP1760_HOST_ROLE=y
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CP210X=y
CONFIG_USB_SERIAL_FTDI_SIO=y
CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_USB_LINK_LAYER_TEST=y
CONFIG_USB_REDRIVER_NB7VPQ904M=y
@ -759,6 +756,7 @@ CONFIG_CRYPTO_DEV_QCEDEV=y
CONFIG_XZ_DEC=y
CONFIG_PRINTK_TIME=y
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS=y
CONFIG_DEBUG_MODULE_LOAD_INFO=y
CONFIG_DEBUG_INFO=y
CONFIG_PAGE_OWNER=y
@ -816,7 +814,6 @@ CONFIG_PANIC_ON_DATA_CORRUPTION=y
CONFIG_ARM64_STRICT_BREAK_BEFORE_MAKE=y
CONFIG_DEFRAG=y
CONFIG_FSC=y
CONFIG_OP_FREEZER=y
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_SOURCE_ETM4X=y
@ -865,7 +862,6 @@ CONFIG_ONEPLUS_HEALTHINFO=y
CONFIG_CONTROL_CENTER=y
CONFIG_HOUSTON=y
CONFIG_UXCHAIN=y
CONFIG_UXCHAIN_V2=y
#CONFIG_WB_KERNEL_LOG is not set
CONFIG_GPIO_SWITCH=y
CONFIG_REGULATOR_DEMO=y
@ -878,4 +874,3 @@ CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=60
CONFIG_HUNG_TASK_ENHANCE=y
CONFIG_TPD=y
CONFIG_TPP=y

View File

@ -221,7 +221,7 @@ alternative_endif
.macro user_alt, label, oldinstr, newinstr, cond
9999: alternative_insn "\oldinstr", "\newinstr", \cond
_asm_extable 9999b, \label
_ASM_EXTABLE 9999b, \label
.endm
/*

View File

@ -22,7 +22,6 @@
#define CTR_L1IP_MASK 3
#define CTR_DMINLINE_SHIFT 16
#define CTR_IMINLINE_SHIFT 0
#define CTR_IMINLINE_MASK 0xf
#define CTR_ERG_SHIFT 20
#define CTR_CWG_SHIFT 24
#define CTR_CWG_MASK 15
@ -30,7 +29,7 @@
#define CTR_DIC_SHIFT 29
#define CTR_CACHE_MINLINE_MASK \
(0xf << CTR_DMINLINE_SHIFT | CTR_IMINLINE_MASK << CTR_IMINLINE_SHIFT)
(0xf << CTR_DMINLINE_SHIFT | 0xf << CTR_IMINLINE_SHIFT)
#define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)

View File

@ -2,6 +2,8 @@
#ifndef _ASM_CLOCKSOURCE_H
#define _ASM_CLOCKSOURCE_H
#include <asm/vdso/clocksource.h>
struct arch_clocksource_data {
bool vdso_direct; /* Usable for direct VDSO access? */
};
#endif

View File

@ -55,9 +55,6 @@
#define ARM64_SSBS 34
#define ARM64_WORKAROUND_1188873 35
#define ARM64_WORKAROUND_1542418 36
#define ARM64_WORKAROUND_1542419 37
/* kabi: reserve 38 - 62 for future cpu capabilities */
#define ARM64_NCAPS 62
#define ARM64_NCAPS 37
#endif /* __ASM_CPUCAPS_H */

View File

@ -85,7 +85,6 @@
#define ARM_CPU_PART_KRYO2XX_GOLD 0x800
#define ARM_CPU_PART_KRYO2XX_SILVER 0x801
#define ARM_CPU_PART_CORTEX_A77 0xD0D
#define ARM_CPU_PART_NEOVERSE_N1 0xD0C
#define APM_CPU_PART_POTENZA 0x000
@ -116,7 +115,6 @@
#define MIDR_KRYO4G MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, ARM_CPU_PART_KRYO4G)
#define MIDR_KRYO5S MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, ARM_CPU_PART_KRYO5S)
#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
#define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
#define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)

View File

@ -209,25 +209,11 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
({ \
set_thread_flag(TIF_32BIT); \
})
#ifdef CONFIG_COMPAT_VDSO
#define COMPAT_ARCH_DLINFO \
do { \
/* \
* Note that we use Elf64_Off instead of elf_addr_t because \
* elf_addr_t in compat is defined as Elf32_Addr and casting \
* current->mm->context.vdso to it triggers a cast warning of \
* cast from pointer to integer of different size. \
*/ \
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
(Elf64_Off)current->mm->context.vdso); \
} while (0)
#else
#define COMPAT_ARCH_DLINFO
#endif
extern int aarch32_setup_additional_pages(struct linux_binprm *bprm,
int uses_interp);
extern int aarch32_setup_vectors_page(struct linux_binprm *bprm,
int uses_interp);
#define compat_arch_setup_additional_pages \
aarch32_setup_additional_pages
aarch32_setup_vectors_page
#endif /* CONFIG_COMPAT */

View File

@ -21,7 +21,7 @@
#else /* __ASSEMBLER__ */
#ifdef CONFIG_LTO_CLANG
#define __LSE_PREAMBLE ".arch_extension lse\n"
#define __LSE_PREAMBLE ".arch armv8-a+lse\n"
#else
__asm__(".arch_extension lse");
#define __LSE_PREAMBLE

View File

@ -40,8 +40,6 @@
#include <linux/stddef.h>
#include <linux/string.h>
#include <vdso/processor.h>
#include <asm/alternative.h>
#include <asm/cpufeature.h>
#include <asm/hw_breakpoint.h>
@ -55,7 +53,7 @@
* TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area.
*/
#ifdef CONFIG_COMPAT
#if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS)
#ifdef CONFIG_ARM64_64K_PAGES
/*
* With CONFIG_ARM64_64K_PAGES enabled, the last page is occupied
* by the compat vectors page.
@ -232,6 +230,11 @@ extern void release_thread(struct task_struct *);
unsigned long get_wchan(struct task_struct *p);
static inline void cpu_relax(void)
{
asm volatile("yield" ::: "memory");
}
/* Thread switching */
extern struct task_struct *cpu_switch_to(struct task_struct *prev,
struct task_struct *next);

View File

@ -20,51 +20,7 @@
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
struct compat_sigcontext {
/* We always set these two fields to 0 */
compat_ulong_t trap_no;
compat_ulong_t error_code;
compat_ulong_t oldmask;
compat_ulong_t arm_r0;
compat_ulong_t arm_r1;
compat_ulong_t arm_r2;
compat_ulong_t arm_r3;
compat_ulong_t arm_r4;
compat_ulong_t arm_r5;
compat_ulong_t arm_r6;
compat_ulong_t arm_r7;
compat_ulong_t arm_r8;
compat_ulong_t arm_r9;
compat_ulong_t arm_r10;
compat_ulong_t arm_fp;
compat_ulong_t arm_ip;
compat_ulong_t arm_sp;
compat_ulong_t arm_lr;
compat_ulong_t arm_pc;
compat_ulong_t arm_cpsr;
compat_ulong_t fault_address;
};
struct compat_ucontext {
compat_ulong_t uc_flags;
compat_uptr_t uc_link;
compat_stack_t uc_stack;
struct compat_sigcontext uc_mcontext;
compat_sigset_t uc_sigmask;
int __unused[32 - (sizeof(compat_sigset_t) / sizeof(int))];
compat_ulong_t uc_regspace[128] __attribute__((__aligned__(8)));
};
struct compat_sigframe {
struct compat_ucontext uc;
compat_ulong_t retcode[2];
};
struct compat_rt_sigframe {
struct compat_siginfo info;
struct compat_sigframe sig;
};
#define AARCH32_KERN_SIGRET_CODE_OFFSET 0x500
int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
struct pt_regs *regs);

View File

@ -71,12 +71,6 @@ extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
extern void (*__smp_cross_call)(const struct cpumask *, unsigned int);
/*
* Provide a function to set a callback function pointer for updating the ipi
* history.
*/
extern void set_update_ipi_history_callback(void (*fn)(int));
/*
* Called from the secondary holding pen, this is the secondary CPU entry point.
*/

View File

@ -33,13 +33,8 @@
#define __NR_compat_exit 1
#define __NR_compat_read 3
#define __NR_compat_write 4
#define __NR_compat_gettimeofday 78
#define __NR_compat_sigreturn 119
#define __NR_compat_rt_sigreturn 173
#define __NR_compat_clock_gettime 263
#define __NR_compat_clock_getres 264
#define __NR_compat_clock_gettime64 403
#define __NR_compat_clock_getres_time64 406
/*
* The following SVCs are ARM private.

View File

@ -28,9 +28,6 @@
#ifndef __ASSEMBLY__
#include <generated/vdso-offsets.h>
#ifdef CONFIG_COMPAT_VDSO
#include <generated/vdso32-offsets.h>
#endif
#define VDSO_SYMBOL(base, name) \
({ \

View File

@ -1,9 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_VDSOCLOCKSOURCE_H
#define __ASM_VDSOCLOCKSOURCE_H
struct arch_clocksource_data {
bool vdso_direct; /* Usable for direct VDSO access? */
};
#endif

View File

@ -1,51 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2018 ARM Limited
*/
#ifndef __COMPAT_BARRIER_H
#define __COMPAT_BARRIER_H
#ifndef __ASSEMBLY__
/*
* Warning: This code is meant to be used with
* ENABLE_COMPAT_VDSO only.
*/
#ifndef ENABLE_COMPAT_VDSO
#error This header is meant to be used with ENABLE_COMPAT_VDSO only
#endif
#ifdef dmb
#undef dmb
#endif
#if __LINUX_ARM_ARCH__ >= 7
#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
#elif __LINUX_ARM_ARCH__ == 6
#define dmb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
: : "r" (0) : "memory")
#else
#define dmb(x) __asm__ __volatile__ ("" : : : "memory")
#endif
#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD)
#define aarch32_smp_mb() dmb(ish)
#define aarch32_smp_rmb() dmb(ishld)
#define aarch32_smp_wmb() dmb(ishst)
#else
#define aarch32_smp_mb() dmb(ish)
#define aarch32_smp_rmb() aarch32_smp_mb()
#define aarch32_smp_wmb() dmb(ishst)
#endif
#undef smp_mb
#undef smp_rmb
#undef smp_wmb
#define smp_mb() aarch32_smp_mb()
#define smp_rmb() aarch32_smp_rmb()
#define smp_wmb() aarch32_smp_wmb()
#endif /* !__ASSEMBLY__ */
#endif /* __COMPAT_BARRIER_H */

View File

@ -1,124 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2018 ARM Limited
*/
#ifndef __ASM_VDSO_GETTIMEOFDAY_H
#define __ASM_VDSO_GETTIMEOFDAY_H
#ifndef __ASSEMBLY__
#include <asm/unistd.h>
#include <asm/errno.h>
#include <asm/vdso/compat_barrier.h>
#define __VDSO_USE_SYSCALL ULLONG_MAX
#define VDSO_HAS_CLOCK_GETRES 1
#define BUILD_VDSO32 1
static __always_inline
int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
struct timezone *_tz)
{
register struct timezone *tz asm("r1") = _tz;
register struct __kernel_old_timeval *tv asm("r0") = _tv;
register long ret asm ("r0");
register long nr asm("r7") = __NR_compat_gettimeofday;
asm volatile(
" swi #0\n"
: "=r" (ret)
: "r" (tv), "r" (tz), "r" (nr)
: "memory");
return ret;
}
static __always_inline
long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
register struct __kernel_timespec *ts asm("r1") = _ts;
register clockid_t clkid asm("r0") = _clkid;
register long ret asm ("r0");
register long nr asm("r7") = __NR_compat_clock_gettime;
asm volatile(
" swi #0\n"
: "=r" (ret)
: "r" (clkid), "r" (ts), "r" (nr)
: "memory");
return ret;
}
static __always_inline
int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
register struct __kernel_timespec *ts asm("r1") = _ts;
register clockid_t clkid asm("r0") = _clkid;
register long ret asm ("r0");
register long nr asm("r7") = __NR_compat_clock_getres;
asm volatile(
" swi #0\n"
: "=r" (ret)
: "r" (clkid), "r" (ts), "r" (nr)
: "memory");
return ret;
}
static __always_inline u64 __arch_get_hw_counter(s32 clock_mode)
{
u64 res;
/*
* clock_mode == 0 implies that vDSO are enabled otherwise
* fallback on syscall.
*/
if (clock_mode)
return __VDSO_USE_SYSCALL;
/*
* This isb() is required to prevent that the counter value
* is speculated.
*/
isb();
asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (res));
/*
* This isb() is required to prevent that the seq lock is
* speculated.
*/
isb();
return res;
}
static __always_inline const struct vdso_data *__arch_get_vdso_data(void)
{
const struct vdso_data *ret;
/*
* This simply puts &_vdso_data into ret. The reason why we don't use
* `ret = _vdso_data` is that the compiler tends to optimise this in a
* very suboptimal way: instead of keeping &_vdso_data in a register,
* it goes through a relocation almost every time _vdso_data must be
* accessed (even in subfunctions). This is both time and space
* consuming: each relocation uses a word in the code section, and it
* has to be loaded at runtime.
*
* This trick hides the assignment from the compiler. Since it cannot
* track where the pointer comes from, it will only use one relocation
* where __arch_get_vdso_data() is called, and then keep the result in
* a register.
*/
asm volatile("mov %0, %1" : "=r"(ret) : "r"(_vdso_data));
return ret;
}
#endif /* !__ASSEMBLY__ */
#endif /* __ASM_VDSO_GETTIMEOFDAY_H */

View File

@ -1,102 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2018 ARM Limited
*/
#ifndef __ASM_VDSO_GETTIMEOFDAY_H
#define __ASM_VDSO_GETTIMEOFDAY_H
#ifndef __ASSEMBLY__
#include <asm/unistd.h>
#define __VDSO_USE_SYSCALL ULLONG_MAX
#define VDSO_HAS_CLOCK_GETRES 1
static __always_inline
int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
struct timezone *_tz)
{
register struct timezone *tz asm("x1") = _tz;
register struct __kernel_old_timeval *tv asm("x0") = _tv;
register long ret asm ("x0");
register long nr asm("x8") = __NR_gettimeofday;
asm volatile(
" svc #0\n"
: "=r" (ret)
: "r" (tv), "r" (tz), "r" (nr)
: "memory");
return ret;
}
static __always_inline
long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
register struct __kernel_timespec *ts asm("x1") = _ts;
register clockid_t clkid asm("x0") = _clkid;
register long ret asm ("x0");
register long nr asm("x8") = __NR_clock_gettime;
asm volatile(
" svc #0\n"
: "=r" (ret)
: "r" (clkid), "r" (ts), "r" (nr)
: "memory");
return ret;
}
static __always_inline
int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
{
register struct __kernel_timespec *ts asm("x1") = _ts;
register clockid_t clkid asm("x0") = _clkid;
register long ret asm ("x0");
register long nr asm("x8") = __NR_clock_getres;
asm volatile(
" svc #0\n"
: "=r" (ret)
: "r" (clkid), "r" (ts), "r" (nr)
: "memory");
return ret;
}
static __always_inline u64 __arch_get_hw_counter(s32 clock_mode)
{
u64 res;
/*
* clock_mode == 0 implies that vDSO are enabled otherwise
* fallback on syscall.
*/
if (clock_mode)
return __VDSO_USE_SYSCALL;
/*
* This isb() is required to prevent that the counter value
* is speculated.
*/
isb();
asm volatile("mrs %0, cntvct_el0" : "=r" (res) :: "memory");
/*
* This isb() is required to prevent that the seq lock is
* speculated.#
*/
isb();
return res;
}
static __always_inline
const struct vdso_data *__arch_get_vdso_data(void)
{
return _vdso_data;
}
#endif /* !__ASSEMBLY__ */
#endif /* __ASM_VDSO_GETTIMEOFDAY_H */

View File

@ -1,17 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2020 ARM Ltd.
*/
#ifndef __ASM_VDSO_PROCESSOR_H
#define __ASM_VDSO_PROCESSOR_H
#ifndef __ASSEMBLY__
static inline void cpu_relax(void)
{
asm volatile("yield" ::: "memory");
}
#endif /* __ASSEMBLY__ */
#endif /* __ASM_VDSO_PROCESSOR_H */

View File

@ -1,53 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_VDSO_VSYSCALL_H
#define __ASM_VDSO_VSYSCALL_H
#ifndef __ASSEMBLY__
#include <linux/timekeeper_internal.h>
#include <vdso/datapage.h>
#define VDSO_PRECISION_MASK ~(0xFF00ULL<<48)
extern struct vdso_data *vdso_data;
/*
* Update the vDSO data page to keep in sync with kernel timekeeping.
*/
static __always_inline
struct vdso_data *__arm64_get_k_vdso_data(void)
{
return vdso_data;
}
#define __arch_get_k_vdso_data __arm64_get_k_vdso_data
static __always_inline
int __arm64_get_clock_mode(struct timekeeper *tk)
{
u32 use_syscall = !tk->tkr_mono.clock->archdata.vdso_direct;
return use_syscall;
}
#define __arch_get_clock_mode __arm64_get_clock_mode
static __always_inline
int __arm64_use_vsyscall(struct vdso_data *vdata)
{
return !vdata[CS_HRES_COARSE].clock_mode;
}
#define __arch_use_vsyscall __arm64_use_vsyscall
static __always_inline
void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
{
vdata[CS_HRES_COARSE].mask = VDSO_PRECISION_MASK;
vdata[CS_RAW].mask = VDSO_PRECISION_MASK;
}
#define __arch_update_vsyscall __arm64_update_vsyscall
/* The asm-generic header needs to be included after the definitions above */
#include <asm-generic/vdso/vsyscall.h>
#endif /* !__ASSEMBLY__ */
#endif /* __ASM_VDSO_VSYSCALL_H */

View File

@ -22,6 +22,6 @@
#include <linux/types.h>
#define COMMAND_LINE_SIZE 4096
#define COMMAND_LINE_SIZE 3072
#endif

View File

@ -27,12 +27,8 @@ OBJCOPYFLAGS := --prefix-symbols=__efistub_
$(obj)/%.stub.o: $(obj)/%.o FORCE
$(call if_changed,objcopy)
arm64-obj-$(CONFIG_COMPAT) += sys32.o signal32.o \
arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \
sys_compat.o
ifneq ($(CONFIG_COMPAT_VDSO), y)
arm64-obj-$(CONFIG_COMPAT) += sigreturn32.o
endif
arm64-obj-$(CONFIG_KUSER_HELPERS) += kuser32.o
arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o
arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o
@ -66,7 +62,6 @@ arm64-obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o
obj-y += $(arm64-obj-y) vdso/ probes/
obj-m += $(arm64-obj-m)
obj-$(CONFIG_COMPAT_VDSO) += vdso32/
head-y := head.o
extra-y += $(head-y) vmlinux.lds

View File

@ -89,13 +89,6 @@ extern long long __lshrti3(long long a, int b);
EXPORT_SYMBOL(__lshrti3);
/* caching functions */
EXPORT_SYMBOL_GPL(__dma_inv_area);
EXPORT_SYMBOL_GPL(__dma_clean_area);
EXPORT_SYMBOL_GPL(__dma_flush_area);
EXPORT_SYMBOL_GPL(__flush_dcache_area);
EXPORT_SYMBOL_GPL(__bss_stop);
EXPORT_SYMBOL_GPL(__per_cpu_start);
EXPORT_SYMBOL_GPL(__per_cpu_end);
EXPORT_SYMBOL_GPL(_sdata);
EXPORT_SYMBOL_GPL(cpu_do_idle);
EXPORT_SYMBOL(__dma_inv_area);
EXPORT_SYMBOL(__dma_clean_area);
EXPORT_SYMBOL(__dma_flush_area);

View File

@ -604,7 +604,7 @@ static struct undef_hook setend_hooks[] = {
},
{
/* Thumb mode */
.instr_mask = 0xfffffff7,
.instr_mask = 0x0000fff7,
.instr_val = 0x0000b650,
.pstate_mask = (PSR_AA32_T_BIT | PSR_AA32_MODE_MASK),
.pstate_val = (PSR_AA32_T_BIT | PSR_AA32_MODE_USR),

View File

@ -25,14 +25,13 @@
#include <linux/kvm_host.h>
#include <linux/preempt.h>
#include <linux/suspend.h>
#include <vdso/datapage.h>
#include <asm/cpufeature.h>
#include <asm/fixmap.h>
#include <asm/thread_info.h>
#include <asm/memory.h>
#include <asm/signal32.h>
#include <asm/smp_plat.h>
#include <asm/suspend.h>
#include <asm/vdso_datapage.h>
#include <linux/kbuild.h>
#include <linux/arm-smccc.h>
@ -85,11 +84,6 @@ int main(void)
DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe));
DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
BLANK();
#ifdef CONFIG_COMPAT
DEFINE(COMPAT_SIGFRAME_REGS_OFFSET, offsetof(struct compat_sigframe, uc.uc_mcontext.arm_r0));
DEFINE(COMPAT_RT_SIGFRAME_REGS_OFFSET, offsetof(struct compat_rt_sigframe, sig.uc.uc_mcontext.arm_r0));
BLANK();
#endif
DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id.counter));
BLANK();
DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
@ -114,28 +108,22 @@ int main(void)
DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC);
DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
BLANK();
DEFINE(VDSO_SEQ, offsetof(struct vdso_data, seq));
DEFINE(VDSO_CLK_MODE, offsetof(struct vdso_data, clock_mode));
DEFINE(VDSO_CYCLE_LAST, offsetof(struct vdso_data, cycle_last));
DEFINE(VDSO_MASK, offsetof(struct vdso_data, mask));
DEFINE(VDSO_MULT, offsetof(struct vdso_data, mult));
DEFINE(VDSO_SHIFT, offsetof(struct vdso_data, shift));
DEFINE(VDSO_REALTIME_SEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME].sec));
DEFINE(VDSO_REALTIME_NSEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME].nsec));
DEFINE(VDSO_MONO_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC].sec));
DEFINE(VDSO_MONO_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC].nsec));
DEFINE(VDSO_MONO_RAW_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_RAW].sec));
DEFINE(VDSO_MONO_RAW_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_RAW].nsec));
DEFINE(VDSO_BOOTTIME_SEC, offsetof(struct vdso_data, basetime[CLOCK_BOOTTIME].sec));
DEFINE(VDSO_BOOTTIME_NSEC, offsetof(struct vdso_data, basetime[CLOCK_BOOTTIME].nsec));
DEFINE(VDSO_TAI_SEC, offsetof(struct vdso_data, basetime[CLOCK_TAI].sec));
DEFINE(VDSO_TAI_NSEC, offsetof(struct vdso_data, basetime[CLOCK_TAI].nsec));
DEFINE(VDSO_RT_COARSE_SEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME_COARSE].sec));
DEFINE(VDSO_RT_COARSE_NSEC, offsetof(struct vdso_data, basetime[CLOCK_REALTIME_COARSE].nsec));
DEFINE(VDSO_MONO_COARSE_SEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_COARSE].sec));
DEFINE(VDSO_MONO_COARSE_NSEC, offsetof(struct vdso_data, basetime[CLOCK_MONOTONIC_COARSE].nsec));
DEFINE(VDSO_CS_CYCLE_LAST, offsetof(struct vdso_data, cs_cycle_last));
DEFINE(VDSO_RAW_TIME_SEC, offsetof(struct vdso_data, raw_time_sec));
DEFINE(VDSO_RAW_TIME_NSEC, offsetof(struct vdso_data, raw_time_nsec));
DEFINE(VDSO_XTIME_CLK_SEC, offsetof(struct vdso_data, xtime_clock_sec));
DEFINE(VDSO_XTIME_CLK_NSEC, offsetof(struct vdso_data, xtime_clock_nsec));
DEFINE(VDSO_XTIME_CRS_SEC, offsetof(struct vdso_data, xtime_coarse_sec));
DEFINE(VDSO_XTIME_CRS_NSEC, offsetof(struct vdso_data, xtime_coarse_nsec));
DEFINE(VDSO_WTM_CLK_SEC, offsetof(struct vdso_data, wtm_clock_sec));
DEFINE(VDSO_WTM_CLK_NSEC, offsetof(struct vdso_data, wtm_clock_nsec));
DEFINE(VDSO_TB_SEQ_COUNT, offsetof(struct vdso_data, tb_seq_count));
DEFINE(VDSO_CS_MONO_MULT, offsetof(struct vdso_data, cs_mono_mult));
DEFINE(VDSO_CS_RAW_MULT, offsetof(struct vdso_data, cs_raw_mult));
DEFINE(VDSO_CS_SHIFT, offsetof(struct vdso_data, cs_shift));
DEFINE(VDSO_TZ_MINWEST, offsetof(struct vdso_data, tz_minuteswest));
DEFINE(VDSO_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime));
DEFINE(VDSO_USE_SYSCALL, offsetof(struct vdso_data, use_syscall));
BLANK();
DEFINE(TVAL_TV_SEC, offsetof(struct timeval, tv_sec));
DEFINE(TVAL_TV_USEC, offsetof(struct timeval, tv_usec));

View File

@ -656,18 +656,6 @@ static void run_workaround_1542418_asid_rollover(const struct arm64_cpu_capabili
}
#endif
static bool __maybe_unused
has_neoverse_n1_erratum_1542419(const struct arm64_cpu_capabilities *entry,
int scope)
{
u32 midr = read_cpuid_id();
bool has_dic = read_cpuid_cachetype() & BIT(CTR_DIC_SHIFT);
const struct midr_range range = MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1);
WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
return is_midr_in_range(midr, &range) && has_dic;
}
#ifdef CONFIG_HARDEN_EL2_VECTORS
static const struct midr_range arm64_harden_el2_vectors[] = {
@ -908,16 +896,6 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
ERRATA_MIDR_RANGE(MIDR_CORTEX_A77, 0, 0, 1, 0),
.cpu_enable = run_workaround_1542418_asid_rollover,
},
#endif
#ifdef CONFIG_ARM64_ERRATUM_1542419
{
/* we depend on the firmware portion for correctness */
.desc = "ARM erratum 1542419 (kernel portion)",
.capability = ARM64_WORKAROUND_1542419,
.type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
.matches = has_neoverse_n1_erratum_1542419,
.cpu_enable = cpu_enable_trap_ctr_access,
},
#endif
{
}

View File

@ -889,7 +889,8 @@ static bool has_cache_dic(const struct arm64_cpu_capabilities *entry,
}
static bool __meltdown_safe = true;
static int __kpti_forced; /* 0: not forced, >0: forced on, <0: forced off */
/* 0: not forced, >0: forced on, <0: forced off */
static int __kpti_forced = -1;
static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
int scope)

View File

@ -42,7 +42,6 @@ int arm_cpuidle_suspend(int index)
return cpu_ops[cpu]->cpu_suspend(index);
}
EXPORT_SYMBOL_GPL(arm_cpuidle_suspend);
#ifdef CONFIG_ACPI

View File

@ -674,7 +674,7 @@ ENTRY(__boot_cpu_mode)
* with MMU turned off.
*/
ENTRY(__early_cpu_boot_status)
.quad 0
.long 0
.popsection

View File

@ -1,14 +1,29 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* AArch32 user helpers.
* Low-level user helpers placed in the vectors page for AArch32.
* Based on the kuser helpers in arch/arm/kernel/entry-armv.S.
*
* Copyright (C) 2005-2011 Nicolas Pitre <nico@fluxnic.net>
* Copyright (C) 2012-2018 ARM Ltd.
* Copyright (C) 2012 ARM Ltd.
*
* The kuser helpers below are mapped at a fixed address by
* aarch32_setup_additional_pages() and are provided for compatibility
* reasons with 32 bit (aarch32) applications that need them.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* AArch32 user helpers.
*
* Each segment is 32-byte aligned and will be moved to the top of the high
* vector page. New segments (if ever needed) must be added in front of
* existing ones. This mechanism should be used only for things that are
* really small and justified, and not be abused freely.
*
* See Documentation/arm/kernel_user_helpers.txt for formal definitions.
*/
@ -62,3 +77,42 @@ __kuser_helper_version: // 0xffff0ffc
.word ((__kuser_helper_end - __kuser_helper_start) >> 5)
.globl __kuser_helper_end
__kuser_helper_end:
/*
* AArch32 sigreturn code
*
* For ARM syscalls, the syscall number has to be loaded into r7.
* We do not support an OABI userspace.
*
* For Thumb syscalls, we also pass the syscall number via r7. We therefore
* need two 16-bit instructions.
*/
.globl __aarch32_sigret_code_start
__aarch32_sigret_code_start:
/*
* ARM Code
*/
.byte __NR_compat_sigreturn, 0x70, 0xa0, 0xe3 // mov r7, #__NR_compat_sigreturn
.byte __NR_compat_sigreturn, 0x00, 0x00, 0xef // svc #__NR_compat_sigreturn
/*
* Thumb code
*/
.byte __NR_compat_sigreturn, 0x27 // svc #__NR_compat_sigreturn
.byte __NR_compat_sigreturn, 0xdf // mov r7, #__NR_compat_sigreturn
/*
* ARM code
*/
.byte __NR_compat_rt_sigreturn, 0x70, 0xa0, 0xe3 // mov r7, #__NR_compat_rt_sigreturn
.byte __NR_compat_rt_sigreturn, 0x00, 0x00, 0xef // svc #__NR_compat_rt_sigreturn
/*
* Thumb code
*/
.byte __NR_compat_rt_sigreturn, 0x27 // svc #__NR_compat_rt_sigreturn
.byte __NR_compat_rt_sigreturn, 0xdf // mov r7, #__NR_compat_rt_sigreturn
.globl __aarch32_sigret_code_end
__aarch32_sigret_code_end:

View File

@ -192,7 +192,6 @@ void machine_kexec(struct kimage *kimage)
* the offline CPUs. Therefore, we must use the __* variant here.
*/
__flush_icache_range((uintptr_t)reboot_code_buffer,
(uintptr_t)reboot_code_buffer +
arm64_relocate_new_kernel_size);
/* Flush the kimage list and its buffers. */

View File

@ -75,7 +75,6 @@ void (*pm_power_off)(void);
EXPORT_SYMBOL_GPL(pm_power_off);
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
EXPORT_SYMBOL_GPL(arm_pm_restart);
/*
* This is our default idle handler.

View File

@ -69,13 +69,11 @@ static struct resource *standard_resources;
phys_addr_t __fdt_pointer __initdata;
/* Vendor stub */
unsigned int boot_reason;
EXPORT_SYMBOL_GPL(boot_reason);
EXPORT_SYMBOL(boot_reason);
/* Vendor stub */
unsigned int cold_boot;
EXPORT_SYMBOL_GPL(cold_boot);
EXPORT_SYMBOL(cold_boot);
/*
* Standard memory resources

View File

@ -29,7 +29,42 @@
#include <asm/traps.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
#include <asm/vdso.h>
struct compat_sigcontext {
/* We always set these two fields to 0 */
compat_ulong_t trap_no;
compat_ulong_t error_code;
compat_ulong_t oldmask;
compat_ulong_t arm_r0;
compat_ulong_t arm_r1;
compat_ulong_t arm_r2;
compat_ulong_t arm_r3;
compat_ulong_t arm_r4;
compat_ulong_t arm_r5;
compat_ulong_t arm_r6;
compat_ulong_t arm_r7;
compat_ulong_t arm_r8;
compat_ulong_t arm_r9;
compat_ulong_t arm_r10;
compat_ulong_t arm_fp;
compat_ulong_t arm_ip;
compat_ulong_t arm_sp;
compat_ulong_t arm_lr;
compat_ulong_t arm_pc;
compat_ulong_t arm_cpsr;
compat_ulong_t fault_address;
};
struct compat_ucontext {
compat_ulong_t uc_flags;
compat_uptr_t uc_link;
compat_stack_t uc_stack;
struct compat_sigcontext uc_mcontext;
compat_sigset_t uc_sigmask;
int __unused[32 - (sizeof (compat_sigset_t) / sizeof (int))];
compat_ulong_t uc_regspace[128] __attribute__((__aligned__(8)));
};
struct compat_vfp_sigframe {
compat_ulong_t magic;
@ -57,6 +92,16 @@ struct compat_aux_sigframe {
unsigned long end_magic;
} __attribute__((__aligned__(8)));
struct compat_sigframe {
struct compat_ucontext uc;
compat_ulong_t retcode[2];
};
struct compat_rt_sigframe {
struct compat_siginfo info;
struct compat_sigframe sig;
};
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)
@ -353,38 +398,14 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
retcode = ptr_to_compat(ka->sa.sa_restorer);
} else {
/* Set up sigreturn pointer */
#ifdef CONFIG_COMPAT_VDSO
void *vdso_base = current->mm->context.vdso;
void *vdso_trampoline;
if (ka->sa.sa_flags & SA_SIGINFO) {
if (thumb) {
vdso_trampoline = VDSO_SYMBOL(vdso_base,
compat_rt_sigreturn_thumb);
} else {
vdso_trampoline = VDSO_SYMBOL(vdso_base,
compat_rt_sigreturn_arm);
}
} else {
if (thumb) {
vdso_trampoline = VDSO_SYMBOL(vdso_base,
compat_sigreturn_thumb);
} else {
vdso_trampoline = VDSO_SYMBOL(vdso_base,
compat_sigreturn_arm);
}
}
retcode = ptr_to_compat(vdso_trampoline) + thumb;
#else
unsigned int idx = thumb << 1;
if (ka->sa.sa_flags & SA_SIGINFO)
idx += 3;
retcode = (unsigned long)current->mm->context.vdso +
retcode = AARCH32_VECTORS_BASE +
AARCH32_KERN_SIGRET_CODE_OFFSET +
(idx << 2) + thumb;
#endif
}
regs->regs[0] = usig;

View File

@ -1,46 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* AArch32 sigreturn code.
* Based on the kuser helpers in arch/arm/kernel/entry-armv.S.
*
* Copyright (C) 2005-2011 Nicolas Pitre <nico@fluxnic.net>
* Copyright (C) 2012-2018 ARM Ltd.
*
* For ARM syscalls, the syscall number has to be loaded into r7.
* We do not support an OABI userspace.
*
* For Thumb syscalls, we also pass the syscall number via r7. We therefore
* need two 16-bit instructions.
*/
#include <asm/unistd.h>
.globl __aarch32_sigret_code_start
__aarch32_sigret_code_start:
/*
* ARM Code
*/
.byte __NR_compat_sigreturn, 0x70, 0xa0, 0xe3 // mov r7, #__NR_compat_sigreturn
.byte __NR_compat_sigreturn, 0x00, 0x00, 0xef // svc #__NR_compat_sigreturn
/*
* Thumb code
*/
.byte __NR_compat_sigreturn, 0x27 // svc #__NR_compat_sigreturn
.byte __NR_compat_sigreturn, 0xdf // mov r7, #__NR_compat_sigreturn
/*
* ARM code
*/
.byte __NR_compat_rt_sigreturn, 0x70, 0xa0, 0xe3 // mov r7, #__NR_compat_rt_sigreturn
.byte __NR_compat_rt_sigreturn, 0x00, 0x00, 0xef // svc #__NR_compat_rt_sigreturn
/*
* Thumb code
*/
.byte __NR_compat_rt_sigreturn, 0x27 // svc #__NR_compat_rt_sigreturn
.byte __NR_compat_rt_sigreturn, 0xdf // mov r7, #__NR_compat_rt_sigreturn
.globl __aarch32_sigret_code_end
__aarch32_sigret_code_end:

View File

@ -602,11 +602,8 @@ static void __init acpi_parse_and_init_cpus(void)
#define acpi_parse_and_init_cpus(...) do { } while (0)
#endif
void (*__smp_cross_call)(const struct cpumask *, unsigned int);
/* Dummy vendor field */
DEFINE_PER_CPU(bool, pending_ipi);
EXPORT_SYMBOL_GPL(pending_ipi);
static void (*__smp_update_ipi_history_cb)(int cpu);
/*
* Enumerate the possible CPU set from the device tree and build the
* cpu logical map array containing MPIDR values related to logical
@ -752,12 +749,6 @@ void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int))
__smp_cross_call = fn;
}
void set_update_ipi_history_callback(void (*fn)(int))
{
__smp_update_ipi_history_cb = fn;
}
EXPORT_SYMBOL_GPL(set_update_ipi_history_callback);
static const char *ipi_types[NR_IPI] __tracepoint_string = {
#define S(x,s) [x] = s
S(IPI_RESCHEDULE, "Rescheduling interrupts"),
@ -968,8 +959,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
void smp_send_reschedule(int cpu)
{
BUG_ON(cpu_is_offline(cpu));
if (__smp_update_ipi_history_cb)
__smp_update_ipi_history_cb(cpu);
update_ipi_history(cpu);
smp_cross_call_common(cpumask_of(cpu), IPI_RESCHEDULE);
}

View File

@ -19,7 +19,6 @@
*/
#include <linux/compat.h>
#include <linux/cpufeature.h>
#include <linux/personality.h>
#include <linux/sched.h>
#include <linux/sched/signal.h>
@ -29,7 +28,6 @@
#include <asm/cacheflush.h>
#include <asm/system_misc.h>
#include <asm/tlbflush.h>
#include <asm/unistd.h>
static long
@ -43,15 +41,6 @@ __do_compat_cache_op(unsigned long start, unsigned long end)
if (fatal_signal_pending(current))
return 0;
if (cpus_have_const_cap(ARM64_WORKAROUND_1542419)) {
/*
* The workaround requires an inner-shareable tlbi.
* We pick the reserved-ASID to minimise the impact.
*/
__tlbi(aside1is, __TLBI_VADDR(0, 0));
dsb(ish);
}
ret = __flush_cache_user_range(start, start + chunk);
if (ret)
return ret;

View File

@ -506,15 +506,6 @@ static void ctr_read_handler(unsigned int esr, struct pt_regs *regs)
int rt = (esr & ESR_ELx_SYS64_ISS_RT_MASK) >> ESR_ELx_SYS64_ISS_RT_SHIFT;
unsigned long val = arm64_ftr_reg_user_value(&arm64_ftr_reg_ctrel0);
if (cpus_have_const_cap(ARM64_WORKAROUND_1542419)) {
/* Hide DIC so that we can trap the unnecessary maintenance...*/
val &= ~BIT(CTR_DIC_SHIFT);
/* ... and fake IminLine to reduce the number of traps. */
val &= ~CTR_IMINLINE_MASK;
val |= (PAGE_SHIFT - 2) & CTR_IMINLINE_MASK;
}
pt_regs_write_reg(regs, rt, val);
arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);

View File

@ -1,5 +1,5 @@
/*
* VDSO implementations.
* VDSO implementation for AArch64 and vector page setup for AArch32.
*
* Copyright (C) 2012 ARM Limited
*
@ -31,74 +31,90 @@
#include <linux/slab.h>
#include <linux/timekeeper_internal.h>
#include <linux/vmalloc.h>
#include <vdso/datapage.h>
#include <vdso/helpers.h>
#include <vdso/vsyscall.h>
#include <asm/cacheflush.h>
#include <asm/signal32.h>
#include <asm/vdso.h>
#include <asm/vdso_datapage.h>
extern char vdso_start[], vdso_end[];
#ifdef CONFIG_COMPAT_VDSO
extern char vdso32_start[], vdso32_end[];
#endif /* CONFIG_COMPAT_VDSO */
/* vdso_lookup arch_index */
enum arch_vdso_type {
ARM64_VDSO = 0,
#ifdef CONFIG_COMPAT_VDSO
ARM64_VDSO32 = 1,
#endif /* CONFIG_COMPAT_VDSO */
};
#ifdef CONFIG_COMPAT_VDSO
#define VDSO_TYPES (ARM64_VDSO32 + 1)
#else
#define VDSO_TYPES (ARM64_VDSO + 1)
#endif /* CONFIG_COMPAT_VDSO */
struct __vdso_abi {
const char *name;
const char *vdso_code_start;
const char *vdso_code_end;
unsigned long vdso_pages;
/* Data Mapping */
struct vm_special_mapping *dm;
/* Code Mapping */
struct vm_special_mapping *cm;
};
static struct __vdso_abi vdso_lookup[VDSO_TYPES] __ro_after_init = {
{
.name = "vdso",
.vdso_code_start = vdso_start,
.vdso_code_end = vdso_end,
},
#ifdef CONFIG_COMPAT_VDSO
{
.name = "vdso32",
.vdso_code_start = vdso32_start,
.vdso_code_end = vdso32_end,
},
#endif /* CONFIG_COMPAT_VDSO */
};
static unsigned long vdso_pages __ro_after_init;
/*
* The vDSO data page.
*/
static union {
struct vdso_data data[CS_BASES];
struct vdso_data data;
u8 page[PAGE_SIZE];
} vdso_data_store __page_aligned_data;
struct vdso_data *vdso_data = vdso_data_store.data;
struct vdso_data *vdso_data = &vdso_data_store.data;
static int __vdso_remap(enum arch_vdso_type arch_index,
const struct vm_special_mapping *sm,
struct vm_area_struct *new_vma)
#ifdef CONFIG_COMPAT
/*
* Create and map the vectors page for AArch32 tasks.
*/
static struct page *vectors_page[1] __ro_after_init;
static int __init alloc_vectors_page(void)
{
extern char __kuser_helper_start[], __kuser_helper_end[];
extern char __aarch32_sigret_code_start[], __aarch32_sigret_code_end[];
int kuser_sz = __kuser_helper_end - __kuser_helper_start;
int sigret_sz = __aarch32_sigret_code_end - __aarch32_sigret_code_start;
unsigned long vpage;
vpage = get_zeroed_page(GFP_ATOMIC);
if (!vpage)
return -ENOMEM;
/* kuser helpers */
memcpy((void *)vpage + 0x1000 - kuser_sz, __kuser_helper_start,
kuser_sz);
/* sigreturn code */
memcpy((void *)vpage + AARCH32_KERN_SIGRET_CODE_OFFSET,
__aarch32_sigret_code_start, sigret_sz);
flush_icache_range(vpage, vpage + PAGE_SIZE);
vectors_page[0] = virt_to_page(vpage);
return 0;
}
arch_initcall(alloc_vectors_page);
int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp)
{
struct mm_struct *mm = current->mm;
unsigned long addr = AARCH32_VECTORS_BASE;
static const struct vm_special_mapping spec = {
.name = "[vectors]",
.pages = vectors_page,
};
void *ret;
if (down_write_killable(&mm->mmap_sem))
return -EINTR;
current->mm->context.vdso = (void *)addr;
/* Map vectors page at the high address. */
ret = _install_special_mapping(mm, addr, PAGE_SIZE,
VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC,
&spec);
up_write(&mm->mmap_sem);
return PTR_ERR_OR_ZERO(ret);
}
#endif /* CONFIG_COMPAT */
static int vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *new_vma)
{
unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
unsigned long vdso_size = vdso_lookup[arch_index].vdso_code_end -
vdso_lookup[arch_index].vdso_code_start;
unsigned long vdso_size = vdso_end - vdso_start;
if (vdso_size != new_size)
return -EINVAL;
@ -108,303 +124,7 @@ static int __vdso_remap(enum arch_vdso_type arch_index,
return 0;
}
static int __vdso_init(enum arch_vdso_type arch_index)
{
int i;
struct page **vdso_pagelist;
unsigned long pfn;
if (memcmp(vdso_lookup[arch_index].vdso_code_start, "\177ELF", 4)) {
pr_err("vDSO is not a valid ELF object!\n");
return -EINVAL;
}
vdso_lookup[arch_index].vdso_pages = (
vdso_lookup[arch_index].vdso_code_end -
vdso_lookup[arch_index].vdso_code_start) >>
PAGE_SHIFT;
/* Allocate the vDSO pagelist, plus a page for the data. */
vdso_pagelist = kcalloc(vdso_lookup[arch_index].vdso_pages + 1,
sizeof(struct page *),
GFP_KERNEL);
if (vdso_pagelist == NULL)
return -ENOMEM;
/* Grab the vDSO data page. */
vdso_pagelist[0] = phys_to_page(__pa_symbol(vdso_data));
/* Grab the vDSO code pages. */
pfn = sym_to_pfn(vdso_lookup[arch_index].vdso_code_start);
for (i = 0; i < vdso_lookup[arch_index].vdso_pages; i++)
vdso_pagelist[i + 1] = pfn_to_page(pfn + i);
vdso_lookup[arch_index].dm->pages = &vdso_pagelist[0];
vdso_lookup[arch_index].cm->pages = &vdso_pagelist[1];
return 0;
}
static int __setup_additional_pages(enum arch_vdso_type arch_index,
struct mm_struct *mm,
struct linux_binprm *bprm,
int uses_interp)
{
unsigned long vdso_base, vdso_text_len, vdso_mapping_len;
void *ret;
vdso_text_len = vdso_lookup[arch_index].vdso_pages << PAGE_SHIFT;
/* Be sure to map the data page */
vdso_mapping_len = vdso_text_len + PAGE_SIZE;
vdso_base = get_unmapped_area(NULL, 0, vdso_mapping_len, 0, 0);
if (IS_ERR_VALUE(vdso_base)) {
ret = ERR_PTR(vdso_base);
goto up_fail;
}
ret = _install_special_mapping(mm, vdso_base, PAGE_SIZE,
VM_READ|VM_MAYREAD,
vdso_lookup[arch_index].dm);
if (IS_ERR(ret))
goto up_fail;
vdso_base += PAGE_SIZE;
mm->context.vdso = (void *)vdso_base;
ret = _install_special_mapping(mm, vdso_base, vdso_text_len,
VM_READ|VM_EXEC|
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
vdso_lookup[arch_index].cm);
if (IS_ERR(ret))
goto up_fail;
return 0;
up_fail:
mm->context.vdso = NULL;
return PTR_ERR(ret);
}
#ifdef CONFIG_COMPAT
/*
* Create and map the vectors page for AArch32 tasks.
*/
#ifdef CONFIG_COMPAT_VDSO
static int aarch32_vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *new_vma)
{
return __vdso_remap(ARM64_VDSO32, sm, new_vma);
}
#endif /* CONFIG_COMPAT_VDSO */
/*
* aarch32_vdso_pages:
* 0 - kuser helpers
* 1 - sigreturn code
* or (CONFIG_COMPAT_VDSO):
* 0 - kuser helpers
* 1 - vdso data
* 2 - vdso code
*/
#define C_VECTORS 0
#ifdef CONFIG_COMPAT_VDSO
#define C_VVAR 1
#define C_VDSO 2
#define C_PAGES (C_VDSO + 1)
#else
#define C_SIGPAGE 1
#define C_PAGES (C_SIGPAGE + 1)
#endif /* CONFIG_COMPAT_VDSO */
static struct page *aarch32_vdso_pages[C_PAGES] __ro_after_init;
static struct vm_special_mapping aarch32_vdso_spec[C_PAGES] = {
{
.name = "[vectors]", /* ABI */
.pages = &aarch32_vdso_pages[C_VECTORS],
},
#ifdef CONFIG_COMPAT_VDSO
{
.name = "[vvar]",
},
{
.name = "[vdso]",
.mremap = aarch32_vdso_mremap,
},
#else
{
.name = "[sigpage]", /* ABI */
.pages = &aarch32_vdso_pages[C_SIGPAGE],
},
#endif /* CONFIG_COMPAT_VDSO */
};
static int aarch32_alloc_kuser_vdso_page(void)
{
extern char __kuser_helper_start[], __kuser_helper_end[];
int kuser_sz = __kuser_helper_end - __kuser_helper_start;
unsigned long vdso_page;
if (!IS_ENABLED(CONFIG_KUSER_HELPERS))
return 0;
vdso_page = get_zeroed_page(GFP_ATOMIC);
if (!vdso_page)
return -ENOMEM;
memcpy((void *)(vdso_page + 0x1000 - kuser_sz), __kuser_helper_start,
kuser_sz);
aarch32_vdso_pages[C_VECTORS] = virt_to_page(vdso_page);
flush_dcache_page(aarch32_vdso_pages[C_VECTORS]);
return 0;
}
#ifdef CONFIG_COMPAT_VDSO
static int __aarch32_alloc_vdso_pages(void)
{
int ret;
vdso_lookup[ARM64_VDSO32].dm = &aarch32_vdso_spec[C_VVAR];
vdso_lookup[ARM64_VDSO32].cm = &aarch32_vdso_spec[C_VDSO];
ret = __vdso_init(ARM64_VDSO32);
if (ret)
return ret;
ret = aarch32_alloc_kuser_vdso_page();
if (ret) {
unsigned long c_vvar =
(unsigned long)page_to_virt(aarch32_vdso_pages[C_VVAR]);
unsigned long c_vdso =
(unsigned long)page_to_virt(aarch32_vdso_pages[C_VDSO]);
free_page(c_vvar);
free_page(c_vdso);
}
return ret;
}
#else
static int __aarch32_alloc_vdso_pages(void)
{
extern char __aarch32_sigret_code_start[], __aarch32_sigret_code_end[];
int sigret_sz = __aarch32_sigret_code_end - __aarch32_sigret_code_start;
unsigned long sigpage;
int ret;
sigpage = get_zeroed_page(GFP_ATOMIC);
if (!sigpage)
return -ENOMEM;
memcpy((void *)sigpage, __aarch32_sigret_code_start, sigret_sz);
aarch32_vdso_pages[C_SIGPAGE] = virt_to_page(sigpage);
flush_dcache_page(aarch32_vdso_pages[C_SIGPAGE]);
ret = aarch32_alloc_kuser_vdso_page();
if (ret)
free_page(sigpage);
return ret;
}
#endif /* CONFIG_COMPAT_VDSO */
static int __init aarch32_alloc_vdso_pages(void)
{
return __aarch32_alloc_vdso_pages();
}
arch_initcall(aarch32_alloc_vdso_pages);
static int aarch32_kuser_helpers_setup(struct mm_struct *mm)
{
void *ret;
if (!IS_ENABLED(CONFIG_KUSER_HELPERS))
return 0;
/*
* Avoid VM_MAYWRITE for compatibility with arch/arm/, where it's
* not safe to CoW the page containing the CPU exception vectors.
*/
ret = _install_special_mapping(mm, AARCH32_VECTORS_BASE, PAGE_SIZE,
VM_READ | VM_EXEC |
VM_MAYREAD | VM_MAYEXEC,
&aarch32_vdso_spec[C_VECTORS]);
return PTR_ERR_OR_ZERO(ret);
}
#ifndef CONFIG_COMPAT_VDSO
static int aarch32_sigreturn_setup(struct mm_struct *mm)
{
unsigned long addr;
void *ret;
addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
if (IS_ERR_VALUE(addr)) {
ret = ERR_PTR(addr);
goto out;
}
/*
* VM_MAYWRITE is required to allow gdb to Copy-on-Write and
* set breakpoints.
*/
ret = _install_special_mapping(mm, addr, PAGE_SIZE,
VM_READ | VM_EXEC | VM_MAYREAD |
VM_MAYWRITE | VM_MAYEXEC,
&aarch32_vdso_spec[C_SIGPAGE]);
if (IS_ERR(ret))
goto out;
mm->context.vdso = (void *)addr;
out:
return PTR_ERR_OR_ZERO(ret);
}
#endif /* !CONFIG_COMPAT_VDSO */
int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
{
struct mm_struct *mm = current->mm;
int ret;
if (down_write_killable(&mm->mmap_sem))
return -EINTR;
ret = aarch32_kuser_helpers_setup(mm);
if (ret)
goto out;
#ifdef CONFIG_COMPAT_VDSO
ret = __setup_additional_pages(ARM64_VDSO32,
mm,
bprm,
uses_interp);
#else
ret = aarch32_sigreturn_setup(mm);
#endif /* CONFIG_COMPAT_VDSO */
out:
up_write(&mm->mmap_sem);
return ret;
}
#endif /* CONFIG_COMPAT */
static int vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *new_vma)
{
return __vdso_remap(ARM64_VDSO, sm, new_vma);
}
/*
* aarch64_vdso_pages:
* 0 - vvar
* 1 - vdso
*/
#define A_VVAR 0
#define A_VDSO 1
#define A_PAGES (A_VDSO + 1)
static struct vm_special_mapping vdso_spec[A_PAGES] __ro_after_init = {
static struct vm_special_mapping vdso_spec[2] __ro_after_init = {
{
.name = "[vvar]",
},
@ -416,10 +136,37 @@ static struct vm_special_mapping vdso_spec[A_PAGES] __ro_after_init = {
static int __init vdso_init(void)
{
vdso_lookup[ARM64_VDSO].dm = &vdso_spec[A_VVAR];
vdso_lookup[ARM64_VDSO].cm = &vdso_spec[A_VDSO];
int i;
struct page **vdso_pagelist;
unsigned long pfn;
return __vdso_init(ARM64_VDSO);
if (memcmp(vdso_start, "\177ELF", 4)) {
pr_err("vDSO is not a valid ELF object!\n");
return -EINVAL;
}
vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT;
/* Allocate the vDSO pagelist, plus a page for the data. */
vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *),
GFP_KERNEL);
if (vdso_pagelist == NULL)
return -ENOMEM;
/* Grab the vDSO data page. */
vdso_pagelist[0] = phys_to_page(__pa_symbol(vdso_data));
/* Grab the vDSO code pages. */
pfn = sym_to_pfn(vdso_start);
for (i = 0; i < vdso_pages; i++)
vdso_pagelist[i + 1] = pfn_to_page(pfn + i);
vdso_spec[0].pages = &vdso_pagelist[0];
vdso_spec[1].pages = &vdso_pagelist[1];
return 0;
}
arch_initcall(vdso_init);
@ -427,17 +174,84 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
int uses_interp)
{
struct mm_struct *mm = current->mm;
int ret;
unsigned long vdso_base, vdso_text_len, vdso_mapping_len;
void *ret;
vdso_text_len = vdso_pages << PAGE_SHIFT;
/* Be sure to map the data page */
vdso_mapping_len = vdso_text_len + PAGE_SIZE;
if (down_write_killable(&mm->mmap_sem))
return -EINTR;
vdso_base = get_unmapped_area(NULL, 0, vdso_mapping_len, 0, 0);
if (IS_ERR_VALUE(vdso_base)) {
ret = ERR_PTR(vdso_base);
goto up_fail;
}
ret = _install_special_mapping(mm, vdso_base, PAGE_SIZE,
VM_READ|VM_MAYREAD,
&vdso_spec[0]);
if (IS_ERR(ret))
goto up_fail;
vdso_base += PAGE_SIZE;
mm->context.vdso = (void *)vdso_base;
ret = _install_special_mapping(mm, vdso_base, vdso_text_len,
VM_READ|VM_EXEC|
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
&vdso_spec[1]);
if (IS_ERR(ret))
goto up_fail;
ret = __setup_additional_pages(ARM64_VDSO,
mm,
bprm,
uses_interp);
up_write(&mm->mmap_sem);
return 0;
return ret;
up_fail:
mm->context.vdso = NULL;
up_write(&mm->mmap_sem);
return PTR_ERR(ret);
}
/*
* Update the vDSO data page to keep in sync with kernel timekeeping.
*/
void update_vsyscall(struct timekeeper *tk)
{
u32 use_syscall = !tk->tkr_mono.clock->archdata.vdso_direct;
++vdso_data->tb_seq_count;
smp_wmb();
vdso_data->use_syscall = use_syscall;
vdso_data->xtime_coarse_sec = tk->xtime_sec;
vdso_data->xtime_coarse_nsec = tk->tkr_mono.xtime_nsec >>
tk->tkr_mono.shift;
vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;
vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;
/* Read without the seqlock held by clock_getres() */
WRITE_ONCE(vdso_data->hrtimer_res, hrtimer_resolution);
if (!use_syscall) {
/* tkr_mono.cycle_last == tkr_raw.cycle_last */
vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last;
vdso_data->raw_time_sec = tk->raw_sec;
vdso_data->raw_time_nsec = tk->tkr_raw.xtime_nsec;
vdso_data->xtime_clock_sec = tk->xtime_sec;
vdso_data->xtime_clock_nsec = tk->tkr_mono.xtime_nsec;
vdso_data->cs_mono_mult = tk->tkr_mono.mult;
vdso_data->cs_raw_mult = tk->tkr_raw.mult;
/* tkr_mono.shift == tkr_raw.shift */
vdso_data->cs_shift = tk->tkr_mono.shift;
}
smp_wmb();
++vdso_data->tb_seq_count;
}
void update_vsyscall_tz(void)
{
vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
vdso_data->tz_dsttime = sys_tz.tz_dsttime;
}

View File

@ -6,49 +6,26 @@
# Heavily based on the vDSO Makefiles for other archs.
#
# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
# the inclusion of generic Makefile.
ARCH_REL_TYPE_ABS := R_AARCH64_JUMP_SLOT|R_AARCH64_GLOB_DAT|R_AARCH64_ABS64
include $(srctree)/lib/vdso/Makefile
obj-vdso := vgettimeofday.o note.o sigreturn.o
obj-vdso := gettimeofday.o note.o sigreturn.o
# Build rules
targets := $(obj-vdso) vdso.so vdso.so.dbg
obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \
--build-id -n -T
ccflags-y := -shared -fno-common -fno-builtin
ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
ccflags-y += $(DISABLE_LTO)
ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
ccflags-y += -DDISABLE_BRANCH_PROFILING
VDSO_LDFLAGS := -Bsymbolic
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS)
KBUILD_CFLAGS += $(DISABLE_LTO)
KASAN_SANITIZE := n
UBSAN_SANITIZE := n
OBJECT_FILES_NON_STANDARD := y
KCOV_INSTRUMENT := n
CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny
ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
endif
# Clang versions less than 8 do not support -mcmodel=tiny
ifeq ($(CONFIG_CC_IS_CLANG), y)
ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
endif
endif
CFLAGS_REMOVE_vgettimeofday.o += $(CC_FLAGS_SCS)
# Disable gcov profiling for VDSO code
GCOV_PROFILE := n
# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
# down to collect2, resulting in silent corruption of the vDSO image.
ccflags-y += -Wl,-shared
obj-y += vdso.o
extra-y += vdso.lds
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
@ -58,7 +35,7 @@ $(obj)/vdso.o : $(obj)/vdso.so
# Link rule for the .so file, .lds has to be first
$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso)
$(call if_changed,vdsold_and_vdso_check)
$(call if_changed,vdsold)
# Strip rule for the .so file
$(obj)/%.so: OBJCOPYFLAGS := -S
@ -75,13 +52,16 @@ endef
include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
$(call if_changed,vdsosym)
# Assembly rules for the .S files
$(obj-vdso): %.o: %.S FORCE
$(call if_changed_dep,vdsoas)
# Actual build commands
quiet_cmd_vdsold = VDSOL $@
cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
quiet_cmd_vdsoas = VDSOA $@
cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
quiet_cmd_vdsold_and_vdso_check = LD $@
cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
# Install commands for the unstripped file
quiet_cmd_vdso_install = INSTALL $@
cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@

View File

@ -1,25 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/*
* ARM64 userspace implementations of gettimeofday() and similar.
*
* Copyright (C) 2018 ARM Limited
*
*/
int __kernel_clock_gettime(clockid_t clock,
struct __kernel_timespec *ts)
{
return __cvdso_clock_gettime(clock, ts);
}
int __kernel_gettimeofday(struct __kernel_old_timeval *tv,
struct timezone *tz)
{
return __cvdso_gettimeofday(tv, tz);
}
int __kernel_clock_getres(clockid_t clock_id,
struct __kernel_timespec *res)
{
return __cvdso_clock_getres(clock_id, res);
}

View File

@ -1,211 +0,0 @@
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for vdso32
#
# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
# the inclusion of generic Makefile.
ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32
include $(srctree)/lib/vdso/Makefile
# Same as cc-*option, but using CC_COMPAT instead of CC
ifeq ($(CONFIG_CC_IS_CLANG), y)
COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit))
COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..)
CC_COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
CC_COMPAT_CLANG_FLAGS += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR)
CC_COMPAT_CLANG_FLAGS += -no-integrated-as -Qunused-arguments
ifneq ($(COMPAT_GCC_TOOLCHAIN),)
CC_COMPAT_CLANG_FLAGS += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN)
endif
CC_COMPAT ?= $(CC)
CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS)
else
CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
endif
cc32-option = $(call try-run,\
$(CC_COMPAT) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
cc32-disable-warning = $(call try-run,\
$(CC_COMPAT) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
cc32-ldoption = $(call try-run,\
$(CC_COMPAT) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
cc32-as-instr = $(call try-run,\
printf "%b\n" "$(1)" | $(CC_COMPAT) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
# We cannot use the global flags to compile the vDSO files, the main reason
# being that the 32-bit compiler may be older than the main (64-bit) compiler
# and therefore may not understand flags set using $(cc-option ...). Besides,
# arch-specific options should be taken from the arm Makefile instead of the
# arm64 one.
# As a result we set our own flags here.
# KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
VDSO_CPPFLAGS += $(LINUXINCLUDE)
# Common C and assembly flags
# From top-level Makefile
VDSO_CAFLAGS := $(VDSO_CPPFLAGS)
ifneq ($(shell $(CC_COMPAT) --version 2>&1 | head -n 1 | grep clang),)
VDSO_CAFLAGS += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
endif
VDSO_CAFLAGS += $(call cc32-option,-fno-PIE)
ifdef CONFIG_DEBUG_INFO
VDSO_CAFLAGS += -g
endif
# From arm Makefile
VDSO_CAFLAGS += $(call cc32-option,-fno-dwarf2-cfi-asm)
VDSO_CAFLAGS += -mabi=aapcs-linux -mfloat-abi=soft
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
VDSO_CAFLAGS += -mbig-endian
else
VDSO_CAFLAGS += -mlittle-endian
endif
# From arm vDSO Makefile
VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector
VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING
# Try to compile for ARMv8. If the compiler is too old and doesn't support it,
# fall back to v7. There is no easy way to check for what architecture the code
# is being compiled, so define a macro specifying that (see arch/arm/Makefile).
VDSO_CAFLAGS += $(call cc32-option,-march=armv8-a -D__LINUX_ARM_ARCH__=8,\
-march=armv7-a -D__LINUX_ARM_ARCH__=7)
VDSO_CFLAGS := $(VDSO_CAFLAGS)
VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1
# KBUILD_CFLAGS from top-level Makefile
VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-std=gnu89
VDSO_CFLAGS += -O2
# Some useful compiler-dependent flags from top-level Makefile
VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
VDSO_CFLAGS += $(call cc32-option,-fno-strict-overflow)
VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
VDSO_CFLAGS += $(call cc32-option,-Werror=date-time)
VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
# The 32-bit compiler does not provide 128-bit integers, which are used in
# some headers that are indirectly included from the vDSO code.
# This hack makes the compiler happy and should trigger a warning/error if
# variables of such type are referenced.
VDSO_CFLAGS += -D__uint128_t='void*'
# Silence some warnings coming from headers that operate on long's
# (on GCC 4.8 or older, there is unfortunately no way to silence this warning)
VDSO_CFLAGS += $(call cc32-disable-warning,shift-count-overflow)
VDSO_CFLAGS += -Wno-int-to-pointer-cast
VDSO_AFLAGS := $(VDSO_CAFLAGS)
VDSO_AFLAGS += -D__ASSEMBLY__
# Check for binutils support for dmb ishld
dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1)
VDSO_CFLAGS += $(dmbinstr)
VDSO_AFLAGS += $(dmbinstr)
VDSO_LDFLAGS := $(VDSO_CPPFLAGS)
# From arm vDSO Makefile
VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
VDSO_LDFLAGS += -nostdlib -shared -mfloat-abi=soft
VDSO_LDFLAGS += $(call cc32-ldoption,-Wl$(comma)--hash-style=sysv)
VDSO_LDFLAGS += $(call cc32-ldoption,-Wl$(comma)--build-id)
VDSO_LDFLAGS += $(call cc32-ldoption,-fuse-ld=bfd)
# Borrow vdsomunge.c from the arm vDSO
# We have to use a relative path because scripts/Makefile.host prefixes
# $(hostprogs-y) with $(obj)
munge := ../../../arm/vdso/vdsomunge
hostprogs-y := $(munge)
c-obj-vdso := note.o
c-obj-vdso-gettimeofday := vgettimeofday.o
asm-obj-vdso := sigreturn.o
ifneq ($(c-gettimeofday-y),)
VDSO_CFLAGS_gettimeofday_o += -include $(c-gettimeofday-y)
endif
VDSO_CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
# Build rules
targets := $(c-obj-vdso) $(c-obj-vdso-gettimeofday) $(asm-obj-vdso) vdso.so vdso.so.dbg vdso.so.raw
c-obj-vdso := $(addprefix $(obj)/, $(c-obj-vdso))
c-obj-vdso-gettimeofday := $(addprefix $(obj)/, $(c-obj-vdso-gettimeofday))
asm-obj-vdso := $(addprefix $(obj)/, $(asm-obj-vdso))
obj-vdso := $(c-obj-vdso) $(c-obj-vdso-gettimeofday) $(asm-obj-vdso)
obj-y += vdso.o
extra-y += vdso.lds
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
# Force dependency (vdso.s includes vdso.so through incbin)
$(obj)/vdso.o: $(obj)/vdso.so
include/generated/vdso32-offsets.h: $(obj)/vdso.so.dbg FORCE
$(call if_changed,vdsosym)
# Strip rule for vdso.so
$(obj)/vdso.so: OBJCOPYFLAGS := -S
$(obj)/vdso.so: $(obj)/vdso.so.dbg FORCE
$(call if_changed,objcopy)
$(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/$(munge) FORCE
$(call if_changed,vdsomunge)
# Link rule for the .so file, .lds has to be first
$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
$(call if_changed,vdsold_and_vdso_check)
# Compilation rules for the vDSO sources
$(c-obj-vdso): %.o: %.c FORCE
$(call if_changed_dep,vdsocc)
$(c-obj-vdso-gettimeofday): %.o: %.c FORCE
$(call if_changed_dep,vdsocc_gettimeofday)
$(asm-obj-vdso): %.o: %.S FORCE
$(call if_changed_dep,vdsoas)
# Actual build commands
quiet_cmd_vdsold_and_vdso_check = LD32 $@
cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check)
quiet_cmd_vdsold = LD32 $@
cmd_vdsold = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \
-Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
quiet_cmd_vdsocc = CC32 $@
cmd_vdsocc = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $<
quiet_cmd_vdsocc_gettimeofday = CC32 $@
cmd_vdsocc_gettimeofday = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) $(VDSO_CFLAGS_gettimeofday_o) -c -o $@ $<
quiet_cmd_vdsoas = AS32 $@
cmd_vdsoas = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_AFLAGS) -c -o $@ $<
quiet_cmd_vdsomunge = MUNGE $@
cmd_vdsomunge = $(obj)/$(munge) $< $@
# Generate vDSO offsets using helper script (borrowed from the 64-bit vDSO)
gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh
quiet_cmd_vdsosym = VDSOSYM $@
# The AArch64 nm should be able to read an AArch32 binary
cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
# Install commands for the unstripped file
quiet_cmd_vdso_install = INSTALL $@
cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so
vdso.so: $(obj)/vdso.so.dbg
@mkdir -p $(MODLIB)/vdso
$(call cmd,vdso_install)
vdso_install: vdso.so

View File

@ -1,15 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2012-2018 ARM Limited
*
* This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
* Here we can supply some information useful to userland.
*/
#include <linux/uts.h>
#include <linux/version.h>
#include <linux/elfnote.h>
#include <linux/build-salt.h>
ELFNOTE32("Linux", 0, LINUX_VERSION_CODE);
BUILD_SALT;

View File

@ -1,62 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* This file provides both A32 and T32 versions, in accordance with the
* arm sigreturn code.
*
* Copyright (C) 2018 ARM Limited
*/
#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
#define ARM_ENTRY(name) \
ENTRY(name)
#define ARM_ENDPROC(name) \
.type name, %function; \
END(name)
.text
.arm
.fnstart
.save {r0-r15}
.pad #COMPAT_SIGFRAME_REGS_OFFSET
nop
ARM_ENTRY(__kernel_sigreturn_arm)
mov r7, #__NR_compat_sigreturn
svc #0
.fnend
ARM_ENDPROC(__kernel_sigreturn_arm)
.fnstart
.save {r0-r15}
.pad #COMPAT_RT_SIGFRAME_REGS_OFFSET
nop
ARM_ENTRY(__kernel_rt_sigreturn_arm)
mov r7, #__NR_compat_rt_sigreturn
svc #0
.fnend
ARM_ENDPROC(__kernel_rt_sigreturn_arm)
.thumb
.fnstart
.save {r0-r15}
.pad #COMPAT_SIGFRAME_REGS_OFFSET
nop
ARM_ENTRY(__kernel_sigreturn_thumb)
mov r7, #__NR_compat_sigreturn
svc #0
.fnend
ARM_ENDPROC(__kernel_sigreturn_thumb)
.fnstart
.save {r0-r15}
.pad #COMPAT_RT_SIGFRAME_REGS_OFFSET
nop
ARM_ENTRY(__kernel_rt_sigreturn_thumb)
mov r7, #__NR_compat_rt_sigreturn
svc #0
.fnend
ARM_ENDPROC(__kernel_rt_sigreturn_thumb)

View File

@ -1,19 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2012 ARM Limited
*/
#include <linux/init.h>
#include <linux/linkage.h>
#include <linux/const.h>
#include <asm/page.h>
.globl vdso32_start, vdso32_end
.section .rodata
.balign PAGE_SIZE
vdso32_start:
.incbin "arch/arm64/kernel/vdso32/vdso.so"
.balign PAGE_SIZE
vdso32_end:
.previous

View File

@ -1,82 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Adapted from arm64 version.
*
* GNU linker script for the VDSO library.
* Heavily based on the vDSO linker scripts for other archs.
*
* Copyright (C) 2012-2018 ARM Limited
*/
#include <linux/const.h>
#include <asm/page.h>
#include <asm/vdso.h>
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SECTIONS
{
PROVIDE_HIDDEN(_vdso_data = . - PAGE_SIZE);
. = VDSO_LBASE + SIZEOF_HEADERS;
.hash : { *(.hash) } :text
.gnu.hash : { *(.gnu.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.note : { *(.note.*) } :text :note
.dynamic : { *(.dynamic) } :text :dynamic
.rodata : { *(.rodata*) } :text
.text : { *(.text*) } :text =0xe7f001f2
.got : { *(.got) }
.rel.plt : { *(.rel.plt) }
/DISCARD/ : {
*(.note.GNU-stack)
*(.data .data.* .gnu.linkonce.d.* .sdata*)
*(.bss .sbss .dynbss .dynsbss)
}
}
/*
* We must supply the ELF program headers explicitly to get just one
* PT_LOAD segment, and set the flags explicitly to make segments read-only.
*/
PHDRS
{
text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
note PT_NOTE FLAGS(4); /* PF_R */
}
VERSION
{
LINUX_2.6 {
global:
__vdso_clock_gettime;
__vdso_gettimeofday;
__vdso_clock_getres;
__kernel_sigreturn_arm;
__kernel_sigreturn_thumb;
__kernel_rt_sigreturn_arm;
__kernel_rt_sigreturn_thumb;
__vdso_clock_gettime64;
local: *;
};
}
/*
* Make the sigreturn code visible to the kernel.
*/
VDSO_compat_sigreturn_arm = __kernel_sigreturn_arm;
VDSO_compat_sigreturn_thumb = __kernel_sigreturn_thumb;
VDSO_compat_rt_sigreturn_arm = __kernel_rt_sigreturn_arm;
VDSO_compat_rt_sigreturn_thumb = __kernel_rt_sigreturn_thumb;

View File

@ -1,45 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/*
* ARM64 compat userspace implementations of gettimeofday() and similar.
*
* Copyright (C) 2018 ARM Limited
*
*/
int __vdso_clock_gettime(clockid_t clock,
struct old_timespec32 *ts)
{
return __cvdso_clock_gettime32(clock, ts);
}
int __vdso_clock_gettime64(clockid_t clock,
struct __kernel_timespec *ts)
{
return __cvdso_clock_gettime(clock, ts);
}
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
struct timezone *tz)
{
return __cvdso_gettimeofday(tv, tz);
}
int __vdso_clock_getres(clockid_t clock_id,
struct old_timespec32 *res)
{
return __cvdso_clock_getres_time32(clock_id, res);
}
/* Avoid unresolved references emitted by GCC */
void __aeabi_unwind_cpp_pr0(void)
{
}
void __aeabi_unwind_cpp_pr1(void)
{
}
void __aeabi_unwind_cpp_pr2(void)
{
}

View File

@ -179,13 +179,6 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
}
memcpy((u32 *)regs + off, valp, KVM_REG_SIZE(reg->id));
if (*vcpu_cpsr(vcpu) & PSR_MODE32_BIT) {
int i;
for (i = 0; i < 16; i++)
*vcpu_reg32(vcpu, i) = (u32)*vcpu_reg32(vcpu, i);
}
out:
return err;
}

View File

@ -41,6 +41,7 @@
#include <linux/dma-mapping-fast.h>
#include <linux/msm_dma_iommu_mapping.h>
static int swiotlb __ro_after_init;
static pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot,
@ -1009,7 +1010,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
}
#endif
}
EXPORT_SYMBOL_GPL(arch_setup_dma_ops);
EXPORT_SYMBOL(arch_setup_dma_ops);
#ifdef CONFIG_ARM64_DMA_USE_IOMMU
@ -1156,3 +1157,4 @@ static void arm_iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size)
{
}
#endif

View File

@ -218,8 +218,6 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
ptep = (pte_t *)pudp;
} else if (sz == (PAGE_SIZE * CONT_PTES)) {
pmdp = pmd_alloc(mm, pudp, addr);
if (!pmdp)
return NULL;
WARN_ON(addr & (sz - 1));
/*

View File

@ -56,8 +56,6 @@
#include <asm/tlb.h>
#include <asm/alternative.h>
EXPORT_SYMBOL_GPL(kimage_vaddr);
/*
* We need to be able to catch inadvertent references to memstart_addr
* that occur (potentially in generic code) before arm64_memblock_init()

View File

@ -1150,7 +1150,6 @@ int kern_addr_valid(unsigned long addr)
return pfn_valid(pte_pfn(pte));
}
EXPORT_SYMBOL_GPL(kern_addr_valid);
#ifdef CONFIG_SPARSEMEM_VMEMMAP
#if !ARM64_SWAPPER_USES_SECTION_MAPS
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,

View File

@ -8,124 +8,131 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Copyright (C) 2012 ARM Limited
* Copyright (C) 2013 ARM Limited
*/
#include <linux/clkdev.h>
#include <linux/amba/sp810.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/vexpress.h>
#include <linux/of_address.h>
struct vexpress_osc {
struct regmap *reg;
#define to_clk_sp810_timerclken(_hw) \
container_of(_hw, struct clk_sp810_timerclken, hw)
struct clk_sp810;
struct clk_sp810_timerclken {
struct clk_hw hw;
unsigned long rate_min;
unsigned long rate_max;
};
#define to_vexpress_osc(osc) container_of(osc, struct vexpress_osc, hw)
static unsigned long vexpress_osc_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct vexpress_osc *osc = to_vexpress_osc(hw);
u32 rate;
regmap_read(osc->reg, 0, &rate);
return rate;
}
static long vexpress_osc_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{
struct vexpress_osc *osc = to_vexpress_osc(hw);
if (osc->rate_min && rate < osc->rate_min)
rate = osc->rate_min;
if (osc->rate_max && rate > osc->rate_max)
rate = osc->rate_max;
return rate;
}
static int vexpress_osc_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct vexpress_osc *osc = to_vexpress_osc(hw);
return regmap_write(osc->reg, 0, rate);
}
static const struct clk_ops vexpress_osc_ops = {
.recalc_rate = vexpress_osc_recalc_rate,
.round_rate = vexpress_osc_round_rate,
.set_rate = vexpress_osc_set_rate,
};
static int vexpress_osc_probe(struct platform_device *pdev)
{
struct clk_init_data init = {};
struct vexpress_osc *osc;
struct clk *clk;
u32 range[2];
struct clk_sp810 *sp810;
int channel;
};
osc = devm_kzalloc(&pdev->dev, sizeof(*osc), GFP_KERNEL);
if (!osc)
return -ENOMEM;
struct clk_sp810 {
struct device_node *node;
void __iomem *base;
spinlock_t lock;
struct clk_sp810_timerclken timerclken[4];
};
osc->reg = devm_regmap_init_vexpress_config(&pdev->dev);
if (IS_ERR(osc->reg))
return PTR_ERR(osc->reg);
static u8 clk_sp810_timerclken_get_parent(struct clk_hw *hw)
{
struct clk_sp810_timerclken *timerclken = to_clk_sp810_timerclken(hw);
u32 val = readl(timerclken->sp810->base + SCCTRL);
if (of_property_read_u32_array(pdev->dev.of_node, "freq-range", range,
ARRAY_SIZE(range)) == 0) {
osc->rate_min = range[0];
osc->rate_max = range[1];
}
return !!(val & (1 << SCCTRL_TIMERENnSEL_SHIFT(timerclken->channel)));
}
if (of_property_read_string(pdev->dev.of_node, "clock-output-names",
&init.name) != 0)
init.name = dev_name(&pdev->dev);
static int clk_sp810_timerclken_set_parent(struct clk_hw *hw, u8 index)
{
struct clk_sp810_timerclken *timerclken = to_clk_sp810_timerclken(hw);
struct clk_sp810 *sp810 = timerclken->sp810;
u32 val, shift = SCCTRL_TIMERENnSEL_SHIFT(timerclken->channel);
unsigned long flags = 0;
init.ops = &vexpress_osc_ops;
init.flags = 0;
init.num_parents = 0;
if (WARN_ON(index > 1))
return -EINVAL;
osc->hw.init = &init;
spin_lock_irqsave(&sp810->lock, flags);
clk = clk_register(NULL, &osc->hw);
if (IS_ERR(clk))
return PTR_ERR(clk);
val = readl(sp810->base + SCCTRL);
val &= ~(1 << shift);
val |= index << shift;
writel(val, sp810->base + SCCTRL);
of_clk_add_provider(pdev->dev.of_node, of_clk_src_simple_get, clk);
clk_hw_set_rate_range(&osc->hw, osc->rate_min, osc->rate_max);
dev_dbg(&pdev->dev, "Registered clock '%s'\n", init.name);
spin_unlock_irqrestore(&sp810->lock, flags);
return 0;
}
static const struct of_device_id vexpress_osc_of_match[] = {
{ .compatible = "arm,vexpress-osc", },
{}
static const struct clk_ops clk_sp810_timerclken_ops = {
.get_parent = clk_sp810_timerclken_get_parent,
.set_parent = clk_sp810_timerclken_set_parent,
};
static struct platform_driver vexpress_osc_driver = {
.driver = {
.name = "vexpress-osc",
.of_match_table = vexpress_osc_of_match,
},
.probe = vexpress_osc_probe,
};
static int __init vexpress_osc_init(void)
static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
void *data)
{
return platform_driver_register(&vexpress_osc_driver);
struct clk_sp810 *sp810 = data;
if (WARN_ON(clkspec->args_count != 1 ||
clkspec->args[0] >= ARRAY_SIZE(sp810->timerclken)))
return NULL;
return sp810->timerclken[clkspec->args[0]].clk;
}
core_initcall(vexpress_osc_init);
static void __init clk_sp810_of_setup(struct device_node *node)
{
struct clk_sp810 *sp810 = kzalloc(sizeof(*sp810), GFP_KERNEL);
const char *parent_names[2];
int num = ARRAY_SIZE(parent_names);
char name[12];
struct clk_init_data init = {};
static int instance;
int i;
bool deprecated;
if (!sp810)
return;
if (of_clk_parent_fill(node, parent_names, num) != num) {
pr_warn("Failed to obtain parent clocks for SP810!\n");
kfree(sp810);
return;
}
sp810->node = node;
sp810->base = of_iomap(node, 0);
spin_lock_init(&sp810->lock);
init.name = name;
init.ops = &clk_sp810_timerclken_ops;
init.flags = CLK_IS_BASIC;
init.parent_names = parent_names;
init.num_parents = num;
deprecated = !of_find_property(node, "assigned-clock-parents", NULL);
for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) {
snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);
sp810->timerclken[i].sp810 = sp810;
sp810->timerclken[i].channel = i;
sp810->timerclken[i].hw.init = &init;
if (deprecated)
init.ops->set_parent(&sp810->timerclken[i].hw, 1);
sp810->timerclken[i].clk = clk_register(NULL,
&sp810->timerclken[i].hw);
WARN_ON(IS_ERR(sp810->timerclken[i].clk));
}
of_clk_add_provider(node, clk_sp810_timerclken_of_get, sp810);
instance++;
}
CLK_OF_DECLARE(sp810, "arm,sp810", clk_sp810_of_setup);

View File

@ -1,121 +0,0 @@
/*
* Copyright (C) 2015 Red Hat, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <linux/pci.h>
#include <drm/drm_fb_helper.h>
#include "virtgpu_drv.h"
static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
{
struct apertures_struct *ap;
bool primary;
ap = alloc_apertures(1);
if (!ap)
return;
ap->ranges[0].base = pci_resource_start(pci_dev, 0);
ap->ranges[0].size = pci_resource_len(pci_dev, 0);
primary = pci_dev->resource[PCI_ROM_RESOURCE].flags
& IORESOURCE_ROM_SHADOW;
drm_fb_helper_remove_conflicting_framebuffers(ap, "virtiodrmfb", primary);
kfree(ap);
}
int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
{
struct drm_device *dev;
int ret;
dev = drm_dev_alloc(driver, &vdev->dev);
if (IS_ERR(dev))
return PTR_ERR(dev);
vdev->priv = dev;
if (strcmp(vdev->dev.parent->bus->name, "pci") == 0) {
struct pci_dev *pdev = to_pci_dev(vdev->dev.parent);
const char *pname = dev_name(&pdev->dev);
bool vga = (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA;
char unique[20];
DRM_INFO("pci: %s detected at %s\n",
vga ? "virtio-vga" : "virtio-gpu-pci",
pname);
dev->pdev = pdev;
if (vga)
virtio_pci_kick_out_firmware_fb(pdev);
/*
* Normally the drm_dev_set_unique() call is done by core DRM.
* The following comment covers, why virtio cannot rely on it.
*
* Unlike the other virtual GPU drivers, virtio abstracts the
* underlying bus type by using struct virtio_device.
*
* Hence the dev_is_pci() check, used in core DRM, will fail
* and the unique returned will be the virtio_device "virtio0",
* while a "pci:..." one is required.
*
* A few other ideas were considered:
* - Extend the dev_is_pci() check [in drm_set_busid] to
* consider virtio.
* Seems like a bigger hack than what we have already.
*
* - Point drm_device::dev to the parent of the virtio_device
* Semantic changes:
* * Using the wrong device for i2c, framebuffer_alloc and
* prime import.
* Visual changes:
* * Helpers such as DRM_DEV_ERROR, dev_info, drm_printer,
* will print the wrong information.
*
* We could address the latter issues, by introducing
* drm_device::bus_dev, ... which would be used solely for this.
*
* So for the moment keep things as-is, with a bulky comment
* for the next person who feels like removing this
* drm_dev_set_unique() quirk.
*/
snprintf(unique, sizeof(unique), "pci:%s", pname);
ret = drm_dev_set_unique(dev, unique);
if (ret)
goto err_free;
}
ret = drm_dev_register(dev, 0);
if (ret)
goto err_free;
return 0;
err_free:
drm_dev_put(dev);
return ret;
}

View File

@ -77,6 +77,7 @@ struct external_battery_gauge {
int (*fast_chg_started_status)(bool status);
bool (*get_fastchg_firmware_already_updated)(void);
int (*get_device_type)(void);
/* david.liu@bsp, 20161025 Add BQ27411 dash charging */
int (*wlchg_started_status)(bool status);
int (*get_time_to_full)(void);
};

View File

@ -19,7 +19,9 @@
#include <linux/spinlock.h>
#include <linux/notifier.h>
#include <linux/types.h>
#ifndef VENDOR_EDIT
#define VENDOR_EDIT "VENDOR_EDIT"
#endif
enum {
POWER_SUPPLY_STATUS_UNKNOWN = 0,
POWER_SUPPLY_STATUS_CHARGING,
@ -300,8 +302,10 @@ enum power_supply_property {
POWER_SUPPLY_PROP_PARALLEL_DISABLE,
POWER_SUPPLY_PROP_PE_START,
POWER_SUPPLY_PROP_SOC_REPORTING_READY,
#ifdef VENDOR_EDIT
POWER_SUPPLY_PROP_SOC_NOTIFY_READY,
POWER_SUPPLY_PROP_RESTORE_SOC,
#endif
POWER_SUPPLY_PROP_DEBUG_BATTERY,
POWER_SUPPLY_PROP_FCC_DELTA,
POWER_SUPPLY_PROP_ICL_REDUCTION,

View File

@ -15,14 +15,23 @@
#include <linux/regulator/consumer.h>
#include <linux/extcon-provider.h>
/****************************************************/
#ifndef VENDOR_EDIT
#define VENDOR_EDIT "VENDOR_EDIT"
#endif
/**************************************************/
#ifdef VENDOR_EDIT
#include "storm-watch.h"
#include "battery.h"
#include <linux/usb/typec.h>
#include <linux/usb/usbpd.h>
#endif
#ifdef VENDOR_EDIT
#include <linux/time.h>
#include <linux/jiffies.h>
#include <linux/sched/clock.h>
#endif
enum print_reason {
PR_INTERRUPT = BIT(0),
@ -63,10 +72,16 @@ enum print_reason {
#define PL_FCC_LOW_VOTER "PL_FCC_LOW_VOTER"
#define WBC_VOTER "WBC_VOTER"
#define HW_LIMIT_VOTER "HW_LIMIT_VOTER"
#ifdef VENDOR_EDIT
#define DIVIDER_SET_VOTER "DIVIDER_SET_VOTER"
#endif
#ifdef VENDOR_EDIT
#define PD_DIS_VOTER "PD_DIS_VOTER"
#endif
#ifdef VENDOR_EDIT
#define SWARP_OTG_VOTER "SWARP_OTG_VOTER"
#endif
#define PL_SMB_EN_VOTER "PL_SMB_EN_VOTER"
#define FORCE_RECHARGE_VOTER "FORCE_RECHARGE_VOTER"
#define LPD_VOTER "LPD_VOTER"
@ -92,7 +107,11 @@ enum print_reason {
#define OVERHEAT_LIMIT_VOTER "OVERHEAT_LIMIT_VOTER"
#define BOOST_BACK_STORM_COUNT 3
#ifdef VENDOR_EDIT
#define WEAK_CHG_STORM_COUNT 3
#else
#define WEAK_CHG_STORM_COUNT 8
#endif
#define VBAT_TO_VRAW_ADC(v) div_u64((u64)v * 1000000UL, 194637UL)
@ -100,16 +119,22 @@ enum print_reason {
#define ITERM_LIMITS_PM8150B_MA 10000
#define ADC_CHG_ITERM_MASK 32767
#ifdef VENDOR_EDIT
#define USB_TEMP_HIGH 0x01//bit0
#define USB_WATER_DETECT 0x02//bit1
#define USB_RESERVE2 0x04//bit2
#define USB_RESERVE3 0x08//bit3
#define USB_RESERVE4 0x10//bit4
#define USB_DONOT_USE 0x80000000//bit31
#endif
#define SDP_100_MA 100000
#define SDP_CURRENT_UA 500000
#define CDP_CURRENT_UA 1500000
#ifndef VENDOR_EDIT
#define DCP_CURRENT_UA 1500000
#else
#define DCP_CURRENT_UA 3000000
#endif
#define HVDCP_CURRENT_UA 3000000
#define TYPEC_DEFAULT_CURRENT_UA 900000
#define TYPEC_MEDIUM_CURRENT_UA 1500000
@ -381,8 +406,10 @@ struct smb_iio {
struct iio_channel *connector_temp_chan;
struct iio_channel *sbux_chan;
struct iio_channel *vph_v_chan;
#ifdef VENDOR_EDIT
struct iio_channel *usbtemp_v_chan;
struct iio_channel *usbtemp_sup_v_chan;
#endif
struct iio_channel *die_temp_chan;
struct iio_channel *skin_temp_chan;
struct iio_channel *smb_temp_chan;
@ -419,7 +446,9 @@ struct smb_charger {
struct power_supply *dc_psy;
struct power_supply *bms_psy;
struct power_supply *usb_main_psy;
#ifdef VENDOR_EDIT
struct power_supply *ac_psy;
#endif
struct power_supply *usb_port_psy;
struct power_supply *wls_psy;
struct power_supply *cp_psy;
@ -494,8 +523,13 @@ struct smb_charger {
int sec_chg_selected;
int cp_reason;
int cp_topo;
#ifdef VENDOR_EDIT
struct delayed_work chg_monitor_work;
#endif
#ifdef VENDOR_EDIT
struct delayed_work typec_disable_cmd_work;
#endif
#ifdef VENDOR_EDIT
unsigned long long hvdcp_detect_time;
unsigned long long hvdcp_detach_time;
bool hvdcp_detect_ok;
@ -504,6 +538,7 @@ struct smb_charger {
struct delayed_work reset_mcu_work;
struct delayed_work delay_reset_dummy_fastchg_work;
struct delayed_work regist_pd;
#endif
/* pd */
int voltage_min_uv;
@ -516,9 +551,11 @@ struct smb_charger {
bool ok_to_pd;
bool typec_legacy;
bool typec_irq_en;
#ifdef VENDOR_EDIT
struct usbpd *oplus_pd;
struct usbpd_svid_handler oplus_svid_handler;
bool typec_role_swap_failed;
#endif
/* cached status */
bool system_suspend_supported;
int boost_threshold_ua;
@ -607,8 +644,10 @@ struct smb_charger {
int qc2_max_pulses;
enum qc2_non_comp_voltage qc2_unsupported_voltage;
bool dbc_usbov;
#ifdef VENDOR_EDIT
bool fake_typec_insertion;
bool fake_usb_insertion;
#endif
/* extcon for VBUS / ID notification to USB for uUSB */
struct extcon_dev *extcon;
@ -632,29 +671,39 @@ struct smb_charger {
u32 irq_status;
/* wireless */
#ifdef VENDOR_EDIT
int pre_current_ma;
bool is_dpdm_on_usb;
struct delayed_work divider_set_work;
struct work_struct dpdm_set_work;
#endif
int dcin_uv_count;
#ifdef VENDOR_EDIT
struct work_struct chargerid_switch_work;
struct mutex pinctrl_mutex;
struct pinctrl *usbtemp_gpio1_adc_pinctrl;
struct pinctrl *usbtemp_gpio12_adc_pinctrl;
struct pinctrl_state *usbtemp_gpio1_default;
struct pinctrl_state *usbtemp_gpio12_default;
#endif
#ifdef VENDOR_EDIT
int shipmode_id_gpio;
struct pinctrl *shipmode_id_pinctrl;
struct pinctrl_state *shipmode_id_active;
#endif
#ifdef VENDOR_EDIT
int batt_info[6];
int batt_info_id;
bool *batt_range_ocv;
int *batt_range_pct;
int soc_reporting_ready;
#endif
ktime_t dcin_uv_last_time;
int last_wls_vout;
};
#ifdef VENDOR_EDIT
struct smb_dt_props {
int usb_icl_ua;
struct device_node *revid_dev_node;
@ -709,6 +758,7 @@ struct qcom_pmic {
bool hc_mode_flag;
/* copy form msm8976_pmic end */
};
#endif
int smblib_read(struct smb_charger *chg, u16 addr, u8 *val);
int smblib_masked_write(struct smb_charger *chg, u16 addr, u8 mask, u8 val);

View File

@ -10,6 +10,7 @@
#include "../oplus_warp.h"
#ifdef VENDOR_EDIT
#define USB_20C 20
#define USB_30C 30
#define USB_40C 40
@ -435,4 +436,5 @@ int oplus_usbtemp_monitor_common(void *data)
return 0;
}
EXPORT_SYMBOL(oplus_usbtemp_monitor_common);
#endif

View File

@ -1,6 +1,6 @@
#ifndef __OP_BQ27541_H__
#define __OP_BQ27541_H__
/* david.liu@bsp, 20161004 Add BQ27411 support */
#define CONFIG_GAUGE_BQ27411 1
#define DEVICE_TYPE_BQ27541 0x0541
#define DEVICE_TYPE_BQ27411 0x0421
@ -50,6 +50,8 @@
#define BQ27541_CS_SS BIT(13)
#ifdef CONFIG_GAUGE_BQ27411
/* david.liu@bsp, 20161004 Add BQ27411 support */
/* Bq27411 standard data commands */
#define BQ27411_REG_TEMP 0x02
#define BQ27411_REG_VOLT 0x04
#define BQ27411_REG_RM 0x0A
@ -190,6 +192,7 @@
#define ERROR_BATT_VOL (3800 * 1000)
#ifdef CONFIG_GAUGE_BQ27411
/* david.liu@bsp, 20161004 Add BQ27411 support */
struct cmd_address {
u8 reg_temp;
u8 reg_volt;
@ -251,8 +254,10 @@ struct bq27541_device_info {
bool disable_calib_soc;
unsigned long lcd_off_time;
unsigned long soc_pre_time;
/* david.liu@oneplus.tw, 2016/05/16 Fix capacity won't udate */
unsigned long soc_store_time;
#ifdef CONFIG_GAUGE_BQ27411
/* david.liu@bsp, 20161004 Add BQ27411 support */
int device_type;
struct cmd_address cmd_addr;
bool modify_soc_smooth;

View File

@ -534,7 +534,7 @@ void usb_sw_gpio_set(int value)
gpio_direction_output(fastchg_di->usb_sw_2_gpio, 0);
}
fastchg_di->fast_chg_allow = value;
/* david@bsp add log */
pr_info("get usb_sw_gpio=%d&%d\n"
, gpio_get_value(fastchg_di->usb_sw_1_gpio)
, gpio_get_value(fastchg_di->usb_sw_2_gpio));
@ -900,6 +900,7 @@ static int set_property_on_smbcharger(
}
}
ret = power_supply_set_property(psy, prop, &value);
/* david@bsp modified */
if (ret)
return -EINVAL;
@ -2343,7 +2344,7 @@ static void dashchg_fw_update(struct work_struct *work)
__pm_relax(di->fastchg_update_fireware_lock);
set_property_on_smbcharger(POWER_SUPPLY_PROP_SWITCH_DASH, true);
di->dash_firmware_ok = 1;
pr_info("FW check success\n");
pr_info("FW check success\n"); /* david@bsp add log */
return;
}
#ifdef OP_SWARP_SUPPORTED

View File

@ -76,11 +76,11 @@ struct pm_qos_request pm_qos_req_vb;
#define ABS(x) ((x) < 0 ? (-x) : (x))
#ifdef CONFIG_ARCH_LITO
#define AW8697_LONG_INDEX_HEAD 108
#define FACTORY_MODE_AT_MODE_RTP_NUMBER 133
#define AW8697_LONG_INDEX_HEAD 94
#define FACTORY_MODE_AT_MODE_RTP_NUMBER 119
#else
#define AW8697_LONG_INDEX_HEAD 113
#define FACTORY_MODE_AT_MODE_RTP_NUMBER 138
#define AW8697_LONG_INDEX_HEAD 100
#define FACTORY_MODE_AT_MODE_RTP_NUMBER 125
#endif
#define HAL_FACTORY_MODE_NORMAL_RTP_NUMBER 888
@ -91,9 +91,9 @@ struct pm_qos_request pm_qos_req_vb;
*
******************************************************/
#ifdef CONFIG_ARCH_LITO
#define FACTORY_MODE_EFFECT_NUMBER 97
#define FACTORY_MODE_EFFECT_NUMBER 84
#else
#define FACTORY_MODE_EFFECT_NUMBER 102
#define FACTORY_MODE_EFFECT_NUMBER 89
#endif
#ifdef CONFIG_ARCH_LITO
@ -232,19 +232,6 @@ static char aw8697_rtp_name[][AW8697_RTP_NAME_MAX] = {
{"alarm_tactfully_RTP.bin"},
{"alarm_The_wind_RTP.bin"},
{"alarm_Walking_in_the_rain_RTP.bin"},
{"BoHaoPanAnJian.bin"},
{"BoHaoPanAnNiu.bin"},
{"BoHaoPanKuaiJie.bin"},
{"DianHuaGuaDuan.bin"},
{"DianJinMoShiQieHuan.bin"},
{"HuaDongTiaoZhenDong.bin"},
{"LeiShen.bin"},
{"XuanZhongYouXi.bin"},
{"YeJianMoShiDaZi.bin"},
{"YouXiSheZhiKuang.bin"},
{"ZhuanYeMoShi.bin"},
{"Climber_RTP.bin"},//alarm Climber_RTP
{"Chase_RTP.bin"},//alarm chase
#ifdef CONFIG_ARCH_LITO
{"alarm_Dawn_RTP.bin"},
#else

View File

@ -442,8 +442,10 @@ static struct device_attribute power_supply_attrs[] = {
POWER_SUPPLY_ATTR(parallel_disable),
POWER_SUPPLY_ATTR(pe_start),
POWER_SUPPLY_ATTR(soc_reporting_ready),
#ifdef VENDOR_EDIT
POWER_SUPPLY_ATTR(soc_notify_ready),
POWER_SUPPLY_ATTR(restore_soc),
#endif
POWER_SUPPLY_ATTR(debug_battery),
POWER_SUPPLY_ATTR(fcc_delta),
POWER_SUPPLY_ATTR(icl_reduction),

View File

@ -6,12 +6,13 @@
#ifndef __QG_CORE_H__
#define __QG_CORE_H__
#ifdef VENDOR_EDIT
#define qg_debug(fmt, ...) \
printk(KERN_NOTICE "[OPLUS_CHG][%s]"fmt, __func__, ##__VA_ARGS__)
#define qg_err(fmt, ...) \
printk(KERN_ERR "[OPLUS_CHG][%s]"fmt, __func__, ##__VA_ARGS__)
#endif
#include <linux/kernel.h>
#include "fg-alg.h"
#include "qg-defs.h"
@ -149,7 +150,9 @@ struct qpnp_qg {
bool charge_full;
bool force_soc;
bool fvss_active;
#ifdef VENDOR_EDIT
bool enable_qpnp_qg;
#endif
bool tcss_active;
bool bass_active;
int charge_status;
@ -213,7 +216,11 @@ struct qpnp_qg {
/* ttf */
struct ttf *ttf;
#ifdef VENDOR_EDIT
int skip_scale_soc_count;
#endif
#ifdef VENDOR_EDIT
int atl_4_45_battery_id_low;
int atl_4_45_battery_id_high;
int atl_4_4_battery_id_low;
@ -226,11 +233,14 @@ struct qpnp_qg {
int lw_battery_id_high;
int cl_battery_id_low;
int cl_battery_id_high;
#endif
#ifdef VENDOR_EDIT
int batt_info[6];
int batt_info_id;
bool *batt_range_ocv;
int *batt_range_pct;
#endif
};

View File

@ -363,9 +363,10 @@ int qg_write_monotonic_soc(struct qpnp_qg *chip, int msoc)
return rc;
}
#ifdef VENDOR_EDIT
int g_oplus_qg_ibta;
extern bool is_batt_id_valid(struct qpnp_qg *chip);
#endif
int qg_get_battery_temp(struct qpnp_qg *chip, int *temp)
{
int rc = 0;

View File

@ -41,6 +41,7 @@
#include "qg-battery-profile.h"
#include "qg-defs.h"
#include <linux/proc_fs.h>
#ifdef VENDOR_EDIT
#include "../../../oneplus/power/oplus_chg/oplus_gauge.h"
#include "../../../oneplus/power/oplus_chg/oplus_charger.h"
#include <linux/oem/boot_mode.h>
@ -48,11 +49,13 @@
static bool use_qpnp_qg = true;
static struct qpnp_qg *the_chip;
#endif
#ifdef VENDOR_EDIT
bool is_batt_id_valid(struct qpnp_qg *chip);
extern int oplus_chg_get_ffc_status(void);
extern bool oplus_warp_get_fastchg_ing(void);
#endif
#ifdef OEM_TARGET_PRODUCT_EBBA
#include <linux/hardware_info.h>
@ -166,6 +169,11 @@ static bool is_battery_present(struct qpnp_qg *chip)
#define DEBUG_BATT_ID_HIGH 8500
static bool is_debug_batt_id(struct qpnp_qg *chip)
{
#ifndef VENDOR_EDIT
if (is_between(DEBUG_BATT_ID_LOW, DEBUG_BATT_ID_HIGH,
chip->batt_id_ohm))
return true;
#endif
return false;
}
@ -2645,12 +2653,14 @@ static int qg_battery_status_update(struct qpnp_qg *chip)
pr_err("Failed to get battery-present, rc=%d\n", rc);
goto done;
}
#ifdef VENDOR_EDIT
if (prop.intval) {
//battery present
if (!is_batt_id_valid(chip)) {
prop.intval = 0;
}
}
#endif
if (chip->battery_missing && prop.intval) {
pr_warn("Battery inserted!\n");
rc = qg_handle_battery_insertion(chip);
@ -3047,6 +3057,7 @@ static int get_batt_id_ohm(struct qpnp_qg *chip, u32 *batt_id_ohm)
return 0;
}
#ifdef VENDOR_EDIT
static int get_batt_id_voltage(struct qpnp_qg *chip)
{
int rc, batt_id_mv;
@ -3114,6 +3125,7 @@ bool is_batt_id_valid(struct qpnp_qg *chip)
else
return true;
}
#endif
static int qg_load_battery_profile(struct qpnp_qg *chip)
{
struct device_node *node = chip->dev->of_node;
@ -4806,6 +4818,7 @@ static const struct dev_pm_ops qpnp_qg_pm_ops = {
.suspend = qpnp_qg_suspend,
.resume = qpnp_qg_resume,
};
#ifdef VENDOR_EDIT
#define DEFAULT_BATT_TEMP -400
#define DEFAULT_BATT_VOLT 3800
#define DEFAULT_BATT_SOC 50
@ -5100,13 +5113,16 @@ void bq27541_force_update_current(bool enable)
pr_info("houston force update current.");
}
#endif
#endif
static int qpnp_qg_probe(struct platform_device *pdev)
{
int rc = 0, soc = 0, nom_cap_uah;
struct qpnp_qg *chip;
#ifdef VENDOR_EDIT
struct oplus_gauge_chip *the_oplus_gauge_chip = NULL;
#endif
chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
@ -5299,6 +5315,7 @@ static int qpnp_qg_probe(struct platform_device *pdev)
pr_err("Failed in qg_post_init rc=%d\n", rc);
goto fail_votable;
}
#ifdef VENDOR_EDIT
the_chip = chip;
if (use_qpnp_qg) {
the_oplus_gauge_chip = devm_kzalloc(chip->dev,
@ -5314,6 +5331,7 @@ static int qpnp_qg_probe(struct platform_device *pdev)
}
}
init_proc_qg_vbat();
#endif
rc = sysfs_create_groups(&chip->dev->kobj, qg_groups);
if (rc < 0) {

View File

@ -603,6 +603,8 @@ static int smb5_parse_dt_misc(struct smb5 *chip, struct device_node *node)
chg->FFC_NOR_FCC, chg->FFC_WARM_FCC, chg->FFC_NORMAL_CUTOFF,
chg->FFC_WARM_CUTOFF, chg->FFC_VBAT_FULL);
/* @bsp, 2019/07/05 Battery & Charging porting */
/* read ibatmax setting for different temp regions */
OF_PROP_READ(node, "ibatmax-little-cold-ma",
chg->ibatmax[BATT_TEMP_LITTLE_COLD], retval, 1);
OF_PROP_READ(node, "ibatmax-cool-ma",
@ -797,13 +799,14 @@ static int smb5_parse_dt_misc(struct smb5 *chip, struct device_node *node)
chg->OTG_LOW_BAT,
chg->OTG_LOW_BAT_ICL,
chg->OTG_NORMAL_BAT_ICL);
/* @bsp, 2018/07/26 enable stm6620 sheepmode */
chg->shipmode_en = of_get_named_gpio_flags(node,
"op,stm-ctrl-gpio", 0, &flags);
chg->vbus_ctrl = of_get_named_gpio_flags(node,
"op,vbus-ctrl-gpio", 0, &flags);
chg->plug_irq = of_get_named_gpio_flags(node,
"op,usb-check", 0, &flags);
/* @bsp, 2019/06/28 vph sel set disable */
chg->vph_sel_disable = of_property_read_bool(node,
"vph-sel-disable");
/* read other settings */
@ -4678,6 +4681,7 @@ static void smb5_create_debugfs(struct smb5 *chip)
#endif
/* @bsp, 2020/06/05 Battery & Charging add for skin_thermal online config */
static ssize_t proc_skin_threld_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
@ -4764,6 +4768,7 @@ static const struct file_operations proc_skin_threld_ops = {
.owner = THIS_MODULE,
};
/* @bsp, 2020/06/05 Battery & Charging add for skin_thermal online config */
static ssize_t proc_skin_lcdoff_threld_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
@ -5034,7 +5039,7 @@ static int create_skin_thermal_proc(void)
pr_err("Failed to register norchg_lcdoff_thd proc interface\n");
return 0;
}
/* @bsp, 2019/07/06 Battery & Charging porting */
#ifdef CONFIG_PROC_FS
static ssize_t write_ship_mode(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
@ -5053,6 +5058,7 @@ static const struct file_operations proc_ship_mode_operations = {
};
#endif
/* @bsp, 2018/07/26 Enable external stm6620 ship mode*/
static int op_ship_mode_gpio_request(struct smb_charger *chip)
{
int rc;
@ -5095,6 +5101,7 @@ static int op_ship_mode_gpio_request(struct smb_charger *chip)
}
/* @bsp 2018/07/30 add usb connector temp detect and wr*/
void requset_vbus_ctrl_gpio(struct smb_charger *chg)
{
int ret;

View File

@ -9,9 +9,11 @@
#include <linux/bitops.h>
#ifdef VENDOR_EDIT
#ifdef CONFIG_OPLUS_SM7225R_CHARGER
#include "../../../oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.h"
#endif
#endif
#define SCHGM_FLASH_BASE 0xA600

View File

@ -1026,6 +1026,7 @@ static int op_set_wireless_fsw(struct smb_charger *chg, int voltage)
return rc;
}
/* @bsp, 2019/08/30 Wireless Charging porting */
int op_wireless_high_vol_en(bool enable)
{
int rc;
@ -2274,6 +2275,7 @@ static int smblib_chg_disable_vote_callback(struct votable *votable, void *data,
return 0;
}
#endif
/* @bsp, 2019/07/05 Battery & Charging porting */
rc = smblib_masked_write(chg, CHARGING_ENABLE_CMD_REG,
CHARGING_ENABLE_CMD_BIT,
chg_disable ? 0 : CHARGING_ENABLE_CMD_BIT);
@ -5617,8 +5619,7 @@ int smblib_set_prop_pd_active(struct smb_charger *chg,
temp_region = op_battery_temp_region_get(chg);
if (temp_region != BATT_TEMP_COLD
&& temp_region != BATT_TEMP_HOT
&& chg->typec_mode != POWER_SUPPLY_TYPEC_SINK_POWERED_CABLE
&& !chg->chg_done) {
&& chg->typec_mode != POWER_SUPPLY_TYPEC_SINK_POWERED_CABLE) {
op_charging_en(chg, true);
}
}
@ -5632,15 +5633,21 @@ int smblib_set_prop_pd_active(struct smb_charger *chg,
* It is guaranteed that pd_active is set prior to
* pd_current_max
*/
/* @bsp, 2019/09/20 Wireless Charge otg support */
if (!chg->wireless_present)
vote(chg->usb_icl_votable, PD_VOTER, true, USBIN_100MA);
vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0);
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, false, 0);
/*
* @bsp add to fix wrong charging current when boot with
* pd cable connected, clear apsd current result.
*/
vote(chg->fcc_votable, FCC_STEPPER_VOTER, false, 0);
vote(chg->fcc_votable, HW_LIMIT_VOTER, false, 0);
vote(chg->usb_icl_votable, DCP_VOTER, false, 0);
vote(chg->fcc_votable, BATT_PROFILE_VOTER, false, 0);
/* @bsp, add to set allow read extern fg IIC */
set_property_on_fg(chg,
POWER_SUPPLY_PROP_SET_ALLOW_READ_EXTERN_FG_IIC, true);
@ -6563,17 +6570,17 @@ void smblib_usb_plugin_hard_reset_locked(struct smb_charger *chg)
/* Remove FCC_STEPPER 1.5A init vote to allow FCC ramp up */
if (chg->fcc_stepper_enable)
vote(chg->fcc_votable, FCC_STEPPER_VOTER, false, 0);
/* @bsp add to fix some pd temp not update issue */
if (gpio_is_valid(chg->vbus_ctrl))
schedule_delayed_work(&chg->connecter_check_work,
msecs_to_jiffies(200));
/* @bsp, 2019/09/20 Wireless Charge otg support */
if (chg->wireless_present) {
vote(chg->usb_icl_votable, OTG_VOTER, false, 0);
if (chg->pd_active)
vote(chg->usb_icl_votable, PD_VOTER, false, 0);
}
/* @bsp, 2019/09/20 Wireless Charge otg support end*/
if (chg->swarp_supported) {
chg->sw_aicl_prepared = false;
cancel_delayed_work(&chg->run_sw_aicl_work);
@ -6598,7 +6605,7 @@ void smblib_usb_plugin_hard_reset_locked(struct smb_charger *chg)
if (chg->fcc_stepper_enable)
vote(chg->fcc_votable, FCC_STEPPER_VOTER,
true, 1500000);
/* @bsp, fix the suspend current issue */
if (!chg->wireless_present) {
rc = smblib_request_dpdm(chg, false);
if (rc < 0)
@ -6607,7 +6614,7 @@ void smblib_usb_plugin_hard_reset_locked(struct smb_charger *chg)
if ((chg->sink_src_mode == SRC_MODE) && !chg->is_audio_adapter)
vote(chg->usb_icl_votable, OTG_VOTER, true, 0);
}
/* @bsp add for wake lock check*/
if (last_vbus_present != chg->vbus_present) {
pr_info("vbus_rising 0");
if (chg->swarp_online) {
@ -6687,6 +6694,7 @@ void smblib_usb_plugin_locked(struct smb_charger *chg)
smblib_hvdcp_detect_enable(chg, false);
/* @bsp, 2019/07/05 Battery & Charging porting */
chg->vbus_present = vbus_rising;
if (vbus_rising) {
cancel_delayed_work_sync(&chg->pr_swap_detach_work);
@ -7149,7 +7157,7 @@ static void smblib_handle_apsd_done(struct smb_charger *chg, bool rising)
smblib_set_prop_charge_parameter_set(chg);
temp_region = op_battery_temp_region_get(chg);
if (temp_region != BATT_TEMP_COLD
&& temp_region != BATT_TEMP_HOT && !chg->chg_done) {
&& temp_region != BATT_TEMP_HOT) {
op_charging_en(chg, true);
}
@ -8500,6 +8508,7 @@ irqreturn_t temp_change_irq_handler(int irq, void *data)
return IRQ_HANDLED;
}
/* @bsp, 2019/07/05 Battery & Charging porting START */
static void op_get_aicl_work(struct work_struct *work)
{
struct smb_charger *chg = container_of(work, struct smb_charger,
@ -8516,6 +8525,7 @@ static void op_get_aicl_work(struct work_struct *work)
pr_err("AICL result=%dmA\n", settled_ua / 1000);
}
/* @bsp 2018/07/30 add usb connector temp detect */
#define THIRD_LOOP_ENTER_MINI_THRESHOLD 35
#define THIRD_LOOP_ENTER_MAX_THRESHOLD 60
#define THIRD_INTERVAL_MINI_THRESHOLD 8
@ -8682,6 +8692,7 @@ static void op_connecter_recovery_charge_work(struct work_struct *work)
msecs_to_jiffies(CONNECTER_RECOVERY_CHECK_INTERVAL));
}
/* @bsp, 2020/08/30 add pd/qc/warp30 skin thermal check */
static void norchg_check_skin_thermal_temp(struct smb_charger *chg)
{
bool call_on;
@ -8957,16 +8968,15 @@ static void op_set_pd_active_work(struct work_struct *work)
temp_region_now = op_battery_temp_region_get(chg);
if (temp_region_now != BATT_TEMP_COLD
&& temp_region_now != BATT_TEMP_HOT
&& chg->typec_mode != POWER_SUPPLY_TYPEC_SINK_POWERED_CABLE
&& !chg->chg_done) {
&& chg->typec_mode != POWER_SUPPLY_TYPEC_SINK_POWERED_CABLE) {
op_charging_en(chg, true);
}
}
/* @bsp, 2020/08/04, add to detect SVID */
void op_set_swarp_charger(struct smb_charger *chg)
{
chg->real_charger_type = POWER_SUPPLY_TYPE_DASH;
chg->dash_present = true;
enhance_dash_type_set(CHARGER_SWARP_65W);
}
@ -10178,6 +10188,7 @@ static void op_check_allow_switch_dash_work(struct work_struct *work)
return;
if (chg->usb_enum_status)
return;
/* @bsp, 2019/08/30 Wireless Charging porting */
if (chg->wireless_present)
return;
if (chg->apsd_delayed)
@ -10268,6 +10279,7 @@ static int update_adapter_sid(unsigned int sid)
return 0;
}
/*yangfb@bsp, 20181023 icl set 1A if battery lower than 15%*/
static void op_otg_icl_contrl(struct smb_charger *chg)
{
int cap, rc;
@ -11223,6 +11235,7 @@ void op_charge_info_init(struct smb_charger *chg)
chg->non_std_chg_present = false;
chg->is_audio_adapter = false;
chg->init_irq_done = false;
/* @bsp, 2019/08/30 Wireless Charging porting */
chg->wireless_present = false;
chg->apsd_delayed = false;
chg->apsd_not_done = false;
@ -11420,6 +11433,7 @@ static void op_check_charger_uovp(struct smb_charger *chg, int vchg_mv)
if (!chg->vbus_present)
return;
/* @bsp, 2019/08/30 Wireless Charging porting */
if (chg->wireless_present)
return;
@ -12044,8 +12058,6 @@ static bool op_check_vbat_is_full_by_sw(struct smb_charger *chg)
icharging = get_prop_batt_current_now(chg) / 1000;
/* use SW Vfloat to check */
if (batt_volt > vbatt_full_vol_sw) {
pr_err("vbat(%d) > full_vol_sw(%d), icharging:%d",
batt_volt, vbatt_full_vol_sw, icharging);
if (icharging < 0 && (icharging * -1) <= term_current) {
vbat_counts_sw++;
if (vbat_counts_sw > FULL_COUNTS_SW * chg->full_count_sw_num) {
@ -12172,6 +12184,7 @@ static void check_non_standard_charger_work(struct work_struct *work)
return;
}
/* @bsp, 2019/08/30 Wireless Charging porting */
if (chg->wireless_present) {
pr_info("chk_non_std_chger,wireless_present\n");
chg->non_stand_chg_count = 0;
@ -12601,6 +12614,7 @@ int op_get_allowed_current_max(void)
cur_stage = 0;
return cur_max[cur_stage];
}
/* @bsp 2018/07/30 add usb connector temp detect and wr*/
#define USB_CONNECTOR_DEFAULT_TEMP 25
static int get_usb_temp(struct smb_charger *chg)
{
@ -12695,6 +12709,7 @@ void op_disconnect_vbus(struct smb_charger *chg, bool enable)
return;
}
#ifdef CONFIG_OP_DEBUG_CHG
/* *#806# aging test not need Vbus disconnect feature*/
return;
#else
if (chg->is_aging_test)
@ -12778,6 +12793,7 @@ static void op_otg_switch(struct work_struct *work)
usb_pluged = gpio_get_value(g_chg->plug_irq) ? false : true;
if (usb_pluged == g_chg->pre_cable_pluged) {
pr_info("same status,return;usb_present:%d\n", usb_pluged);
/* @bsp, add to disable CC detection after OTG detached */
if (usb_pluged) {
vote(g_chg->otg_toggle_votable, HW_DETECT_VOTER, 1, 0);
if (user_vote_enable && wireless_present)
@ -12840,6 +12856,7 @@ static void op_heartbeat_work(struct work_struct *work)
int vbatdet_mv;
int rc;
/*yangfb@bsp, 20181023 icl set 1A if battery lower than 15%*/
op_otg_icl_contrl(chg);
#ifndef CONFIG_OP_DEBUG_CHG
op_check_charge_timeout(chg);
@ -13404,7 +13421,7 @@ static int notify_usb_enumeration_function(int status)
static struct notify_usb_enumeration_status usb_enumeration = {
.notify_usb_enumeration = notify_usb_enumeration_function,
};
/* @bsp, 2018/07/13 Battery & Charging porting ENDIF*/
static void smblib_usbov_dbc_work(struct work_struct *work)
{
struct smb_charger *chg = container_of(work, struct smb_charger,

View File

@ -169,7 +169,7 @@ enum {
#ifdef OPLUS_FEATURE_CHG_BASIC
#define DCDC_OTG_CURRENT_LIMIT_1000MA_BIT BIT(2)
#endif
#endif /* VENDOR_EDIT */
#define DCDC_OTG_CFG_REG (DCDC_BASE + 0x53)
#define OTG_EN_SRC_CFG_BIT BIT(1)

View File

@ -26,9 +26,11 @@
#include <linux/usb/usbpd.h>
#include "usbpd.h"
#ifdef VENDOR_EDIT
static bool usb_compliance_mode;
module_param(usb_compliance_mode, bool, 0644);
MODULE_PARM_DESC(usb_compliance_mode, "USB3.1 compliance testing");
#endif
enum usbpd_state {
PE_UNKNOWN,
@ -385,7 +387,9 @@ struct usbpd {
struct workqueue_struct *wq;
struct work_struct sm_work;
struct work_struct start_periph_work;
#ifdef VENDOR_EDIT
struct delayed_work vbus_work;
#endif
struct hrtimer timer;
bool sm_queued;
@ -408,7 +412,9 @@ struct usbpd {
int requested_current; /* mA */
bool pd_connected;
bool in_explicit_contract;
#ifdef VENDOR_EDIT
bool in_good_connect;
#endif
bool peer_usb_comm;
bool peer_pr_swap;
bool peer_dr_swap;
@ -489,9 +495,11 @@ struct usbpd {
};
static LIST_HEAD(_usbpd); /* useful for debugging */
#ifdef VENDOR_EDIT
static int peripheral_enabled = 1;
int oplus_usbpd_send_svdm(u16 svid, u8 cmd, enum usbpd_svdm_cmd_type cmd_type,
int obj_pos, const u32 *vdos, int num_vdos);
#endif
static const unsigned int usbpd_extcon_cable[] = {
EXTCON_USB,
@ -581,9 +589,11 @@ static inline void start_usb_peripheral(struct usbpd *pd)
{
enum plug_orientation cc = usbpd_get_plug_orientation(pd);
union extcon_property_value val;
#ifdef VENDOR_EDIT
if (peripheral_enabled == 0) {
return;
}
#endif
val.intval = (cc == ORIENTATION_CC2);
extcon_set_property(pd->extcon, EXTCON_USB,
EXTCON_PROP_USB_TYPEC_POLARITY, val);
@ -875,7 +885,9 @@ static int pd_select_pdo(struct usbpd *pd, int pdo_pos, int uv, int ua)
return 0;
}
#ifdef VENDOR_EDIT
extern void oplus_set_opluschg_pd_sdp(bool value);
#endif
static int pd_eval_src_caps(struct usbpd *pd)
{
@ -915,10 +927,12 @@ static int pd_eval_src_caps(struct usbpd *pd)
power_supply_set_property(pd->usb_psy,
POWER_SUPPLY_PROP_PD_ACTIVE, &val);
#ifdef VENDOR_EDIT
if (pd->peer_usb_comm && pd->current_dr == DR_UFP && !pd->pd_connected) {
printk("set opluschg_pd_sdp = true\n");
oplus_set_opluschg_pd_sdp(true);
}
#endif
/* First time connecting to a PD source and it supports USB data */
if (pd->peer_usb_comm && pd->current_dr == DR_UFP && !pd->pd_connected)
start_usb_peripheral(pd);
@ -1373,11 +1387,13 @@ int usbpd_send_vdm(struct usbpd *pd, u32 vdm_hdr, const u32 *vdos, int num_vdos)
kfree(pd->vdm_tx);
pd->vdm_tx = NULL;
}
#ifdef VENDOR_EDIT
if (pd->current_state != PE_SRC_READY &&
pd->current_state != PE_SNK_READY) {
usbpd_err(&pd->dev, "VDM not allowed: PD not in Ready state\n");
return -EAGAIN;
}
#endif
vdm_tx = kzalloc(sizeof(*vdm_tx), GFP_KERNEL);
if (!vdm_tx)
@ -1966,10 +1982,12 @@ static void vconn_swap(struct usbpd *pd)
pd->vconn_enabled = true;
#ifndef VENDOR_EDIT
#else
pd_phy_update_frame_filter(FRAME_FILTER_EN_SOP |
FRAME_FILTER_EN_SOPI |
FRAME_FILTER_EN_HARD_RESET);
#endif
/*
* Small delay to ensure Vconn has ramped up. This is well
* below tVCONNSourceOn (100ms) so we still send PS_RDY within
@ -2136,7 +2154,8 @@ static int usbpd_startup_common(struct usbpd *pd,
phy_params->data_role = pd->current_dr;
phy_params->power_role = pd->current_pr;
#ifndef VENDOR_EDIT
#endif
ret = pd_phy_open(phy_params);
if (ret) {
@ -2533,7 +2552,9 @@ static void enter_state_hard_reset(struct usbpd *pd)
pd_send_hard_reset(pd);
pd->in_explicit_contract = false;
#ifdef VENDOR_EDIT
pd->in_good_connect = false;
#endif
pd->rdo = 0;
rx_msg_cleanup(pd);
reset_vdm_state(pd);
@ -2858,9 +2879,11 @@ static void handle_state_snk_transition_sink(struct usbpd *pd,
static void enter_state_snk_ready(struct usbpd *pd)
{
pd->in_explicit_contract = true;
#ifdef VENDOR_EDIT
pd->in_good_connect = true;
oplus_usbpd_send_svdm(USBPD_SID, USBPD_SVDM_DISCOVER_SVIDS,
SVDM_CMD_TYPE_INITIATOR, 0, NULL, 0);
#endif
if (pd->vdm_tx)
kick_sm(pd, 0);
@ -3460,7 +3483,9 @@ static void handle_disconnect(struct usbpd *pd)
pd->in_pr_swap = false;
pd->pd_connected = false;
pd->in_explicit_contract = false;
#ifdef VENDOR_EDIT
pd->in_good_connect = false;
#endif
pd->hard_reset_recvd = false;
pd->caps_count = 0;
pd->hard_reset_count = 0;
@ -3552,7 +3577,9 @@ static void handle_hard_reset(struct usbpd *pd)
POWER_SUPPLY_PROP_PR_SWAP, &val);
pd->in_explicit_contract = false;
#ifdef VENDOR_EDIT
pd->in_good_connect = false;
#endif
pd->selected_pdo = pd->requested_pdo = 0;
pd->rdo = 0;
rx_msg_cleanup(pd);
@ -3731,7 +3758,9 @@ static int usbpd_process_typec_mode(struct usbpd *pd,
return 1; /* kick state machine */
}
#ifdef VENDOR_EDIT
static int pre_real_charger_type = -1;
#endif
static int psy_changed(struct notifier_block *nb, unsigned long evt, void *ptr)
{
struct usbpd *pd = container_of(nb, struct usbpd, psy_nb);
@ -3769,6 +3798,7 @@ static int psy_changed(struct notifier_block *nb, unsigned long evt, void *ptr)
ret);
return ret;
}
#ifdef VENDOR_EDIT
if (val.intval == POWER_SUPPLY_TYPE_USB ||
val.intval == POWER_SUPPLY_TYPE_USB_CDP ||
val.intval == POWER_SUPPLY_TYPE_USB_FLOAT ||
@ -3778,17 +3808,31 @@ static int psy_changed(struct notifier_block *nb, unsigned long evt, void *ptr)
pd->typec_mode = typec_mode;
queue_work(pd->wq, &pd->start_periph_work);
}
#else
if (val.intval == POWER_SUPPLY_TYPE_USB ||
val.intval == POWER_SUPPLY_TYPE_USB_CDP ||
val.intval == POWER_SUPPLY_TYPE_USB_FLOAT) {
usbpd_dbg(&pd->dev, "typec mode:%d type:%d\n",
typec_mode, val.intval);
pd->typec_mode = typec_mode;
queue_work(pd->wq, &pd->start_periph_work);
}
#endif
#ifdef VENDOR_EDIT
else if ((val.intval == POWER_SUPPLY_TYPE_USB_DCP) && (pre_real_charger_type == POWER_SUPPLY_TYPE_USB)) {
stop_usb_peripheral(pd);
}
pre_real_charger_type = val.intval;
#endif
return 0;
}
#ifdef VENDOR_EDIT
if (usb_compliance_mode) {
usbpd_err(&pd->dev, "start usb peripheral for testing");
///start_usb_peripheral(pd);
}
#endif
ret = power_supply_get_property(pd->usb_psy,
POWER_SUPPLY_PROP_PRESENT, &val);
@ -4540,6 +4584,7 @@ static ssize_t get_battery_status_show(struct device *dev,
return scnprintf(buf, PAGE_SIZE, "0x%08x\n", pd->battery_sts_dobj);
}
static DEVICE_ATTR_RW(get_battery_status);
#ifdef VENDOR_EDIT
struct usbpd *pd_lobal;
unsigned int pd_vbus_ctrl;
@ -4617,6 +4662,7 @@ static ssize_t pd_vbus_store(struct device *dev,
return size;
}
static DEVICE_ATTR_RW(pd_vbus);
#endif
static struct attribute *usbpd_attrs[] = {
&dev_attr_contract.attr,
@ -4642,7 +4688,9 @@ static struct attribute *usbpd_attrs[] = {
&dev_attr_get_pps_status.attr,
&dev_attr_get_battery_cap.attr,
&dev_attr_get_battery_status.attr,
#ifdef VENDOR_EDIT
&dev_attr_pd_vbus.attr,
#endif
NULL,
};
ATTRIBUTE_GROUPS(usbpd);
@ -4719,6 +4767,7 @@ static void usbpd_release(struct device *dev)
kfree(pd);
}
#ifdef VENDOR_EDIT
struct usbpd *pd_lobal;
int oplus_usbpd_send_svdm(u16 svid, u8 cmd, enum usbpd_svdm_cmd_type cmd_type,
int obj_pos, const u32 *vdos, int num_vdos)
@ -4824,6 +4873,7 @@ out:
return rc;
}
EXPORT_SYMBOL(oplus_pdo_select);
#endif /*VENDOR_EDIT*/
static int num_pd_instances;
@ -5009,7 +5059,9 @@ struct usbpd *usbpd_create(struct device *parent)
/* force read initial power_supply values */
psy_changed(&pd->psy_nb, PSY_EVENT_PROP_CHANGED, pd->usb_psy);
#ifdef VENDOR_EDIT
pd_lobal = pd;
#endif
return pd;

View File

@ -46,6 +46,7 @@ enum pon_power_off_type {
PON_POWER_OFF_MAX_TYPE = 0x10,
};
/* @bsp, 20190705 Battery & Charging porting */
struct qpnp_pon {
struct device *dev;
struct regmap *regmap;

View File

@ -421,6 +421,7 @@ enum power_supply_property {
POWER_SUPPLY_PROP_ADAPTER_SID,
/* @bsp, 2020/03/22 No need to show in sysfs */
POWER_SUPPLY_PROP_VBATDET,
POWER_SUPPLY_PROP_OTG_OCL,
POWER_SUPPLY_PROP_HWTERM,

View File

@ -1,8 +0,0 @@
#ifndef _UFSTW_FS_H_
#define _UFSTW_FS_H_
#if defined(CONFIG_UFSTW)
extern void bdev_set_turbo_write(struct block_device *bdev);
extern void bdev_clear_turbo_write(struct block_device *bdev);
#endif
#endif

View File

@ -31,6 +31,5 @@ $(obj)/version.o: include/generated/compile.h
silent_chk_compile.h = :
include/generated/compile.h: FORCE
@$($(quiet)chk_compile.h)
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \
"$(CC) $(KBUILD_CFLAGS)" "$(LD)"
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)"

View File

@ -182,9 +182,6 @@ struct task_struct init_task
#ifdef CONFIG_SECURITY
.security = NULL,
#endif
#ifdef CONFIG_RATP
.cpus_suggested = CPU_MASK_ALL,
#endif
};
EXPORT_SYMBOL(init_task);

View File

@ -133,7 +133,6 @@ void (*__initdata late_time_init)(void);
char __initdata boot_command_line[COMMAND_LINE_SIZE];
/* Untouched saved command line (eg. for /proc) */
char *saved_command_line;
EXPORT_SYMBOL_GPL(saved_command_line);
/* Command line for parameter parsing */
static char *static_command_line;
/* Command line for per-initcall parameter parsing */
@ -543,8 +542,6 @@ static void __init mm_init(void)
page_ext_init_flatmem();
report_meminit();
mem_init();
/* page_owner must be initialized after buddy is ready */
page_ext_init_flatmem_late();
kmem_cache_init();
pgtable_init();
vmalloc_init();
@ -770,8 +767,6 @@ asmlinkage __visible void __init start_kernel(void)
/* Do the rest non-__init'ed, we're now alive */
rest_init();
prevent_tail_call_optimization();
}
/* Call all constructor functions linked into the kernel. */

View File

@ -46,9 +46,6 @@ const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
const char *linux_banner_ptr = linux_banner;
EXPORT_SYMBOL_GPL(linux_banner_ptr);
const char linux_proc_banner[] =
"%s version %s"
" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"

View File

@ -76,7 +76,6 @@ struct mqueue_inode_info {
struct sigevent notify;
struct pid *notify_owner;
u32 notify_self_exec_id;
struct user_namespace *notify_user_ns;
struct user_struct *user; /* user who created, for accounting */
struct sock *notify_sock;
@ -663,44 +662,28 @@ static void __do_notify(struct mqueue_inode_info *info)
* synchronously. */
if (info->notify_owner &&
info->attr.mq_curmsgs == 1) {
struct siginfo sig_i;
switch (info->notify.sigev_notify) {
case SIGEV_NONE:
break;
case SIGEV_SIGNAL: {
struct siginfo sig_i;
struct task_struct *task;
/* do_mq_notify() accepts sigev_signo == 0, why?? */
if (!info->notify.sigev_signo)
break;
case SIGEV_SIGNAL:
/* sends signal */
clear_siginfo(&sig_i);
sig_i.si_signo = info->notify.sigev_signo;
sig_i.si_errno = 0;
sig_i.si_code = SI_MESGQ;
sig_i.si_value = info->notify.sigev_value;
rcu_read_lock();
/* map current pid/uid into info->owner's namespaces */
rcu_read_lock();
sig_i.si_pid = task_tgid_nr_ns(current,
ns_of_pid(info->notify_owner));
sig_i.si_uid = from_kuid_munged(info->notify_user_ns,
current_uid());
/*
* We can't use kill_pid_info(), this signal should
* bypass check_kill_permission(). It is from kernel
* but si_fromuser() can't know this.
* We do check the self_exec_id, to avoid sending
* signals to programs that don't expect them.
*/
task = pid_task(info->notify_owner, PIDTYPE_TGID);
if (task && task->self_exec_id ==
info->notify_self_exec_id) {
do_send_sig_info(info->notify.sigev_signo,
&sig_i, task, PIDTYPE_TGID);
}
sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid());
rcu_read_unlock();
kill_pid_info(info->notify.sigev_signo,
&sig_i, info->notify_owner);
break;
}
case SIGEV_THREAD:
set_cookie(info->notify_cookie, NOTIFY_WOKENUP);
netlink_sendskb(info->notify_sock, info->notify_cookie);
@ -1290,7 +1273,6 @@ retry:
info->notify.sigev_signo = notification->sigev_signo;
info->notify.sigev_value = notification->sigev_value;
info->notify.sigev_notify = SIGEV_SIGNAL;
info->notify_self_exec_id = current->self_exec_id;
break;
}

View File

@ -735,21 +735,21 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
total++;
}
ipc = NULL;
if (total >= ids->in_use)
goto out;
return NULL;
for (; pos < IPCMNI; pos++) {
ipc = idr_find(&ids->ipcs_idr, pos);
if (ipc != NULL) {
*new_pos = pos + 1;
rcu_read_lock();
ipc_lock_object(ipc);
break;
return ipc;
}
}
out:
*new_pos = pos + 1;
return ipc;
/* Out of range - return NULL to terminate iteration */
return NULL;
}
static void *sysvipc_proc_next(struct seq_file *s, void *it, loff_t *pos)

View File

@ -31,8 +31,6 @@ always := $(hostprogs-y) $(hostprogs-m)
# The following hostprogs-y programs are only build on demand
hostprogs-y += unifdef
extra-$(CONFIG_LTO_CLANG) += module-lto.lds
# These targets are used internally to avoid "is up to date" messages
PHONY += build_unifdef
build_unifdef: $(obj)/unifdef

View File

@ -7,9 +7,6 @@ myname=${0##*/}
# If no prefix forced, use the default CONFIG_
CONFIG_="${CONFIG_-CONFIG_}"
# We use an uncommon delimiter for sed substitutions
SED_DELIM=$(echo -en "\001")
usage() {
cat >&2 <<EOL
Manipulate options in a .config file from the command line.
@ -86,7 +83,7 @@ txt_subst() {
local infile="$3"
local tmpfile="$infile.swp"
sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile"
sed -e "s:$before:$after:" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}

View File

@ -119,7 +119,7 @@ faultlinenum=$(( $(wc -l $T.oo | cut -d" " -f1) - \
faultline=`cat $T.dis | head -1 | cut -d":" -f2-`
faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'`
cat $T.oo | sed -e "${faultlinenum}s/^\([^:]*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
cat $T.oo | sed -e "${faultlinenum}s/^\(.*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
echo
cat $T.aa
cleanup

View File

@ -22,8 +22,11 @@
#include <linux/slub_def.h>
#include "cam_trace.h"
#ifdef VENDOR_EDIT
#define CAM_REQ_MGR_EVENT_MAX 64
#else
#define CAM_REQ_MGR_EVENT_MAX 30
#endif
static struct cam_req_mgr_device g_dev;
struct kmem_cache *g_cam_req_mgr_timer_cachep;