Skip to content

Commit

Permalink
Merge branch 'android-4.19-stable' of https://android.googlesource.co…
Browse files Browse the repository at this point in the history
…m/kernel/common into oos13.1
  • Loading branch information
ppajda committed May 14, 2024
2 parents e1e88b4 + 5c67c90 commit 737020d
Show file tree
Hide file tree
Showing 67 changed files with 478 additions and 306 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 19
SUBLEVEL = 312
SUBLEVEL = 313
EXTRAVERSION =
NAME = "People's Front"

Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/osf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ put_tv32(struct timeval32 __user *o, struct timespec64 *i)
}

static inline long
put_tv_to_tv32(struct timeval32 __user *o, struct __kernel_old_timeval *i)
put_tv_to_tv32(struct timeval32 __user *o, struct timeval *i)
{
return copy_to_user(o, &(struct timeval32){
.tv_sec = i->tv_sec,
Expand Down
1 change: 0 additions & 1 deletion arch/arc/boot/dts/hsdk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
};

gmac: ethernet@8000 {
#interrupt-cells = <1>;
compatible = "snps,dwmac";
reg = <0x8000 0x2000>;
interrupts = <10>;
Expand Down
7 changes: 2 additions & 5 deletions arch/arm64/boot/dts/mediatek/mt7622.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
clock-names = "hif_sel";
};

cir: cir@10009000 {
cir: ir-receiver@10009000 {
compatible = "mediatek,mt7622-cir";
reg = <0 0x10009000 0 0x1000>;
interrupts = <GIC_SPI 175 IRQ_TYPE_LEVEL_LOW>;
Expand Down Expand Up @@ -459,7 +459,6 @@
<&pericfg CLK_PERI_AUXADC_PD>;
clock-names = "therm", "auxadc";
resets = <&pericfg MT7622_PERI_THERM_SW_RST>;
reset-names = "therm";
mediatek,auxadc = <&auxadc>;
mediatek,apmixedsys = <&apmixedsys>;
nvmem-cells = <&thermal_calibration>;
Expand Down Expand Up @@ -846,9 +845,7 @@
};

eth: ethernet@1b100000 {
compatible = "mediatek,mt7622-eth",
"mediatek,mt2701-eth",
"syscon";
compatible = "mediatek,mt7622-eth";
reg = <0 0x1b100000 0 0x20000>;
interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 224 IRQ_TYPE_LEVEL_LOW>,
Expand Down
29 changes: 22 additions & 7 deletions arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -426,16 +426,22 @@
gpio1830-supply = <&vcc_1v8>;
};

&pmu_io_domains {
status = "okay";
pmu1830-supply = <&vcc_1v8>;
};

&pwm2 {
status = "okay";
&pcie_clkreqn_cpm {
rockchip,pins =
<2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>;
};

&pinctrl {
pinctrl-names = "default";
pinctrl-0 = <&q7_thermal_pin>;

gpios {
q7_thermal_pin: q7-thermal-pin {
rockchip,pins =
<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
};
};

i2c8 {
i2c8_xfer_a: i2c8-xfer {
rockchip,pins =
Expand Down Expand Up @@ -466,6 +472,15 @@
};
};

&pmu_io_domains {
status = "okay";
pmu1830-supply = <&vcc_1v8>;
};

&pwm2 {
status = "okay";
};

&sdhci {
/*
* Signal integrity isn't great at 200MHz but 100MHz has proven stable
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/include/asm/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <asm/mpspec.h>
#include <asm/msr.h>
#include <asm/hardirq.h>
#include <asm/io.h>

#define ARCH_APICTIMER_STOPS_ON_C3 1

Expand Down Expand Up @@ -110,7 +111,7 @@ static inline void native_apic_mem_write(u32 reg, u32 v)

static inline u32 native_apic_mem_read(u32 reg)
{
return *((volatile u32 *)(APIC_BASE + reg));
return readl((void __iomem *)(APIC_BASE + reg));
}

extern void native_apic_wait_icr_idle(void);
Expand Down
1 change: 0 additions & 1 deletion crypto/algapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg)
}

if (!strcmp(q->cra_driver_name, alg->cra_name) ||
!strcmp(q->cra_driver_name, alg->cra_driver_name) ||
!strcmp(q->cra_name, alg->cra_driver_name))
goto err;
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/dma/idma64.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ static irqreturn_t idma64_irq(int irq, void *dev)
u32 status_err;
unsigned short i;

/* Since IRQ may be shared, check if DMA controller is powered on */
if (status == GENMASK(31, 0))
return IRQ_NONE;

dev_vdbg(idma64->dma.dev, "%s: status=%#x\n", __func__, status);

/* Check if we have any interrupt from the DMA controller */
Expand Down
4 changes: 2 additions & 2 deletions drivers/dma/owl-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static void pchan_update(struct owl_dma_pchan *pchan, u32 reg,
else
regval &= ~val;

writel(val, pchan->base + reg);
writel(regval, pchan->base + reg);
}

static void pchan_writel(struct owl_dma_pchan *pchan, u32 reg, u32 data)
Expand All @@ -254,7 +254,7 @@ static void dma_update(struct owl_dma *od, u32 reg, u32 val, bool state)
else
regval &= ~val;

writel(val, od->base + reg);
writel(regval, od->base + reg);
}

static void dma_writel(struct owl_dma *od, u32 reg, u32 data)
Expand Down
70 changes: 46 additions & 24 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,37 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev,
trace_amdgpu_vm_bo_map(bo_va, mapping);
}

/* Validate operation parameters to prevent potential abuse */
static int amdgpu_vm_verify_parameters(struct amdgpu_device *adev,
struct amdgpu_bo *bo,
uint64_t saddr,
uint64_t offset,
uint64_t size)
{
uint64_t tmp, lpfn;

if (saddr & AMDGPU_GPU_PAGE_MASK
|| offset & AMDGPU_GPU_PAGE_MASK
|| size & AMDGPU_GPU_PAGE_MASK)
return -EINVAL;

if (check_add_overflow(saddr, size, &tmp)
|| check_add_overflow(offset, size, &tmp)
|| size == 0 /* which also leads to end < begin */)
return -EINVAL;

/* make sure object fit at this offset */
if (bo && offset + size > amdgpu_bo_size(bo))
return -EINVAL;

/* Ensure last pfn not exceed max_pfn */
lpfn = (saddr + size - 1) >> AMDGPU_GPU_PAGE_SHIFT;
if (lpfn >= adev->vm_manager.max_pfn)
return -EINVAL;

return 0;
}

/**
* amdgpu_vm_bo_map - map bo inside a vm
*
Expand All @@ -2074,20 +2105,14 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
struct amdgpu_bo *bo = bo_va->base.bo;
struct amdgpu_vm *vm = bo_va->base.vm;
uint64_t eaddr;
int r;

/* validate the parameters */
if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK ||
size == 0 || size & ~PAGE_MASK)
return -EINVAL;

/* make sure object fit at this offset */
eaddr = saddr + size - 1;
if (saddr >= eaddr ||
(bo && offset + size > amdgpu_bo_size(bo)))
return -EINVAL;
r = amdgpu_vm_verify_parameters(adev, bo, saddr, offset, size);
if (r)
return r;

saddr /= AMDGPU_GPU_PAGE_SIZE;
eaddr /= AMDGPU_GPU_PAGE_SIZE;
eaddr = saddr + (size - 1) / AMDGPU_GPU_PAGE_SIZE;

tmp = amdgpu_vm_it_iter_first(&vm->va, saddr, eaddr);
if (tmp) {
Expand Down Expand Up @@ -2140,16 +2165,9 @@ int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev,
uint64_t eaddr;
int r;

/* validate the parameters */
if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK ||
size == 0 || size & ~PAGE_MASK)
return -EINVAL;

/* make sure object fit at this offset */
eaddr = saddr + size - 1;
if (saddr >= eaddr ||
(bo && offset + size > amdgpu_bo_size(bo)))
return -EINVAL;
r = amdgpu_vm_verify_parameters(adev, bo, saddr, offset, size);
if (r)
return r;

/* Allocate all the needed memory */
mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);
Expand All @@ -2163,7 +2181,7 @@ int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev,
}

saddr /= AMDGPU_GPU_PAGE_SIZE;
eaddr /= AMDGPU_GPU_PAGE_SIZE;
eaddr = saddr + (size - 1) / AMDGPU_GPU_PAGE_SIZE;

mapping->start = saddr;
mapping->last = eaddr;
Expand Down Expand Up @@ -2250,10 +2268,14 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev,
struct amdgpu_bo_va_mapping *before, *after, *tmp, *next;
LIST_HEAD(removed);
uint64_t eaddr;
int r;

r = amdgpu_vm_verify_parameters(adev, NULL, saddr, 0, size);
if (r)
return r;

eaddr = saddr + size - 1;
saddr /= AMDGPU_GPU_PAGE_SIZE;
eaddr /= AMDGPU_GPU_PAGE_SIZE;
eaddr = saddr + (size - 1) / AMDGPU_GPU_PAGE_SIZE;

/* Allocate all the needed memory */
before = kzalloc(sizeof(*before), GFP_KERNEL);
Expand Down
13 changes: 7 additions & 6 deletions drivers/gpu/drm/nouveau/nouveau_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <drm/drmP.h>

#include "nouveau_drv.h"
#include "nouveau_bios.h"
#include "nouveau_reg.h"
#include "dispnv04/hw.h"
#include "nouveau_encoder.h"
Expand Down Expand Up @@ -1674,7 +1675,7 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf)
*/
if (nv_match_device(dev, 0x0201, 0x1462, 0x8851)) {
if (*conn == 0xf2005014 && *conf == 0xffffffff) {
fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 1, 1, 1);
fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 1, 1, DCB_OUTPUT_B);
return false;
}
}
Expand Down Expand Up @@ -1760,26 +1761,26 @@ fabricate_dcb_encoder_table(struct drm_device *dev, struct nvbios *bios)
#ifdef __powerpc__
/* Apple iMac G4 NV17 */
if (of_machine_is_compatible("PowerMac4,5")) {
fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 0, all_heads, 1);
fabricate_dcb_output(dcb, DCB_OUTPUT_ANALOG, 1, all_heads, 2);
fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 0, all_heads, DCB_OUTPUT_B);
fabricate_dcb_output(dcb, DCB_OUTPUT_ANALOG, 1, all_heads, DCB_OUTPUT_C);
return;
}
#endif

/* Make up some sane defaults */
fabricate_dcb_output(dcb, DCB_OUTPUT_ANALOG,
bios->legacy.i2c_indices.crt, 1, 1);
bios->legacy.i2c_indices.crt, 1, DCB_OUTPUT_B);

if (nv04_tv_identify(dev, bios->legacy.i2c_indices.tv) >= 0)
fabricate_dcb_output(dcb, DCB_OUTPUT_TV,
bios->legacy.i2c_indices.tv,
all_heads, 0);
all_heads, DCB_OUTPUT_A);

else if (bios->tmds.output0_script_ptr ||
bios->tmds.output1_script_ptr)
fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS,
bios->legacy.i2c_indices.panel,
all_heads, 1);
all_heads, DCB_OUTPUT_B);
}

static int
Expand Down
7 changes: 6 additions & 1 deletion drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ of_init(struct nvkm_bios *bios, const char *name)
return ERR_PTR(-EINVAL);
}

static void of_fini(void *p)
{
kfree(p);
}

const struct nvbios_source
nvbios_of = {
.name = "OpenFirmware",
.init = of_init,
.fini = (void(*)(void *))kfree,
.fini = of_fini,
.read = of_read,
.size = of_size,
.rw = false,
Expand Down
7 changes: 6 additions & 1 deletion drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,11 @@ nv50_instobj_acquire(struct nvkm_memory *memory)
void __iomem *map = NULL;

/* Already mapped? */
if (refcount_inc_not_zero(&iobj->maps))
if (refcount_inc_not_zero(&iobj->maps)) {
/* read barrier match the wmb on refcount set */
smp_rmb();
return iobj->map;
}

/* Take the lock, and re-check that another thread hasn't
* already mapped the object in the meantime.
Expand All @@ -249,6 +252,8 @@ nv50_instobj_acquire(struct nvkm_memory *memory)
iobj->base.memory.ptrs = &nv50_instobj_fast;
else
iobj->base.memory.ptrs = &nv50_instobj_slow;
/* barrier to ensure the ptrs are written before refcount is set */
smp_wmb();
refcount_set(&iobj->maps, 1);
}

Expand Down
8 changes: 0 additions & 8 deletions drivers/hid/i2c-hid/i2c-hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
/* flags */
#define I2C_HID_STARTED 0
#define I2C_HID_RESET_PENDING 1
#define I2C_HID_READ_PENDING 2

#define I2C_HID_PWR_ON 0x00
#define I2C_HID_PWR_SLEEP 0x01
Expand Down Expand Up @@ -259,17 +258,13 @@ static int __i2c_hid_command(struct i2c_client *client,
msg[1].len = data_len;
msg[1].buf = buf_recv;
msg_num = 2;
set_bit(I2C_HID_READ_PENDING, &ihid->flags);
}

if (wait)
set_bit(I2C_HID_RESET_PENDING, &ihid->flags);

ret = i2c_transfer(client->adapter, msg, msg_num);

if (data_len > 0)
clear_bit(I2C_HID_READ_PENDING, &ihid->flags);

if (ret != msg_num)
return ret < 0 ? ret : -EIO;

Expand Down Expand Up @@ -550,9 +545,6 @@ static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
{
struct i2c_hid *ihid = dev_id;

if (test_bit(I2C_HID_READ_PENDING, &ihid->flags))
return IRQ_HANDLED;

i2c_hid_get_input(ihid);

return IRQ_HANDLED;
Expand Down
Loading

0 comments on commit 737020d

Please sign in to comment.