Merge remote-tracking branch 'stable/linux-6.1.y' into rpi-6.1.y

This commit is contained in:
Dom Cobley
2023-11-21 12:55:10 +00:00
407 changed files with 7333 additions and 4451 deletions

View File

@@ -21,8 +21,10 @@ Required properties:
compatible: compatible:
"mediatek,mt6323" for PMIC MT6323 "mediatek,mt6323" for PMIC MT6323
"mediatek,mt6331" for PMIC MT6331 and MT6332 "mediatek,mt6331" for PMIC MT6331 and MT6332
"mediatek,mt6358" for PMIC MT6358 and MT6366 "mediatek,mt6357" for PMIC MT6357
"mediatek,mt6358" for PMIC MT6358
"mediatek,mt6359" for PMIC MT6359 "mediatek,mt6359" for PMIC MT6359
"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
"mediatek,mt6397" for PMIC MT6397 "mediatek,mt6397" for PMIC MT6397
Optional subnodes: Optional subnodes:
@@ -39,6 +41,7 @@ Optional subnodes:
- compatible: "mediatek,mt6323-regulator" - compatible: "mediatek,mt6323-regulator"
see ../regulator/mt6323-regulator.txt see ../regulator/mt6323-regulator.txt
- compatible: "mediatek,mt6358-regulator" - compatible: "mediatek,mt6358-regulator"
- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
see ../regulator/mt6358-regulator.txt see ../regulator/mt6358-regulator.txt
- compatible: "mediatek,mt6397-regulator" - compatible: "mediatek,mt6397-regulator"
see ../regulator/mt6397-regulator.txt see ../regulator/mt6397-regulator.txt

View File

@@ -37,11 +37,11 @@ along with a description:
the return value. General error numbers (-ENOMEM, -EINVAL) the return value. General error numbers (-ENOMEM, -EINVAL)
are not detailed, but errors with specific meanings are. are not detailed, but errors with specific meanings are.
The guest ioctl should be issued on a file descriptor of the /dev/sev-guest device. The guest ioctl should be issued on a file descriptor of the /dev/sev-guest
The ioctl accepts struct snp_user_guest_request. The input and output structure is device. The ioctl accepts struct snp_user_guest_request. The input and
specified through the req_data and resp_data field respectively. If the ioctl fails output structure is specified through the req_data and resp_data field
to execute due to a firmware error, then fw_err code will be set otherwise the respectively. If the ioctl fails to execute due to a firmware error, then
fw_err will be set to 0x00000000000000ff. the fw_error code will be set, otherwise fw_error will be set to -1.
The firmware checks that the message sequence counter is one greater than The firmware checks that the message sequence counter is one greater than
the guests message sequence counter. If guest driver fails to increment message the guests message sequence counter. If guest driver fails to increment message
@@ -57,8 +57,14 @@ counter (e.g. counter overflow), then -EIO will be returned.
__u64 req_data; __u64 req_data;
__u64 resp_data; __u64 resp_data;
/* firmware error code on failure (see psp-sev.h) */ /* bits[63:32]: VMM error code, bits[31:0] firmware error code (see psp-sev.h) */
__u64 fw_err; union {
__u64 exitinfo2;
struct {
__u32 fw_error;
__u32 vmm_error;
};
};
}; };
2.1 SNP_GET_REPORT 2.1 SNP_GET_REPORT

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 6 VERSION = 6
PATCHLEVEL = 1 PATCHLEVEL = 1
SUBLEVEL = 62 SUBLEVEL = 63
EXTRAVERSION = EXTRAVERSION =
NAME = Curry Ramen NAME = Curry Ramen

View File

@@ -271,13 +271,6 @@
>; >;
}; };
leds_pins: pinmux_leds_pins {
pinctrl-single,pins = <
OMAP3_WKUP_IOPAD(0x2a24, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu0.gpio_11 */
OMAP3_WKUP_IOPAD(0x2a26, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu1.gpio_31 */
>;
};
mmc1_pins: pinmux_mmc1_pins { mmc1_pins: pinmux_mmc1_pins {
pinctrl-single,pins = < pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x2144, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */ OMAP3_CORE1_IOPAD(0x2144, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
@@ -355,3 +348,12 @@
>; >;
}; };
}; };
&omap3_pmx_wkup {
leds_pins: pinmux_leds_pins {
pinctrl-single,pins = <
OMAP3_WKUP_IOPAD(0x2a24, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu0.gpio_11 */
OMAP3_WKUP_IOPAD(0x2a26, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu1.gpio_31 */
>;
};
};

View File

@@ -82,7 +82,6 @@
}; };
}; };
regulators {
vsdcc_fixed: vsdcc-regulator { vsdcc_fixed: vsdcc-regulator {
compatible = "regulator-fixed"; compatible = "regulator-fixed";
regulator-name = "SDCC Power"; regulator-name = "SDCC Power";
@@ -90,7 +89,6 @@
regulator-max-microvolt = <2700000>; regulator-max-microvolt = <2700000>;
regulator-always-on; regulator-always-on;
}; };
};
soc: soc { soc: soc {
#address-cells = <1>; #address-cells = <1>;

View File

@@ -239,7 +239,7 @@
}; };
keyboard_pins: keyboard { keyboard_pins: keyboard {
pins = "GP_3_10", "GP_3_11", "GP_3_12", "GP_3_15", "GP_11_02"; pins = "GP_3_10", "GP_3_11", "GP_3_12", "GP_3_15", "GP_11_2";
bias-pull-up; bias-pull-up;
}; };

View File

@@ -17,6 +17,7 @@ ENTRY(__memset)
ENTRY(mmioset) ENTRY(mmioset)
WEAK(memset) WEAK(memset)
UNWIND( .fnstart ) UNWIND( .fnstart )
and r1, r1, #255 @ cast to unsigned char
ands r3, r0, #3 @ 1 unaligned? ands r3, r0, #3 @ 1 unaligned?
mov ip, r0 @ preserve r0 as return value mov ip, r0 @ preserve r0 as return value
bne 6f @ 1 bne 6f @ 1

View File

@@ -164,9 +164,6 @@ static int xen_starting_cpu(unsigned int cpu)
BUG_ON(err); BUG_ON(err);
per_cpu(xen_vcpu, cpu) = vcpup; per_cpu(xen_vcpu, cpu) = vcpup;
if (!xen_kernel_unmapped_at_usr())
xen_setup_runstate_info(cpu);
after_register_vcpu_info: after_register_vcpu_info:
enable_percpu_irq(xen_events_irq, 0); enable_percpu_irq(xen_events_irq, 0);
return 0; return 0;
@@ -523,9 +520,6 @@ static int __init xen_guest_init(void)
return -EINVAL; return -EINVAL;
} }
if (!xen_kernel_unmapped_at_usr())
xen_time_setup_guest();
if (xen_initial_domain()) if (xen_initial_domain())
pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier); pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
@@ -535,7 +529,13 @@ static int __init xen_guest_init(void)
} }
early_initcall(xen_guest_init); early_initcall(xen_guest_init);
static int __init xen_pm_init(void) static int xen_starting_runstate_cpu(unsigned int cpu)
{
xen_setup_runstate_info(cpu);
return 0;
}
static int __init xen_late_init(void)
{ {
if (!xen_domain()) if (!xen_domain())
return -ENODEV; return -ENODEV;
@@ -548,9 +548,16 @@ static int __init xen_pm_init(void)
do_settimeofday64(&ts); do_settimeofday64(&ts);
} }
if (xen_kernel_unmapped_at_usr())
return 0; return 0;
xen_time_setup_guest();
return cpuhp_setup_state(CPUHP_AP_ARM_XEN_RUNSTATE_STARTING,
"arm/xen_runstate:starting",
xen_starting_runstate_cpu, NULL);
} }
late_initcall(xen_pm_init); late_initcall(xen_late_init);
/* empty stubs */ /* empty stubs */

View File

@@ -398,6 +398,7 @@
"pll8k", "pll11k", "clkext3"; "pll8k", "pll11k", "clkext3";
dmas = <&sdma2 24 25 0x80000000>; dmas = <&sdma2 24 25 0x80000000>;
dma-names = "rx"; dma-names = "rx";
#sound-dai-cells = <0>;
status = "disabled"; status = "disabled";
}; };

View File

@@ -370,6 +370,7 @@
"pll8k", "pll11k", "clkext3"; "pll8k", "pll11k", "clkext3";
dmas = <&sdma2 24 25 0x80000000>; dmas = <&sdma2 24 25 0x80000000>;
dma-names = "rx"; dma-names = "rx";
#sound-dai-cells = <0>;
status = "disabled"; status = "disabled";
}; };

View File

@@ -8,5 +8,5 @@
}; };
&jpegenc { &jpegenc {
compatible = "nxp,imx8qm-jpgdec", "nxp,imx8qxp-jpgenc"; compatible = "nxp,imx8qm-jpgenc", "nxp,imx8qxp-jpgenc";
}; };

View File

@@ -120,7 +120,7 @@
"mpp59", "mpp60", "mpp61"; "mpp59", "mpp60", "mpp61";
marvell,function = "sdio"; marvell,function = "sdio";
}; };
cp0_spi0_pins: cp0-spi-pins-0 { cp0_spi1_pins: cp0-spi-pins-1 {
marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16"; marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16";
marvell,function = "spi1"; marvell,function = "spi1";
}; };
@@ -170,7 +170,7 @@
&cp0_spi1 { &cp0_spi1 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&cp0_spi0_pins>; pinctrl-0 = <&cp0_spi1_pins>;
reg = <0x700680 0x50>, /* control */ reg = <0x700680 0x50>, /* control */
<0x2000000 0x1000000>; /* CS0 */ <0x2000000 0x1000000>; /* CS0 */
status = "okay"; status = "okay";

View File

@@ -307,7 +307,7 @@
&cp0_spi1 { &cp0_spi1 {
status = "disabled"; status = "disabled";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&cp0_spi0_pins>; pinctrl-0 = <&cp0_spi1_pins>;
reg = <0x700680 0x50>; reg = <0x700680 0x50>;
flash@0 { flash@0 {
@@ -371,7 +371,7 @@
"mpp59", "mpp60", "mpp61"; "mpp59", "mpp60", "mpp61";
marvell,function = "sdio"; marvell,function = "sdio";
}; };
cp0_spi0_pins: cp0-spi-pins-0 { cp0_spi1_pins: cp0-spi-pins-1 {
marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16"; marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16";
marvell,function = "spi1"; marvell,function = "spi1";
}; };

View File

@@ -532,12 +532,12 @@
<GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 259 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 260 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; <GIC_SPI 261 IRQ_TYPE_LEVEL_HIGH>;
status = "okay"; status = "okay";
}; };

View File

@@ -200,6 +200,9 @@
pd-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>; pd-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>;
avdd-supply = <&pm8916_l6>; avdd-supply = <&pm8916_l6>;
a2vdd-supply = <&pm8916_l6>;
dvdd-supply = <&pm8916_l6>;
pvdd-supply = <&pm8916_l6>;
v1p2-supply = <&pm8916_l6>; v1p2-supply = <&pm8916_l6>;
v3p3-supply = <&pm8916_l17>; v3p3-supply = <&pm8916_l17>;

View File

@@ -1257,7 +1257,7 @@
#size-cells = <1>; #size-cells = <1>;
#iommu-cells = <1>; #iommu-cells = <1>;
compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
ranges = <0 0x01e20000 0x40000>; ranges = <0 0x01e20000 0x20000>;
reg = <0x01ef0000 0x3000>; reg = <0x01ef0000 0x3000>;
clocks = <&gcc GCC_SMMU_CFG_CLK>, clocks = <&gcc GCC_SMMU_CFG_CLK>,
<&gcc GCC_APSS_TCU_CLK>; <&gcc GCC_APSS_TCU_CLK>;

View File

@@ -109,11 +109,6 @@
qcom,client-id = <1>; qcom,client-id = <1>;
}; };
audio_mem: audio@cb400000 {
reg = <0 0xcb000000 0 0x400000>;
no-mem;
};
qseecom_mem: qseecom@cb400000 { qseecom_mem: qseecom@cb400000 {
reg = <0 0xcb400000 0 0x1c00000>; reg = <0 0xcb400000 0 0x1c00000>;
no-mem; no-mem;

View File

@@ -820,7 +820,8 @@
clocks = <&rpmhcc RPMH_CXO_CLK>, clocks = <&rpmhcc RPMH_CXO_CLK>,
<&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>, <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>,
<0>, <&pcie1_lane>, <0>, <&pcie1_lane>,
<0>, <0>, <0>, <0>; <0>, <0>, <0>,
<&usb_1_ssphy>;
clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk", clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk",
"pcie_0_pipe_clk", "pcie_1_pipe_clk", "pcie_0_pipe_clk", "pcie_1_pipe_clk",
"ufs_phy_rx_symbol_0_clk", "ufs_phy_rx_symbol_1_clk", "ufs_phy_rx_symbol_0_clk", "ufs_phy_rx_symbol_1_clk",
@@ -5337,6 +5338,14 @@
reg = <0 0x18591000 0 0x1000>, reg = <0 0x18591000 0 0x1000>,
<0 0x18592000 0 0x1000>, <0 0x18592000 0 0x1000>,
<0 0x18593000 0 0x1000>; <0 0x18593000 0 0x1000>;
interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "dcvsh-irq-0",
"dcvsh-irq-1",
"dcvsh-irq-2";
clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GCC_GPLL0>; clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GCC_GPLL0>;
clock-names = "xo", "alternate"; clock-names = "xo", "alternate";
#freq-domain-cells = <1>; #freq-domain-cells = <1>;

View File

@@ -145,6 +145,10 @@
}; };
}; };
&cpufreq_hw {
/delete-property/ interrupts-extended; /* reference to lmh_cluster[01] */
};
&psci { &psci {
/delete-node/ cpu0; /delete-node/ cpu0;
/delete-node/ cpu1; /delete-node/ cpu1;
@@ -277,6 +281,14 @@
&CLUSTER_SLEEP_0>; &CLUSTER_SLEEP_0>;
}; };
&lmh_cluster0 {
status = "disabled";
};
&lmh_cluster1 {
status = "disabled";
};
/* /*
* Reserved memory changes * Reserved memory changes
* *

View File

@@ -714,6 +714,8 @@
vdd-1.8-xo-supply = <&vreg_l7a_1p8>; vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
qcom,snoc-host-cap-8bit-quirk;
}; };
/* PINCTRL - additions to nodes defined in sdm845.dtsi */ /* PINCTRL - additions to nodes defined in sdm845.dtsi */

View File

@@ -1839,8 +1839,12 @@
ranges; ranges;
clocks = <&gcc GCC_PCIE_PHY_AUX_CLK>, clocks = <&gcc GCC_PCIE_PHY_AUX_CLK>,
<&gcc GCC_PCIE_0_CFG_AHB_CLK>, <&gcc GCC_PCIE_0_CFG_AHB_CLK>,
<&gcc GCC_PCIE_0_CLKREF_CLK>,
<&gcc GCC_PCIE0_PHY_REFGEN_CLK>; <&gcc GCC_PCIE0_PHY_REFGEN_CLK>;
clock-names = "aux", "cfg_ahb", "refgen"; clock-names = "aux",
"cfg_ahb",
"ref",
"refgen";
resets = <&gcc GCC_PCIE_0_PHY_BCR>; resets = <&gcc GCC_PCIE_0_PHY_BCR>;
reset-names = "phy"; reset-names = "phy";
@@ -1938,8 +1942,12 @@
ranges; ranges;
clocks = <&gcc GCC_PCIE_PHY_AUX_CLK>, clocks = <&gcc GCC_PCIE_PHY_AUX_CLK>,
<&gcc GCC_PCIE_1_CFG_AHB_CLK>, <&gcc GCC_PCIE_1_CFG_AHB_CLK>,
<&gcc GCC_PCIE_1_CLKREF_CLK>,
<&gcc GCC_PCIE1_PHY_REFGEN_CLK>; <&gcc GCC_PCIE1_PHY_REFGEN_CLK>;
clock-names = "aux", "cfg_ahb", "refgen"; clock-names = "aux",
"cfg_ahb",
"ref",
"refgen";
resets = <&gcc GCC_PCIE_1_PHY_BCR>; resets = <&gcc GCC_PCIE_1_PHY_BCR>;
reset-names = "phy"; reset-names = "phy";

View File

@@ -1778,7 +1778,7 @@
}; };
qup_uart18_default: qup-uart18-default-state { qup_uart18_default: qup-uart18-default-state {
pins = "gpio58", "gpio59"; pins = "gpio68", "gpio69";
function = "qup18"; function = "qup18";
drive-strength = <2>; drive-strength = <2>;
bias-disable; bias-disable;

View File

@@ -172,7 +172,7 @@
status = "okay"; status = "okay";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&main_i2c1_pins_default>; pinctrl-0 = <&main_i2c1_pins_default>;
clock-frequency = <400000>; clock-frequency = <100000>;
exp1: gpio@22 { exp1: gpio@22 {
compatible = "ti,tca6424"; compatible = "ti,tca6424";

View File

@@ -85,7 +85,8 @@
#define ARM_CPU_PART_NEOVERSE_N2 0xD49 #define ARM_CPU_PART_NEOVERSE_N2 0xD49
#define ARM_CPU_PART_CORTEX_A78C 0xD4B #define ARM_CPU_PART_CORTEX_A78C 0xD4B
#define APM_CPU_PART_POTENZA 0x000 #define APM_CPU_PART_XGENE 0x000
#define APM_CPU_VAR_POTENZA 0x00
#define CAVIUM_CPU_PART_THUNDERX 0x0A1 #define CAVIUM_CPU_PART_THUNDERX 0x0A1
#define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2 #define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2

View File

@@ -863,7 +863,7 @@ u32 __attribute_const__ kvm_target_cpu(void)
break; break;
case ARM_CPU_IMP_APM: case ARM_CPU_IMP_APM:
switch (part_number) { switch (part_number) {
case APM_CPU_PART_POTENZA: case APM_CPU_PART_XGENE:
return KVM_ARM_TARGET_XGENE_POTENZA; return KVM_ARM_TARGET_XGENE_POTENZA;
} }
break; break;

View File

@@ -69,9 +69,6 @@
#define _PTE_NONE_MASK 0 #define _PTE_NONE_MASK 0
/* Until my rework is finished, 40x still needs atomic PTE updates */
#define PTE_ATOMIC_UPDATES 1
#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED) #define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED)
#define _PAGE_BASE (_PAGE_BASE_NC) #define _PAGE_BASE (_PAGE_BASE_NC)

View File

@@ -1164,6 +1164,7 @@ static void emulate_single_step(struct pt_regs *regs)
__single_step_exception(regs); __single_step_exception(regs);
} }
#ifdef CONFIG_PPC_FPU_REGS
static inline int __parse_fpscr(unsigned long fpscr) static inline int __parse_fpscr(unsigned long fpscr)
{ {
int ret = FPE_FLTUNK; int ret = FPE_FLTUNK;
@@ -1190,6 +1191,7 @@ static inline int __parse_fpscr(unsigned long fpscr)
return ret; return ret;
} }
#endif
static void parse_fpe(struct pt_regs *regs) static void parse_fpe(struct pt_regs *regs)
{ {

View File

@@ -51,7 +51,7 @@ static int trace_imc_mem_size;
* core and trace-imc * core and trace-imc
*/ */
static struct imc_pmu_ref imc_global_refc = { static struct imc_pmu_ref imc_global_refc = {
.lock = __SPIN_LOCK_INITIALIZER(imc_global_refc.lock), .lock = __SPIN_LOCK_UNLOCKED(imc_global_refc.lock),
.id = 0, .id = 0,
.refc = 0, .refc = 0,
}; };

View File

@@ -4,6 +4,8 @@
* Copyright (C) 2019 Haren Myneni, IBM Corp * Copyright (C) 2019 Haren Myneni, IBM Corp
*/ */
#define pr_fmt(fmt) "vas-api: " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/cdev.h> #include <linux/cdev.h>
@@ -78,7 +80,7 @@ int get_vas_user_win_ref(struct vas_user_win_ref *task_ref)
task_ref->mm = get_task_mm(current); task_ref->mm = get_task_mm(current);
if (!task_ref->mm) { if (!task_ref->mm) {
put_pid(task_ref->pid); put_pid(task_ref->pid);
pr_err("VAS: pid(%d): mm_struct is not found\n", pr_err("pid(%d): mm_struct is not found\n",
current->pid); current->pid);
return -EPERM; return -EPERM;
} }
@@ -235,8 +237,7 @@ void vas_update_csb(struct coprocessor_request_block *crb,
rc = kill_pid_info(SIGSEGV, &info, pid); rc = kill_pid_info(SIGSEGV, &info, pid);
rcu_read_unlock(); rcu_read_unlock();
pr_devel("%s(): pid %d kill_proc_info() rc %d\n", __func__, pr_devel("pid %d kill_proc_info() rc %d\n", pid_vnr(pid), rc);
pid_vnr(pid), rc);
} }
void vas_dump_crb(struct coprocessor_request_block *crb) void vas_dump_crb(struct coprocessor_request_block *crb)
@@ -294,7 +295,7 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg)
rc = copy_from_user(&uattr, uptr, sizeof(uattr)); rc = copy_from_user(&uattr, uptr, sizeof(uattr));
if (rc) { if (rc) {
pr_err("%s(): copy_from_user() returns %d\n", __func__, rc); pr_err("copy_from_user() returns %d\n", rc);
return -EFAULT; return -EFAULT;
} }
@@ -311,7 +312,7 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg)
txwin = cp_inst->coproc->vops->open_win(uattr.vas_id, uattr.flags, txwin = cp_inst->coproc->vops->open_win(uattr.vas_id, uattr.flags,
cp_inst->coproc->cop_type); cp_inst->coproc->cop_type);
if (IS_ERR(txwin)) { if (IS_ERR(txwin)) {
pr_err("%s() VAS window open failed, %ld\n", __func__, pr_err_ratelimited("VAS window open failed rc=%ld\n",
PTR_ERR(txwin)); PTR_ERR(txwin));
return PTR_ERR(txwin); return PTR_ERR(txwin);
} }
@@ -405,8 +406,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)
* window is not opened. Shouldn't expect this error. * window is not opened. Shouldn't expect this error.
*/ */
if (!cp_inst || !cp_inst->txwin) { if (!cp_inst || !cp_inst->txwin) {
pr_err("%s(): Unexpected fault on paste address with TX window closed\n", pr_err("Unexpected fault on paste address with TX window closed\n");
__func__);
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
} }
@@ -421,8 +421,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)
* issue NX request. * issue NX request.
*/ */
if (txwin->task_ref.vma != vmf->vma) { if (txwin->task_ref.vma != vmf->vma) {
pr_err("%s(): No previous mapping with paste address\n", pr_err("No previous mapping with paste address\n");
__func__);
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
} }
@@ -481,19 +480,19 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
txwin = cp_inst->txwin; txwin = cp_inst->txwin;
if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) { if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) {
pr_debug("%s(): size 0x%zx, PAGE_SIZE 0x%zx\n", __func__, pr_debug("size 0x%zx, PAGE_SIZE 0x%zx\n",
(vma->vm_end - vma->vm_start), PAGE_SIZE); (vma->vm_end - vma->vm_start), PAGE_SIZE);
return -EINVAL; return -EINVAL;
} }
/* Ensure instance has an open send window */ /* Ensure instance has an open send window */
if (!txwin) { if (!txwin) {
pr_err("%s(): No send window open?\n", __func__); pr_err("No send window open?\n");
return -EINVAL; return -EINVAL;
} }
if (!cp_inst->coproc->vops || !cp_inst->coproc->vops->paste_addr) { if (!cp_inst->coproc->vops || !cp_inst->coproc->vops->paste_addr) {
pr_err("%s(): VAS API is not registered\n", __func__); pr_err("VAS API is not registered\n");
return -EACCES; return -EACCES;
} }
@@ -510,14 +509,14 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
*/ */
mutex_lock(&txwin->task_ref.mmap_mutex); mutex_lock(&txwin->task_ref.mmap_mutex);
if (txwin->status != VAS_WIN_ACTIVE) { if (txwin->status != VAS_WIN_ACTIVE) {
pr_err("%s(): Window is not active\n", __func__); pr_err("Window is not active\n");
rc = -EACCES; rc = -EACCES;
goto out; goto out;
} }
paste_addr = cp_inst->coproc->vops->paste_addr(txwin); paste_addr = cp_inst->coproc->vops->paste_addr(txwin);
if (!paste_addr) { if (!paste_addr) {
pr_err("%s(): Window paste address failed\n", __func__); pr_err("Window paste address failed\n");
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
@@ -533,8 +532,8 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
rc = remap_pfn_range(vma, vma->vm_start, pfn + vma->vm_pgoff, rc = remap_pfn_range(vma, vma->vm_start, pfn + vma->vm_pgoff,
vma->vm_end - vma->vm_start, prot); vma->vm_end - vma->vm_start, prot);
pr_devel("%s(): paste addr %llx at %lx, rc %d\n", __func__, pr_devel("paste addr %llx at %lx, rc %d\n", paste_addr,
paste_addr, vma->vm_start, rc); vma->vm_start, rc);
txwin->task_ref.vma = vma; txwin->task_ref.vma = vma;
vma->vm_ops = &vas_vm_ops; vma->vm_ops = &vas_vm_ops;
@@ -609,8 +608,7 @@ int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type,
goto err; goto err;
} }
pr_devel("%s: Added dev [%d,%d]\n", __func__, MAJOR(devno), pr_devel("Added dev [%d,%d]\n", MAJOR(devno), MINOR(devno));
MINOR(devno));
return 0; return 0;

View File

@@ -524,8 +524,10 @@ static ssize_t vcpudispatch_stats_write(struct file *file, const char __user *p,
if (cmd) { if (cmd) {
rc = init_cpu_associativity(); rc = init_cpu_associativity();
if (rc) if (rc) {
destroy_cpu_associativity();
goto out; goto out;
}
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
disp = per_cpu_ptr(&vcpu_disp_data, cpu); disp = per_cpu_ptr(&vcpu_disp_data, cpu);

View File

@@ -340,7 +340,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,
if (atomic_inc_return(&cop_feat_caps->nr_used_credits) > if (atomic_inc_return(&cop_feat_caps->nr_used_credits) >
atomic_read(&cop_feat_caps->nr_total_credits)) { atomic_read(&cop_feat_caps->nr_total_credits)) {
pr_err("Credits are not available to allocate window\n"); pr_err_ratelimited("Credits are not available to allocate window\n");
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
@@ -423,7 +423,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,
put_vas_user_win_ref(&txwin->vas_win.task_ref); put_vas_user_win_ref(&txwin->vas_win.task_ref);
rc = -EBUSY; rc = -EBUSY;
pr_err("No credit is available to allocate window\n"); pr_err_ratelimited("No credit is available to allocate window\n");
out_free: out_free:
/* /*

View File

@@ -804,7 +804,7 @@ int xive_native_get_queue_info(u32 vp_id, u32 prio,
if (out_qpage) if (out_qpage)
*out_qpage = be64_to_cpu(qpage); *out_qpage = be64_to_cpu(qpage);
if (out_qsize) if (out_qsize)
*out_qsize = be32_to_cpu(qsize); *out_qsize = be64_to_cpu(qsize);
if (out_qeoi_page) if (out_qeoi_page)
*out_qeoi_page = be64_to_cpu(qeoi_page); *out_qeoi_page = be64_to_cpu(qeoi_page);
if (out_escalate_irq) if (out_escalate_irq)

View File

@@ -57,12 +57,13 @@ int riscv_of_processor_hartid(struct device_node *node, unsigned long *hart)
*/ */
int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid) int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid)
{ {
int rc;
for (; node; node = node->parent) { for (; node; node = node->parent) {
if (of_device_is_compatible(node, "riscv")) { if (of_device_is_compatible(node, "riscv")) {
rc = riscv_of_processor_hartid(node, hartid); *hartid = (unsigned long)of_get_cpu_hwid(node, 0);
if (!rc) if (*hartid == ~0UL) {
pr_warn("Found CPU without hart ID\n");
return -ENODEV;
}
return 0; return 0;
} }
} }

View File

@@ -22,6 +22,17 @@ config STACK_DEBUG
every function call and will therefore incur a major every function call and will therefore incur a major
performance hit. Most users should say N. performance hit. Most users should say N.
config EARLY_PRINTK
bool "Early printk"
depends on SH_STANDARD_BIOS
help
Say Y here to redirect kernel printk messages to the serial port
used by the SH-IPL bootloader, starting very early in the boot
process and ending when the kernel's serial console is initialised.
This option is only useful while porting the kernel to a new machine,
when the kernel may crash or hang before the serial console is
initialised. If unsure, say N.
config 4KSTACKS config 4KSTACKS
bool "Use 4Kb for kernel stacks instead of 8Kb" bool "Use 4Kb for kernel stacks instead of 8Kb"
depends on DEBUG_KERNEL && (MMU || BROKEN) && !PAGE_SIZE_64KB depends on DEBUG_KERNEL && (MMU || BROKEN) && !PAGE_SIZE_64KB

View File

@@ -128,10 +128,6 @@ struct snp_psc_desc {
struct psc_entry entries[VMGEXIT_PSC_MAX_ENTRY]; struct psc_entry entries[VMGEXIT_PSC_MAX_ENTRY];
} __packed; } __packed;
/* Guest message request error codes */
#define SNP_GUEST_REQ_INVALID_LEN BIT_ULL(32)
#define SNP_GUEST_REQ_ERR_BUSY BIT_ULL(33)
#define GHCB_MSR_TERM_REQ 0x100 #define GHCB_MSR_TERM_REQ 0x100
#define GHCB_MSR_TERM_REASON_SET_POS 12 #define GHCB_MSR_TERM_REASON_SET_POS 12
#define GHCB_MSR_TERM_REASON_SET_MASK 0xf #define GHCB_MSR_TERM_REASON_SET_MASK 0xf

View File

@@ -9,6 +9,8 @@
#define __ASM_ENCRYPTED_STATE_H #define __ASM_ENCRYPTED_STATE_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/sev-guest.h>
#include <asm/insn.h> #include <asm/insn.h>
#include <asm/sev-common.h> #include <asm/sev-common.h>
#include <asm/bootparam.h> #include <asm/bootparam.h>
@@ -185,6 +187,9 @@ static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate)
return rc; return rc;
} }
struct snp_guest_request_ioctl;
void setup_ghcb(void); void setup_ghcb(void);
void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr, void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
unsigned long npages); unsigned long npages);
@@ -196,7 +201,7 @@ void snp_set_memory_private(unsigned long vaddr, unsigned long npages);
void snp_set_wakeup_secondary_cpu(void); void snp_set_wakeup_secondary_cpu(void);
bool snp_init(struct boot_params *bp); bool snp_init(struct boot_params *bp);
void __init __noreturn snp_abort(void); void __init __noreturn snp_abort(void);
int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned long *fw_err); int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio);
#else #else
static inline void sev_es_ist_enter(struct pt_regs *regs) { } static inline void sev_es_ist_enter(struct pt_regs *regs) { }
static inline void sev_es_ist_exit(void) { } static inline void sev_es_ist_exit(void) { }
@@ -216,8 +221,7 @@ static inline void snp_set_memory_private(unsigned long vaddr, unsigned long npa
static inline void snp_set_wakeup_secondary_cpu(void) { } static inline void snp_set_wakeup_secondary_cpu(void) { }
static inline bool snp_init(struct boot_params *bp) { return false; } static inline bool snp_init(struct boot_params *bp) { return false; }
static inline void snp_abort(void) { } static inline void snp_abort(void) { }
static inline int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, static inline int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio)
unsigned long *fw_err)
{ {
return -ENOTTY; return -ENOTTY;
} }

View File

@@ -37,6 +37,8 @@ extern int phys_to_target_node(phys_addr_t start);
#define phys_to_target_node phys_to_target_node #define phys_to_target_node phys_to_target_node
extern int memory_add_physaddr_to_nid(u64 start); extern int memory_add_physaddr_to_nid(u64 start);
#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid #define memory_add_physaddr_to_nid memory_add_physaddr_to_nid
extern int numa_fill_memblks(u64 start, u64 end);
#define numa_fill_memblks numa_fill_memblks
#endif #endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */

View File

@@ -518,7 +518,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len);
#define copy_mc_to_kernel copy_mc_to_kernel #define copy_mc_to_kernel copy_mc_to_kernel
unsigned long __must_check unsigned long __must_check
copy_mc_to_user(void *to, const void *from, unsigned len); copy_mc_to_user(void __user *to, const void *from, unsigned len);
#endif #endif
/* /*

View File

@@ -100,6 +100,9 @@ static const struct pci_device_id amd_nb_link_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M10H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M10H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M40H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M40H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M50H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M50H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M60H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M70H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F4) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) },
{} {}
}; };

View File

@@ -2477,7 +2477,7 @@ static void __init srso_select_mitigation(void)
pr_info("%s%s\n", srso_strings[srso_mitigation], (has_microcode ? "" : ", no microcode")); pr_info("%s%s\n", srso_strings[srso_mitigation], (has_microcode ? "" : ", no microcode"));
pred_cmd: pred_cmd:
if ((boot_cpu_has(X86_FEATURE_SRSO_NO) || srso_cmd == SRSO_CMD_OFF) && if ((!boot_cpu_has_bug(X86_BUG_SRSO) || srso_cmd == SRSO_CMD_OFF) &&
boot_cpu_has(X86_FEATURE_SBPB)) boot_cpu_has(X86_FEATURE_SBPB))
x86_pred_cmd = PRED_CMD_SBPB; x86_pred_cmd = PRED_CMD_SBPB;
} }

View File

@@ -80,7 +80,7 @@ static struct desc_struct startup_gdt[GDT_ENTRIES] = {
* while the kernel still uses a direct mapping. * while the kernel still uses a direct mapping.
*/ */
static struct desc_ptr startup_gdt_descr = { static struct desc_ptr startup_gdt_descr = {
.size = sizeof(startup_gdt), .size = sizeof(startup_gdt)-1,
.address = 0, .address = 0,
}; };

View File

@@ -22,6 +22,8 @@
#include <linux/efi.h> #include <linux/efi.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/psp-sev.h>
#include <uapi/linux/sev-guest.h>
#include <asm/cpu_entry_area.h> #include <asm/cpu_entry_area.h>
#include <asm/stacktrace.h> #include <asm/stacktrace.h>
@@ -2205,7 +2207,7 @@ static int __init init_sev_config(char *str)
} }
__setup("sev=", init_sev_config); __setup("sev=", init_sev_config);
int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned long *fw_err) int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio)
{ {
struct ghcb_state state; struct ghcb_state state;
struct es_em_ctxt ctxt; struct es_em_ctxt ctxt;
@@ -2213,8 +2215,7 @@ int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned
struct ghcb *ghcb; struct ghcb *ghcb;
int ret; int ret;
if (!fw_err) rio->exitinfo2 = SEV_RET_NO_FW_CALL;
return -EINVAL;
/* /*
* __sev_get_ghcb() needs to run with IRQs disabled because it is using * __sev_get_ghcb() needs to run with IRQs disabled because it is using
@@ -2239,16 +2240,16 @@ int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned
if (ret) if (ret)
goto e_put; goto e_put;
*fw_err = ghcb->save.sw_exit_info_2; rio->exitinfo2 = ghcb->save.sw_exit_info_2;
switch (*fw_err) { switch (rio->exitinfo2) {
case 0: case 0:
break; break;
case SNP_GUEST_REQ_ERR_BUSY: case SNP_GUEST_VMM_ERR(SNP_GUEST_VMM_ERR_BUSY):
ret = -EAGAIN; ret = -EAGAIN;
break; break;
case SNP_GUEST_REQ_INVALID_LEN: case SNP_GUEST_VMM_ERR(SNP_GUEST_VMM_ERR_INVALID_LEN):
/* Number of expected pages are returned in RBX */ /* Number of expected pages are returned in RBX */
if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST) { if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST) {
input->data_npages = ghcb_get_rbx(ghcb); input->data_npages = ghcb_get_rbx(ghcb);

View File

@@ -70,23 +70,23 @@ unsigned long __must_check copy_mc_to_kernel(void *dst, const void *src, unsigne
} }
EXPORT_SYMBOL_GPL(copy_mc_to_kernel); EXPORT_SYMBOL_GPL(copy_mc_to_kernel);
unsigned long __must_check copy_mc_to_user(void *dst, const void *src, unsigned len) unsigned long __must_check copy_mc_to_user(void __user *dst, const void *src, unsigned len)
{ {
unsigned long ret; unsigned long ret;
if (copy_mc_fragile_enabled) { if (copy_mc_fragile_enabled) {
__uaccess_begin(); __uaccess_begin();
ret = copy_mc_fragile(dst, src, len); ret = copy_mc_fragile((__force void *)dst, src, len);
__uaccess_end(); __uaccess_end();
return ret; return ret;
} }
if (static_cpu_has(X86_FEATURE_ERMS)) { if (static_cpu_has(X86_FEATURE_ERMS)) {
__uaccess_begin(); __uaccess_begin();
ret = copy_mc_enhanced_fast_string(dst, src, len); ret = copy_mc_enhanced_fast_string((__force void *)dst, src, len);
__uaccess_end(); __uaccess_end();
return ret; return ret;
} }
return copy_user_generic(dst, src, len); return copy_user_generic((__force void *)dst, src, len);
} }

View File

@@ -9,12 +9,21 @@ bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
unsigned long vaddr = (unsigned long)unsafe_src; unsigned long vaddr = (unsigned long)unsafe_src;
/* /*
* Range covering the highest possible canonical userspace address * Do not allow userspace addresses. This disallows
* as well as non-canonical address range. For the canonical range * normal userspace and the userspace guard page:
* we also need to include the userspace guard page.
*/ */
return vaddr >= TASK_SIZE_MAX + PAGE_SIZE && if (vaddr < TASK_SIZE_MAX + PAGE_SIZE)
__is_canonical_address(vaddr, boot_cpu_data.x86_virt_bits); return false;
/*
* Allow everything during early boot before 'x86_virt_bits'
* is initialized. Needed for instruction decoding in early
* exception handlers.
*/
if (!boot_cpu_data.x86_virt_bits)
return true;
return __is_canonical_address(vaddr, boot_cpu_data.x86_virt_bits);
} }
#else #else
bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size) bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)

View File

@@ -11,6 +11,7 @@
#include <linux/nodemask.h> #include <linux/nodemask.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/topology.h> #include <linux/topology.h>
#include <linux/sort.h>
#include <asm/e820/api.h> #include <asm/e820/api.h>
#include <asm/proto.h> #include <asm/proto.h>
@@ -961,4 +962,83 @@ int memory_add_physaddr_to_nid(u64 start)
return nid; return nid;
} }
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
static int __init cmp_memblk(const void *a, const void *b)
{
const struct numa_memblk *ma = *(const struct numa_memblk **)a;
const struct numa_memblk *mb = *(const struct numa_memblk **)b;
return ma->start - mb->start;
}
static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS] __initdata;
/**
* numa_fill_memblks - Fill gaps in numa_meminfo memblks
* @start: address to begin fill
* @end: address to end fill
*
* Find and extend numa_meminfo memblks to cover the @start-@end
* physical address range, such that the first memblk includes
* @start, the last memblk includes @end, and any gaps in between
* are filled.
*
* RETURNS:
* 0 : Success
* NUMA_NO_MEMBLK : No memblk exists in @start-@end range
*/
int __init numa_fill_memblks(u64 start, u64 end)
{
struct numa_memblk **blk = &numa_memblk_list[0];
struct numa_meminfo *mi = &numa_meminfo;
int count = 0;
u64 prev_end;
/*
* Create a list of pointers to numa_meminfo memblks that
* overlap start, end. Exclude (start == bi->end) since
* end addresses in both a CFMWS range and a memblk range
* are exclusive.
*
* This list of pointers is used to make in-place changes
* that fill out the numa_meminfo memblks.
*/
for (int i = 0; i < mi->nr_blks; i++) {
struct numa_memblk *bi = &mi->blk[i];
if (start < bi->end && end >= bi->start) {
blk[count] = &mi->blk[i];
count++;
}
}
if (!count)
return NUMA_NO_MEMBLK;
/* Sort the list of pointers in memblk->start order */
sort(&blk[0], count, sizeof(blk[0]), cmp_memblk, NULL);
/* Make sure the first/last memblks include start/end */
blk[0]->start = min(blk[0]->start, start);
blk[count - 1]->end = max(blk[count - 1]->end, end);
/*
* Fill any gaps by tracking the previous memblks
* end address and backfilling to it if needed.
*/
prev_end = blk[0]->end;
for (int i = 1; i < count; i++) {
struct numa_memblk *curr = blk[i];
if (prev_end >= curr->start) {
if (prev_end < curr->end)
prev_end = curr->end;
} else {
curr->start = prev_end;
prev_end = curr->end;
}
}
return 0;
}
#endif #endif

View File

@@ -490,7 +490,7 @@ static inline void bio_check_ro(struct bio *bio)
if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) { if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) {
if (op_is_flush(bio->bi_opf) && !bio_sectors(bio)) if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
return; return;
pr_warn("Trying to write to read-only block-device %pg\n", pr_warn_ratelimited("Trying to write to read-only block-device %pg\n",
bio->bi_bdev); bio->bi_bdev);
/* Older lvm-tools actually trigger this */ /* Older lvm-tools actually trigger this */
} }

View File

@@ -158,8 +158,8 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,
return 0; return 0;
len = snprintf(modalias, size, "acpi:"); len = snprintf(modalias, size, "acpi:");
if (len <= 0) if (len >= size)
return len; return -ENOMEM;
size -= len; size -= len;
@@ -212,8 +212,10 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,
len = snprintf(modalias, size, "of:N%sT", (char *)buf.pointer); len = snprintf(modalias, size, "of:N%sT", (char *)buf.pointer);
ACPI_FREE(buf.pointer); ACPI_FREE(buf.pointer);
if (len <= 0) if (len >= size)
return len; return -ENOMEM;
size -= len;
of_compatible = acpi_dev->data.of_compatible; of_compatible = acpi_dev->data.of_compatible;
if (of_compatible->type == ACPI_TYPE_PACKAGE) { if (of_compatible->type == ACPI_TYPE_PACKAGE) {

View File

@@ -310,11 +310,16 @@ static int __init acpi_parse_cfmws(union acpi_subtable_headers *header,
start = cfmws->base_hpa; start = cfmws->base_hpa;
end = cfmws->base_hpa + cfmws->window_size; end = cfmws->base_hpa + cfmws->window_size;
/* Skip if the SRAT already described the NUMA details for this HPA */ /*
node = phys_to_target_node(start); * The SRAT may have already described NUMA details for all,
if (node != NUMA_NO_NODE) * or a portion of, this CFMWS HPA range. Extend the memblks
* found for any portion of the window to cover the entire
* window.
*/
if (!numa_fill_memblks(start, end))
return 0; return 0;
/* No SRAT description. Create a new node. */
node = acpi_map_pxm_to_node(*fake_pxm); node = acpi_map_pxm_to_node(*fake_pxm);
if (node == NUMA_NO_NODE) { if (node == NUMA_NO_NODE) {

View File

@@ -1114,25 +1114,26 @@ static int acpi_data_prop_read(const struct acpi_device_data *data,
switch (proptype) { switch (proptype) {
case DEV_PROP_STRING: case DEV_PROP_STRING:
break; break;
case DEV_PROP_U8 ... DEV_PROP_U64: default:
if (obj->type == ACPI_TYPE_BUFFER) { if (obj->type == ACPI_TYPE_BUFFER) {
if (nval > obj->buffer.length) if (nval > obj->buffer.length)
return -EOVERFLOW; return -EOVERFLOW;
break; } else {
}
fallthrough;
default:
if (nval > obj->package.count) if (nval > obj->package.count)
return -EOVERFLOW; return -EOVERFLOW;
}
break; break;
} }
if (nval == 0) if (nval == 0)
return -EINVAL; return -EINVAL;
if (obj->type != ACPI_TYPE_BUFFER) if (obj->type == ACPI_TYPE_BUFFER) {
items = obj->package.elements; if (proptype != DEV_PROP_U8)
else return -EPROTO;
items = obj; items = obj;
} else {
items = obj->package.elements;
}
switch (proptype) { switch (proptype) {
case DEV_PROP_U8: case DEV_PROP_U8:

View File

@@ -130,6 +130,16 @@ static int video_detect_force_native(const struct dmi_system_id *d)
return 0; return 0;
} }
static int video_detect_portege_r100(const struct dmi_system_id *d)
{
struct pci_dev *dev;
/* Search for Trident CyberBlade XP4m32 to confirm Portégé R100 */
dev = pci_get_device(PCI_VENDOR_ID_TRIDENT, 0x2100, NULL);
if (dev)
acpi_backlight_dmi = acpi_backlight_vendor;
return 0;
}
static const struct dmi_system_id video_detect_dmi_table[] = { static const struct dmi_system_id video_detect_dmi_table[] = {
/* /*
* Models which should use the vendor backlight interface, * Models which should use the vendor backlight interface,
@@ -268,6 +278,22 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
}, },
}, },
/*
* Toshiba Portégé R100 has working both acpi_video and toshiba_acpi
* vendor driver. But none of them gets activated as it has a VGA with
* no kernel driver (Trident CyberBlade XP4m32).
* The DMI strings are generic so check for the VGA chip in callback.
*/
{
.callback = video_detect_portege_r100,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"),
DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"),
DMI_MATCH(DMI_BOARD_NAME, "Portable PC")
},
},
/* /*
* Models which need acpi_video backlight control where the GPU drivers * Models which need acpi_video backlight control where the GPU drivers
* do not call acpi_video_register_backlight() because no internal panel * do not call acpi_video_register_backlight() because no internal panel

View File

@@ -48,7 +48,7 @@ static ssize_t regmap_name_read_file(struct file *file,
name = map->dev->driver->name; name = map->dev->driver->name;
ret = snprintf(buf, PAGE_SIZE, "%s\n", name); ret = snprintf(buf, PAGE_SIZE, "%s\n", name);
if (ret < 0) { if (ret >= PAGE_SIZE) {
kfree(buf); kfree(buf);
return ret; return ret;
} }

View File

@@ -1702,17 +1702,19 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
} }
if (!map->cache_bypass && map->format.parse_val) { if (!map->cache_bypass && map->format.parse_val) {
unsigned int ival; unsigned int ival, offset;
int val_bytes = map->format.val_bytes; int val_bytes = map->format.val_bytes;
for (i = 0; i < val_len / val_bytes; i++) {
ival = map->format.parse_val(val + (i * val_bytes)); /* Cache the last written value for noinc writes */
ret = regcache_write(map, i = noinc ? val_len - val_bytes : 0;
reg + regmap_get_offset(map, i), for (; i < val_len; i += val_bytes) {
ival); ival = map->format.parse_val(val + i);
offset = noinc ? 0 : regmap_get_offset(map, i / val_bytes);
ret = regcache_write(map, reg + offset, ival);
if (ret) { if (ret) {
dev_err(map->dev, dev_err(map->dev,
"Error in caching of register: %x ret: %d\n", "Error in caching of register: %x ret: %d\n",
reg + regmap_get_offset(map, i), ret); reg + offset, ret);
return ret; return ret;
} }
} }

View File

@@ -250,7 +250,6 @@ static void nbd_dev_remove(struct nbd_device *nbd)
struct gendisk *disk = nbd->disk; struct gendisk *disk = nbd->disk;
del_gendisk(disk); del_gendisk(disk);
put_disk(disk);
blk_mq_free_tag_set(&nbd->tag_set); blk_mq_free_tag_set(&nbd->tag_set);
/* /*
@@ -261,7 +260,7 @@ static void nbd_dev_remove(struct nbd_device *nbd)
idr_remove(&nbd_index_idr, nbd->index); idr_remove(&nbd_index_idr, nbd->index);
mutex_unlock(&nbd_index_mutex); mutex_unlock(&nbd_index_mutex);
destroy_workqueue(nbd->recv_workq); destroy_workqueue(nbd->recv_workq);
kfree(nbd); put_disk(disk);
} }
static void nbd_dev_remove_work(struct work_struct *work) static void nbd_dev_remove_work(struct work_struct *work)
@@ -1608,6 +1607,13 @@ static void nbd_release(struct gendisk *disk, fmode_t mode)
nbd_put(nbd); nbd_put(nbd);
} }
static void nbd_free_disk(struct gendisk *disk)
{
struct nbd_device *nbd = disk->private_data;
kfree(nbd);
}
static const struct block_device_operations nbd_fops = static const struct block_device_operations nbd_fops =
{ {
.owner = THIS_MODULE, .owner = THIS_MODULE,
@@ -1615,6 +1621,7 @@ static const struct block_device_operations nbd_fops =
.release = nbd_release, .release = nbd_release,
.ioctl = nbd_ioctl, .ioctl = nbd_ioctl,
.compat_ioctl = nbd_ioctl, .compat_ioctl = nbd_ioctl,
.free_disk = nbd_free_disk,
}; };
#if IS_ENABLED(CONFIG_DEBUG_FS) #if IS_ENABLED(CONFIG_DEBUG_FS)

View File

@@ -71,7 +71,7 @@ static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,
while ((rng_readl(priv, RNG_STATUS) >> 24) == 0) { while ((rng_readl(priv, RNG_STATUS) >> 24) == 0) {
if (!wait) if (!wait)
return 0; return 0;
hwrng_msleep(rng, 1000); hwrng_yield(rng);
} }
num_words = rng_readl(priv, RNG_STATUS) >> 24; num_words = rng_readl(priv, RNG_STATUS) >> 24;

View File

@@ -680,6 +680,12 @@ long hwrng_msleep(struct hwrng *rng, unsigned int msecs)
} }
EXPORT_SYMBOL_GPL(hwrng_msleep); EXPORT_SYMBOL_GPL(hwrng_msleep);
long hwrng_yield(struct hwrng *rng)
{
return wait_for_completion_interruptible_timeout(&rng->dying, 1);
}
EXPORT_SYMBOL_GPL(hwrng_yield);
static int __init hwrng_modinit(void) static int __init hwrng_modinit(void)
{ {
int ret; int ret;

View File

@@ -58,7 +58,8 @@ struct amd_geode_priv {
static int geode_rng_data_read(struct hwrng *rng, u32 *data) static int geode_rng_data_read(struct hwrng *rng, u32 *data)
{ {
void __iomem *mem = (void __iomem *)rng->priv; struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv;
void __iomem *mem = priv->membase;
*data = readl(mem + GEODE_RNG_DATA_REG); *data = readl(mem + GEODE_RNG_DATA_REG);
@@ -67,7 +68,8 @@ static int geode_rng_data_read(struct hwrng *rng, u32 *data)
static int geode_rng_data_present(struct hwrng *rng, int wait) static int geode_rng_data_present(struct hwrng *rng, int wait)
{ {
void __iomem *mem = (void __iomem *)rng->priv; struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv;
void __iomem *mem = priv->membase;
int data, i; int data, i;
for (i = 0; i < 20; i++) { for (i = 0; i < 20; i++) {

View File

@@ -510,7 +510,7 @@ static void __init npcm7xx_clk_init(struct device_node *clk_np)
return; return;
npcm7xx_init_fail: npcm7xx_init_fail:
kfree(npcm7xx_clk_data->hws); kfree(npcm7xx_clk_data);
npcm7xx_init_np_err: npcm7xx_init_np_err:
iounmap(clk_base); iounmap(clk_base);
npcm7xx_init_error: npcm7xx_init_error:

View File

@@ -213,6 +213,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev)
sclk->info = scmi_proto_clk_ops->info_get(ph, idx); sclk->info = scmi_proto_clk_ops->info_get(ph, idx);
if (!sclk->info) { if (!sclk->info) {
dev_dbg(dev, "invalid clock info for idx %d\n", idx); dev_dbg(dev, "invalid clock info for idx %d\n", idx);
devm_kfree(dev, sclk);
continue; continue;
} }

View File

@@ -96,6 +96,7 @@ config CLK_IMX8QXP
depends on (ARCH_MXC && ARM64) || COMPILE_TEST depends on (ARCH_MXC && ARM64) || COMPILE_TEST
depends on IMX_SCU && HAVE_ARM_SMCCC depends on IMX_SCU && HAVE_ARM_SMCCC
select MXC_CLK_SCU select MXC_CLK_SCU
select MXC_CLK
help help
Build the driver for IMX8QXP SCU based clocks. Build the driver for IMX8QXP SCU based clocks.

View File

@@ -288,8 +288,7 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
void __iomem *base; void __iomem *base;
int err; int err;
clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, IMX8MQ_CLK_END), GFP_KERNEL);
IMX8MQ_CLK_END), GFP_KERNEL);
if (WARN_ON(!clk_hw_data)) if (WARN_ON(!clk_hw_data))
return -ENOMEM; return -ENOMEM;
@@ -306,10 +305,12 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
hws[IMX8MQ_CLK_EXT4] = imx_obtain_fixed_clk_hw(np, "clk_ext4"); hws[IMX8MQ_CLK_EXT4] = imx_obtain_fixed_clk_hw(np, "clk_ext4");
np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-anatop"); np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-anatop");
base = of_iomap(np, 0); base = devm_of_iomap(dev, np, 0, NULL);
of_node_put(np); of_node_put(np);
if (WARN_ON(!base)) if (WARN_ON(IS_ERR(base))) {
return -ENOMEM; err = PTR_ERR(base);
goto unregister_hws;
}
hws[IMX8MQ_ARM_PLL_REF_SEL] = imx_clk_hw_mux("arm_pll_ref_sel", base + 0x28, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)); hws[IMX8MQ_ARM_PLL_REF_SEL] = imx_clk_hw_mux("arm_pll_ref_sel", base + 0x28, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels));
hws[IMX8MQ_GPU_PLL_REF_SEL] = imx_clk_hw_mux("gpu_pll_ref_sel", base + 0x18, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)); hws[IMX8MQ_GPU_PLL_REF_SEL] = imx_clk_hw_mux("gpu_pll_ref_sel", base + 0x18, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels));
@@ -395,8 +396,10 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
np = dev->of_node; np = dev->of_node;
base = devm_platform_ioremap_resource(pdev, 0); base = devm_platform_ioremap_resource(pdev, 0);
if (WARN_ON(IS_ERR(base))) if (WARN_ON(IS_ERR(base))) {
return PTR_ERR(base); err = PTR_ERR(base);
goto unregister_hws;
}
/* CORE */ /* CORE */
hws[IMX8MQ_CLK_A53_DIV] = imx8m_clk_hw_composite_core("arm_a53_div", imx8mq_a53_sels, base + 0x8000); hws[IMX8MQ_CLK_A53_DIV] = imx8m_clk_hw_composite_core("arm_a53_div", imx8mq_a53_sels, base + 0x8000);

View File

@@ -148,10 +148,10 @@ static int imx8qxp_clk_probe(struct platform_device *pdev)
imx_clk_scu("adc0_clk", IMX_SC_R_ADC_0, IMX_SC_PM_CLK_PER); imx_clk_scu("adc0_clk", IMX_SC_R_ADC_0, IMX_SC_PM_CLK_PER);
imx_clk_scu("adc1_clk", IMX_SC_R_ADC_1, IMX_SC_PM_CLK_PER); imx_clk_scu("adc1_clk", IMX_SC_R_ADC_1, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm_clk", IMX_SC_R_LCD_0_PWM_0, IMX_SC_PM_CLK_PER); imx_clk_scu("pwm_clk", IMX_SC_R_LCD_0_PWM_0, IMX_SC_PM_CLK_PER);
imx_clk_scu("elcdif_pll", IMX_SC_R_ELCDIF_PLL, IMX_SC_PM_CLK_PLL);
imx_clk_scu2("lcd_clk", lcd_sels, ARRAY_SIZE(lcd_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_PER); imx_clk_scu2("lcd_clk", lcd_sels, ARRAY_SIZE(lcd_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_PER);
imx_clk_scu2("lcd_pxl_clk", lcd_pxl_sels, ARRAY_SIZE(lcd_pxl_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_MISC0); imx_clk_scu2("lcd_pxl_clk", lcd_pxl_sels, ARRAY_SIZE(lcd_pxl_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_MISC0);
imx_clk_scu("lcd_pxl_bypass_div_clk", IMX_SC_R_LCD_0, IMX_SC_PM_CLK_BYPASS); imx_clk_scu("lcd_pxl_bypass_div_clk", IMX_SC_R_LCD_0, IMX_SC_PM_CLK_BYPASS);
imx_clk_scu("elcdif_pll", IMX_SC_R_ELCDIF_PLL, IMX_SC_PM_CLK_PLL);
/* Audio SS */ /* Audio SS */
imx_clk_scu("audio_pll0_clk", IMX_SC_R_AUDIO_PLL_0, IMX_SC_PM_CLK_PLL); imx_clk_scu("audio_pll0_clk", IMX_SC_R_AUDIO_PLL_0, IMX_SC_PM_CLK_PLL);

View File

@@ -281,12 +281,13 @@ static void __init of_pll_div_clk_init(struct device_node *node)
clk = clk_register_divider(NULL, clk_name, parent_name, 0, reg, shift, clk = clk_register_divider(NULL, clk_name, parent_name, 0, reg, shift,
mask, 0, NULL); mask, 0, NULL);
if (clk) { if (IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
} else {
pr_err("%s: error registering divider %s\n", __func__, clk_name); pr_err("%s: error registering divider %s\n", __func__, clk_name);
iounmap(reg); iounmap(reg);
return;
} }
of_clk_add_provider(node, of_clk_src_simple_get, clk);
} }
CLK_OF_DECLARE(pll_divider_clock, "ti,keystone,pll-divider-clock", of_pll_div_clk_init); CLK_OF_DECLARE(pll_divider_clock, "ti,keystone,pll-divider-clock", of_pll_div_clk_init);
@@ -328,10 +329,12 @@ static void __init of_pll_mux_clk_init(struct device_node *node)
clk = clk_register_mux(NULL, clk_name, (const char **)&parents, clk = clk_register_mux(NULL, clk_name, (const char **)&parents,
ARRAY_SIZE(parents) , 0, reg, shift, mask, ARRAY_SIZE(parents) , 0, reg, shift, mask,
0, NULL); 0, NULL);
if (clk) if (IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
else
pr_err("%s: error registering mux %s\n", __func__, clk_name); pr_err("%s: error registering mux %s\n", __func__, clk_name);
return;
}
of_clk_add_provider(node, of_clk_src_simple_get, clk);
} }
CLK_OF_DECLARE(pll_mux_clock, "ti,keystone,pll-mux-clock", of_pll_mux_clk_init); CLK_OF_DECLARE(pll_mux_clock, "ti,keystone,pll-mux-clock", of_pll_mux_clk_init);

View File

@@ -670,6 +670,8 @@ static int mtk_topckgen_init(struct platform_device *pdev)
return PTR_ERR(base); return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_TOP_NR); clk_data = mtk_alloc_clk_data(CLK_TOP_NR);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
clk_data); clk_data);
@@ -749,6 +751,8 @@ static void __init mtk_infrasys_init_early(struct device_node *node)
if (!infra_clk_data) { if (!infra_clk_data) {
infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
if (!infra_clk_data)
return;
for (i = 0; i < CLK_INFRA_NR; i++) for (i = 0; i < CLK_INFRA_NR; i++)
infra_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER); infra_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER);
@@ -776,6 +780,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
if (!infra_clk_data) { if (!infra_clk_data) {
infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
if (!infra_clk_data)
return -ENOMEM;
} else { } else {
for (i = 0; i < CLK_INFRA_NR; i++) { for (i = 0; i < CLK_INFRA_NR; i++) {
if (infra_clk_data->hws[i] == ERR_PTR(-EPROBE_DEFER)) if (infra_clk_data->hws[i] == ERR_PTR(-EPROBE_DEFER))
@@ -893,6 +899,8 @@ static int mtk_pericfg_init(struct platform_device *pdev)
return PTR_ERR(base); return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_PERI_NR); clk_data = mtk_alloc_clk_data(CLK_PERI_NR);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks), mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
clk_data); clk_data);

View File

@@ -738,6 +738,8 @@ static int clk_mt6765_apmixed_probe(struct platform_device *pdev)
} }
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
@@ -773,6 +775,8 @@ static int clk_mt6765_top_probe(struct platform_device *pdev)
} }
clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks), mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks),
clk_data); clk_data);
@@ -813,6 +817,8 @@ static int clk_mt6765_ifr_probe(struct platform_device *pdev)
} }
clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_gates(node, ifr_clks, ARRAY_SIZE(ifr_clks), mtk_clk_register_gates(node, ifr_clks, ARRAY_SIZE(ifr_clks),
clk_data); clk_data);

View File

@@ -1218,6 +1218,8 @@ static int clk_mt6779_apmixed_probe(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
@@ -1238,6 +1240,8 @@ static int clk_mt6779_top_probe(struct platform_device *pdev)
return PTR_ERR(base); return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
clk_data); clk_data);

View File

@@ -392,6 +392,8 @@ static int mtk_topckgen_init(struct platform_device *pdev)
return PTR_ERR(base); return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_TOP_NR); clk_data = mtk_alloc_clk_data(CLK_TOP_NR);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_factors(top_fixed_divs, ARRAY_SIZE(top_fixed_divs), mtk_clk_register_factors(top_fixed_divs, ARRAY_SIZE(top_fixed_divs),
clk_data); clk_data);
@@ -546,6 +548,8 @@ static void mtk_infrasys_init_early(struct device_node *node)
if (!infra_clk_data) { if (!infra_clk_data) {
infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
if (!infra_clk_data)
return;
for (i = 0; i < CLK_INFRA_NR; i++) for (i = 0; i < CLK_INFRA_NR; i++)
infra_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER); infra_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER);
@@ -571,6 +575,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
if (!infra_clk_data) { if (!infra_clk_data) {
infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
if (!infra_clk_data)
return -ENOMEM;
} else { } else {
for (i = 0; i < CLK_INFRA_NR; i++) { for (i = 0; i < CLK_INFRA_NR; i++) {
if (infra_clk_data->hws[i] == ERR_PTR(-EPROBE_DEFER)) if (infra_clk_data->hws[i] == ERR_PTR(-EPROBE_DEFER))

View File

@@ -79,6 +79,8 @@ static int clk_mt7629_ethsys_init(struct platform_device *pdev)
int r; int r;
clk_data = mtk_alloc_clk_data(CLK_ETH_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_ETH_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_gates(node, eth_clks, CLK_ETH_NR_CLK, clk_data); mtk_clk_register_gates(node, eth_clks, CLK_ETH_NR_CLK, clk_data);
@@ -101,6 +103,8 @@ static int clk_mt7629_sgmiisys_init(struct platform_device *pdev)
int r; int r;
clk_data = mtk_alloc_clk_data(CLK_SGMII_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_SGMII_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_gates(node, sgmii_clks[id++], CLK_SGMII_NR_CLK, mtk_clk_register_gates(node, sgmii_clks[id++], CLK_SGMII_NR_CLK,
clk_data); clk_data);

View File

@@ -557,6 +557,8 @@ static int mtk_topckgen_init(struct platform_device *pdev)
return PTR_ERR(base); return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
clk_data); clk_data);
@@ -580,6 +582,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
struct clk_hw_onecell_data *clk_data; struct clk_hw_onecell_data *clk_data;
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks), mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
clk_data); clk_data);
@@ -603,6 +607,8 @@ static int mtk_pericfg_init(struct platform_device *pdev)
return PTR_ERR(base); return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK); clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
if (!clk_data)
return -ENOMEM;
mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks), mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
clk_data); clk_data);

View File

@@ -127,6 +127,7 @@ config IPQ_APSS_6018
tristate "IPQ APSS Clock Controller" tristate "IPQ APSS Clock Controller"
select IPQ_APSS_PLL select IPQ_APSS_PLL
depends on QCOM_APCS_IPC || COMPILE_TEST depends on QCOM_APCS_IPC || COMPILE_TEST
depends on QCOM_SMEM
help help
Support for APSS clock controller on IPQ platforms. The Support for APSS clock controller on IPQ platforms. The
APSS clock controller manages the Mux and enable block that feeds the APSS clock controller manages the Mux and enable block that feeds the

View File

@@ -158,17 +158,11 @@ static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index)
static unsigned long static unsigned long
calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div) calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div)
{ {
if (hid_div) { if (hid_div)
rate *= 2; rate = mult_frac(rate, 2, hid_div + 1);
rate /= hid_div + 1;
}
if (mode) { if (mode)
u64 tmp = rate; rate = mult_frac(rate, m, n);
tmp *= m;
do_div(tmp, n);
rate = tmp;
}
return rate; return rate;
} }

View File

@@ -245,71 +245,6 @@ static const struct clk_parent_data gcc_xo_gpll0_gpll4_gpll0_early_div[] = {
{ .hw = &gpll0_early_div.hw } { .hw = &gpll0_early_div.hw }
}; };
static const struct freq_tbl ftbl_system_noc_clk_src[] = {
F(19200000, P_XO, 1, 0, 0),
F(50000000, P_GPLL0_EARLY_DIV, 6, 0, 0),
F(100000000, P_GPLL0, 6, 0, 0),
F(150000000, P_GPLL0, 4, 0, 0),
F(200000000, P_GPLL0, 3, 0, 0),
F(240000000, P_GPLL0, 2.5, 0, 0),
{ }
};
static struct clk_rcg2 system_noc_clk_src = {
.cmd_rcgr = 0x0401c,
.hid_width = 5,
.parent_map = gcc_xo_gpll0_gpll0_early_div_map,
.freq_tbl = ftbl_system_noc_clk_src,
.clkr.hw.init = &(struct clk_init_data){
.name = "system_noc_clk_src",
.parent_data = gcc_xo_gpll0_gpll0_early_div,
.num_parents = ARRAY_SIZE(gcc_xo_gpll0_gpll0_early_div),
.ops = &clk_rcg2_ops,
},
};
static const struct freq_tbl ftbl_config_noc_clk_src[] = {
F(19200000, P_XO, 1, 0, 0),
F(37500000, P_GPLL0, 16, 0, 0),
F(75000000, P_GPLL0, 8, 0, 0),
{ }
};
static struct clk_rcg2 config_noc_clk_src = {
.cmd_rcgr = 0x0500c,
.hid_width = 5,
.parent_map = gcc_xo_gpll0_map,
.freq_tbl = ftbl_config_noc_clk_src,
.clkr.hw.init = &(struct clk_init_data){
.name = "config_noc_clk_src",
.parent_data = gcc_xo_gpll0,
.num_parents = ARRAY_SIZE(gcc_xo_gpll0),
.ops = &clk_rcg2_ops,
},
};
static const struct freq_tbl ftbl_periph_noc_clk_src[] = {
F(19200000, P_XO, 1, 0, 0),
F(37500000, P_GPLL0, 16, 0, 0),
F(50000000, P_GPLL0, 12, 0, 0),
F(75000000, P_GPLL0, 8, 0, 0),
F(100000000, P_GPLL0, 6, 0, 0),
{ }
};
static struct clk_rcg2 periph_noc_clk_src = {
.cmd_rcgr = 0x06014,
.hid_width = 5,
.parent_map = gcc_xo_gpll0_map,
.freq_tbl = ftbl_periph_noc_clk_src,
.clkr.hw.init = &(struct clk_init_data){
.name = "periph_noc_clk_src",
.parent_data = gcc_xo_gpll0,
.num_parents = ARRAY_SIZE(gcc_xo_gpll0),
.ops = &clk_rcg2_ops,
},
};
static const struct freq_tbl ftbl_usb30_master_clk_src[] = { static const struct freq_tbl ftbl_usb30_master_clk_src[] = {
F(19200000, P_XO, 1, 0, 0), F(19200000, P_XO, 1, 0, 0),
F(120000000, P_GPLL0, 5, 0, 0), F(120000000, P_GPLL0, 5, 0, 0),
@@ -1298,11 +1233,7 @@ static struct clk_branch gcc_mmss_noc_cfg_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_mmss_noc_cfg_ahb_clk", .name = "gcc_mmss_noc_cfg_ahb_clk",
.parent_hws = (const struct clk_hw*[]){ .flags = CLK_IGNORE_UNUSED,
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -1465,11 +1396,6 @@ static struct clk_branch gcc_usb_phy_cfg_ahb2phy_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_usb_phy_cfg_ahb2phy_clk", .name = "gcc_usb_phy_cfg_ahb2phy_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -1499,11 +1425,6 @@ static struct clk_branch gcc_sdcc1_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_sdcc1_ahb_clk", .name = "gcc_sdcc1_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -1550,11 +1471,6 @@ static struct clk_branch gcc_sdcc2_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_sdcc2_ahb_clk", .name = "gcc_sdcc2_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -1584,11 +1500,6 @@ static struct clk_branch gcc_sdcc3_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_sdcc3_ahb_clk", .name = "gcc_sdcc3_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -1618,11 +1529,6 @@ static struct clk_branch gcc_sdcc4_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_sdcc4_ahb_clk", .name = "gcc_sdcc4_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -1636,11 +1542,6 @@ static struct clk_branch gcc_blsp1_ahb_clk = {
.enable_mask = BIT(17), .enable_mask = BIT(17),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_blsp1_ahb_clk", .name = "gcc_blsp1_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -1978,11 +1879,6 @@ static struct clk_branch gcc_blsp2_ahb_clk = {
.enable_mask = BIT(15), .enable_mask = BIT(15),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_blsp2_ahb_clk", .name = "gcc_blsp2_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2319,11 +2215,6 @@ static struct clk_branch gcc_pdm_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pdm_ahb_clk", .name = "gcc_pdm_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2354,11 +2245,6 @@ static struct clk_branch gcc_prng_ahb_clk = {
.enable_mask = BIT(13), .enable_mask = BIT(13),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_prng_ahb_clk", .name = "gcc_prng_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2371,11 +2257,6 @@ static struct clk_branch gcc_tsif_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_tsif_ahb_clk", .name = "gcc_tsif_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2423,11 +2304,6 @@ static struct clk_branch gcc_boot_rom_ahb_clk = {
.enable_mask = BIT(10), .enable_mask = BIT(10),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_boot_rom_ahb_clk", .name = "gcc_boot_rom_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2521,11 +2397,6 @@ static struct clk_branch gcc_pcie_0_slv_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_0_slv_axi_clk", .name = "gcc_pcie_0_slv_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2538,11 +2409,6 @@ static struct clk_branch gcc_pcie_0_mstr_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_0_mstr_axi_clk", .name = "gcc_pcie_0_mstr_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2555,11 +2421,6 @@ static struct clk_branch gcc_pcie_0_cfg_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_0_cfg_ahb_clk", .name = "gcc_pcie_0_cfg_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2607,11 +2468,6 @@ static struct clk_branch gcc_pcie_1_slv_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_1_slv_axi_clk", .name = "gcc_pcie_1_slv_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2624,11 +2480,6 @@ static struct clk_branch gcc_pcie_1_mstr_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_1_mstr_axi_clk", .name = "gcc_pcie_1_mstr_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2641,11 +2492,6 @@ static struct clk_branch gcc_pcie_1_cfg_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_1_cfg_ahb_clk", .name = "gcc_pcie_1_cfg_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2693,11 +2539,6 @@ static struct clk_branch gcc_pcie_2_slv_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_2_slv_axi_clk", .name = "gcc_pcie_2_slv_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2710,11 +2551,6 @@ static struct clk_branch gcc_pcie_2_mstr_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_2_mstr_axi_clk", .name = "gcc_pcie_2_mstr_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2727,11 +2563,6 @@ static struct clk_branch gcc_pcie_2_cfg_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_2_cfg_ahb_clk", .name = "gcc_pcie_2_cfg_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2779,11 +2610,6 @@ static struct clk_branch gcc_pcie_phy_cfg_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_pcie_phy_cfg_ahb_clk", .name = "gcc_pcie_phy_cfg_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -2830,11 +2656,6 @@ static struct clk_branch gcc_ufs_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_ufs_ahb_clk", .name = "gcc_ufs_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3061,11 +2882,7 @@ static struct clk_branch gcc_aggre0_snoc_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_aggre0_snoc_axi_clk", .name = "gcc_aggre0_snoc_axi_clk",
.parent_hws = (const struct clk_hw*[]){ .flags = CLK_IS_CRITICAL,
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3078,11 +2895,7 @@ static struct clk_branch gcc_aggre0_cnoc_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_aggre0_cnoc_ahb_clk", .name = "gcc_aggre0_cnoc_ahb_clk",
.parent_hws = (const struct clk_hw*[]){ .flags = CLK_IS_CRITICAL,
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3095,11 +2908,7 @@ static struct clk_branch gcc_smmu_aggre0_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_smmu_aggre0_axi_clk", .name = "gcc_smmu_aggre0_axi_clk",
.parent_hws = (const struct clk_hw*[]){ .flags = CLK_IS_CRITICAL,
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3112,11 +2921,7 @@ static struct clk_branch gcc_smmu_aggre0_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_smmu_aggre0_ahb_clk", .name = "gcc_smmu_aggre0_ahb_clk",
.parent_hws = (const struct clk_hw*[]){ .flags = CLK_IS_CRITICAL,
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3163,10 +2968,6 @@ static struct clk_branch gcc_dcc_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_dcc_ahb_clk", .name = "gcc_dcc_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3179,10 +2980,6 @@ static struct clk_branch gcc_aggre0_noc_mpu_cfg_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_aggre0_noc_mpu_cfg_ahb_clk", .name = "gcc_aggre0_noc_mpu_cfg_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3195,11 +2992,6 @@ static struct clk_branch gcc_qspi_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_qspi_ahb_clk", .name = "gcc_qspi_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&periph_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3348,10 +3140,6 @@ static struct clk_branch gcc_mss_cfg_ahb_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_mss_cfg_ahb_clk", .name = "gcc_mss_cfg_ahb_clk",
.parent_hws = (const struct clk_hw*[]){
&config_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3364,10 +3152,6 @@ static struct clk_branch gcc_mss_mnoc_bimc_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_mss_mnoc_bimc_axi_clk", .name = "gcc_mss_mnoc_bimc_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3380,10 +3164,6 @@ static struct clk_branch gcc_mss_snoc_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_mss_snoc_axi_clk", .name = "gcc_mss_snoc_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3396,10 +3176,6 @@ static struct clk_branch gcc_mss_q6_bimc_axi_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_mss_q6_bimc_axi_clk", .name = "gcc_mss_q6_bimc_axi_clk",
.parent_hws = (const struct clk_hw*[]){
&system_noc_clk_src.clkr.hw,
},
.num_parents = 1,
.ops = &clk_branch2_ops, .ops = &clk_branch2_ops,
}, },
}, },
@@ -3495,9 +3271,6 @@ static struct clk_regmap *gcc_msm8996_clocks[] = {
[GPLL0] = &gpll0.clkr, [GPLL0] = &gpll0.clkr,
[GPLL4_EARLY] = &gpll4_early.clkr, [GPLL4_EARLY] = &gpll4_early.clkr,
[GPLL4] = &gpll4.clkr, [GPLL4] = &gpll4.clkr,
[SYSTEM_NOC_CLK_SRC] = &system_noc_clk_src.clkr,
[CONFIG_NOC_CLK_SRC] = &config_noc_clk_src.clkr,
[PERIPH_NOC_CLK_SRC] = &periph_noc_clk_src.clkr,
[USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr, [USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr,
[USB30_MOCK_UTMI_CLK_SRC] = &usb30_mock_utmi_clk_src.clkr, [USB30_MOCK_UTMI_CLK_SRC] = &usb30_mock_utmi_clk_src.clkr,
[USB3_PHY_AUX_CLK_SRC] = &usb3_phy_aux_clk_src.clkr, [USB3_PHY_AUX_CLK_SRC] = &usb3_phy_aux_clk_src.clkr,

View File

@@ -792,7 +792,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = {
.name = "gcc_sdcc2_apps_clk_src", .name = "gcc_sdcc2_apps_clk_src",
.parent_data = gcc_parents_6, .parent_data = gcc_parents_6,
.num_parents = ARRAY_SIZE(gcc_parents_6), .num_parents = ARRAY_SIZE(gcc_parents_6),
.flags = CLK_SET_RATE_PARENT, .flags = CLK_OPS_PARENT_ENABLE,
.ops = &clk_rcg2_floor_ops, .ops = &clk_rcg2_floor_ops,
}, },
}; };

View File

@@ -2478,6 +2478,7 @@ static struct clk_branch fd_ahb_clk = {
static struct clk_branch mnoc_ahb_clk = { static struct clk_branch mnoc_ahb_clk = {
.halt_reg = 0x5024, .halt_reg = 0x5024,
.halt_check = BRANCH_HALT_SKIP,
.clkr = { .clkr = {
.enable_reg = 0x5024, .enable_reg = 0x5024,
.enable_mask = BIT(0), .enable_mask = BIT(0),
@@ -2493,6 +2494,7 @@ static struct clk_branch mnoc_ahb_clk = {
static struct clk_branch bimc_smmu_ahb_clk = { static struct clk_branch bimc_smmu_ahb_clk = {
.halt_reg = 0xe004, .halt_reg = 0xe004,
.halt_check = BRANCH_HALT_SKIP,
.hwcg_reg = 0xe004, .hwcg_reg = 0xe004,
.hwcg_bit = 1, .hwcg_bit = 1,
.clkr = { .clkr = {
@@ -2510,6 +2512,7 @@ static struct clk_branch bimc_smmu_ahb_clk = {
static struct clk_branch bimc_smmu_axi_clk = { static struct clk_branch bimc_smmu_axi_clk = {
.halt_reg = 0xe008, .halt_reg = 0xe008,
.halt_check = BRANCH_HALT_SKIP,
.hwcg_reg = 0xe008, .hwcg_reg = 0xe008,
.hwcg_bit = 1, .hwcg_bit = 1,
.clkr = { .clkr = {
@@ -2650,11 +2653,13 @@ static struct gdsc camss_cpp_gdsc = {
static struct gdsc bimc_smmu_gdsc = { static struct gdsc bimc_smmu_gdsc = {
.gdscr = 0xe020, .gdscr = 0xe020,
.gds_hw_ctrl = 0xe024, .gds_hw_ctrl = 0xe024,
.cxcs = (unsigned int []){ 0xe008 },
.cxc_count = 1,
.pd = { .pd = {
.name = "bimc_smmu", .name = "bimc_smmu",
}, },
.pwrsts = PWRSTS_OFF_ON, .pwrsts = PWRSTS_OFF_ON,
.flags = HW_CTRL | ALWAYS_ON, .flags = VOTABLE,
}; };
static struct clk_regmap *mmcc_msm8998_clocks[] = { static struct clk_regmap *mmcc_msm8998_clocks[] = {

View File

@@ -70,8 +70,21 @@ void cpg_simple_notifier_register(struct raw_notifier_head *notifiers,
#define STPnHCK BIT(9 - SDnSRCFC_SHIFT) #define STPnHCK BIT(9 - SDnSRCFC_SHIFT)
static const struct clk_div_table cpg_sdh_div_table[] = { static const struct clk_div_table cpg_sdh_div_table[] = {
/*
* These values are recommended by the datasheet. Because they come
* first, Linux will only use these.
*/
{ 0, 1 }, { 1, 2 }, { STPnHCK | 2, 4 }, { STPnHCK | 3, 8 }, { 0, 1 }, { 1, 2 }, { STPnHCK | 2, 4 }, { STPnHCK | 3, 8 },
{ STPnHCK | 4, 16 }, { 0, 0 }, { STPnHCK | 4, 16 },
/*
* These values are not recommended because STPnHCK is wrong. But they
* have been seen because of broken firmware. So, we support reading
* them but Linux will sanitize them when initializing through
* recalc_rate.
*/
{ STPnHCK | 0, 1 }, { STPnHCK | 1, 2 }, { 2, 4 }, { 3, 8 }, { 4, 16 },
/* Sentinel */
{ 0, 0 }
}; };
struct clk * __init cpg_sdh_clk_register(const char *name, struct clk * __init cpg_sdh_clk_register(const char *name,

View File

@@ -11,6 +11,7 @@
* Copyright (C) 2015 Renesas Electronics Corp. * Copyright (C) 2015 Renesas Electronics Corp.
*/ */
#include <linux/bitfield.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/clk/renesas.h> #include <linux/clk/renesas.h>
@@ -39,14 +40,13 @@
#define WARN_DEBUG(x) do { } while (0) #define WARN_DEBUG(x) do { } while (0)
#endif #endif
#define DIV_RSMASK(v, s, m) ((v >> s) & m)
#define GET_SHIFT(val) ((val >> 12) & 0xff) #define GET_SHIFT(val) ((val >> 12) & 0xff)
#define GET_WIDTH(val) ((val >> 8) & 0xf) #define GET_WIDTH(val) ((val >> 8) & 0xf)
#define KDIV(val) DIV_RSMASK(val, 16, 0xffff) #define KDIV(val) ((s16)FIELD_GET(GENMASK(31, 16), val))
#define MDIV(val) DIV_RSMASK(val, 6, 0x3ff) #define MDIV(val) FIELD_GET(GENMASK(15, 6), val)
#define PDIV(val) DIV_RSMASK(val, 0, 0x3f) #define PDIV(val) FIELD_GET(GENMASK(5, 0), val)
#define SDIV(val) DIV_RSMASK(val, 0, 0x7) #define SDIV(val) FIELD_GET(GENMASK(2, 0), val)
#define CLK_ON_R(reg) (reg) #define CLK_ON_R(reg) (reg)
#define CLK_MON_R(reg) (0x180 + (reg)) #define CLK_MON_R(reg) (0x180 + (reg))
@@ -192,7 +192,9 @@ static int rzg2l_cpg_sd_clk_mux_set_parent(struct clk_hw *hw, u8 index)
u32 off = GET_REG_OFFSET(hwdata->conf); u32 off = GET_REG_OFFSET(hwdata->conf);
u32 shift = GET_SHIFT(hwdata->conf); u32 shift = GET_SHIFT(hwdata->conf);
const u32 clk_src_266 = 2; const u32 clk_src_266 = 2;
u32 bitmask; u32 msk, val, bitmask;
unsigned long flags;
int ret;
/* /*
* As per the HW manual, we should not directly switch from 533 MHz to * As per the HW manual, we should not directly switch from 533 MHz to
@@ -206,26 +208,30 @@ static int rzg2l_cpg_sd_clk_mux_set_parent(struct clk_hw *hw, u8 index)
* the index to value mapping is done by adding 1 to the index. * the index to value mapping is done by adding 1 to the index.
*/ */
bitmask = (GENMASK(GET_WIDTH(hwdata->conf) - 1, 0) << shift) << 16; bitmask = (GENMASK(GET_WIDTH(hwdata->conf) - 1, 0) << shift) << 16;
msk = off ? CPG_CLKSTATUS_SELSDHI1_STS : CPG_CLKSTATUS_SELSDHI0_STS;
spin_lock_irqsave(&priv->rmw_lock, flags);
if (index != clk_src_266) { if (index != clk_src_266) {
u32 msk, val;
int ret;
writel(bitmask | ((clk_src_266 + 1) << shift), priv->base + off); writel(bitmask | ((clk_src_266 + 1) << shift), priv->base + off);
msk = off ? CPG_CLKSTATUS_SELSDHI1_STS : CPG_CLKSTATUS_SELSDHI0_STS; ret = readl_poll_timeout_atomic(priv->base + CPG_CLKSTATUS, val,
!(val & msk), 10,
ret = readl_poll_timeout(priv->base + CPG_CLKSTATUS, val,
!(val & msk), 100,
CPG_SDHI_CLK_SWITCH_STATUS_TIMEOUT_US); CPG_SDHI_CLK_SWITCH_STATUS_TIMEOUT_US);
if (ret) { if (ret)
dev_err(priv->dev, "failed to switch clk source\n"); goto unlock;
return ret;
}
} }
writel(bitmask | ((index + 1) << shift), priv->base + off); writel(bitmask | ((index + 1) << shift), priv->base + off);
return 0; ret = readl_poll_timeout_atomic(priv->base + CPG_CLKSTATUS, val,
!(val & msk), 10,
CPG_SDHI_CLK_SWITCH_STATUS_TIMEOUT_US);
unlock:
spin_unlock_irqrestore(&priv->rmw_lock, flags);
if (ret)
dev_err(priv->dev, "failed to switch clk source\n");
return ret;
} }
static u8 rzg2l_cpg_sd_clk_mux_get_parent(struct clk_hw *hw) static u8 rzg2l_cpg_sd_clk_mux_get_parent(struct clk_hw *hw)
@@ -236,14 +242,8 @@ static u8 rzg2l_cpg_sd_clk_mux_get_parent(struct clk_hw *hw)
val >>= GET_SHIFT(hwdata->conf); val >>= GET_SHIFT(hwdata->conf);
val &= GENMASK(GET_WIDTH(hwdata->conf) - 1, 0); val &= GENMASK(GET_WIDTH(hwdata->conf) - 1, 0);
if (val) {
val--;
} else {
/* Prohibited clk source, change it to 533 MHz(reset value) */
rzg2l_cpg_sd_clk_mux_set_parent(hw, 0);
}
return val; return val ? val - 1 : 0;
} }
static const struct clk_ops rzg2l_cpg_sd_clk_mux_ops = { static const struct clk_ops rzg2l_cpg_sd_clk_mux_ops = {
@@ -699,18 +699,18 @@ static unsigned long rzg2l_cpg_pll_clk_recalc_rate(struct clk_hw *hw,
struct pll_clk *pll_clk = to_pll(hw); struct pll_clk *pll_clk = to_pll(hw);
struct rzg2l_cpg_priv *priv = pll_clk->priv; struct rzg2l_cpg_priv *priv = pll_clk->priv;
unsigned int val1, val2; unsigned int val1, val2;
unsigned int mult = 1; u64 rate;
unsigned int div = 1;
if (pll_clk->type != CLK_TYPE_SAM_PLL) if (pll_clk->type != CLK_TYPE_SAM_PLL)
return parent_rate; return parent_rate;
val1 = readl(priv->base + GET_REG_SAMPLL_CLK1(pll_clk->conf)); val1 = readl(priv->base + GET_REG_SAMPLL_CLK1(pll_clk->conf));
val2 = readl(priv->base + GET_REG_SAMPLL_CLK2(pll_clk->conf)); val2 = readl(priv->base + GET_REG_SAMPLL_CLK2(pll_clk->conf));
mult = MDIV(val1) + KDIV(val1) / 65536;
div = PDIV(val1) << SDIV(val2);
return DIV_ROUND_CLOSEST_ULL((u64)parent_rate * mult, div); rate = mul_u64_u32_shr(parent_rate, (MDIV(val1) << 16) + KDIV(val1),
16 + SDIV(val2));
return DIV_ROUND_CLOSEST_ULL(rate, PDIV(val1));
} }
static const struct clk_ops rzg2l_cpg_pll_ops = { static const struct clk_ops rzg2l_cpg_pll_ops = {

View File

@@ -43,7 +43,7 @@
#define CPG_CLKSTATUS_SELSDHI0_STS BIT(28) #define CPG_CLKSTATUS_SELSDHI0_STS BIT(28)
#define CPG_CLKSTATUS_SELSDHI1_STS BIT(29) #define CPG_CLKSTATUS_SELSDHI1_STS BIT(29)
#define CPG_SDHI_CLK_SWITCH_STATUS_TIMEOUT_US 20000 #define CPG_SDHI_CLK_SWITCH_STATUS_TIMEOUT_US 200
/* n = 0/1/2 for PLL1/4/6 */ /* n = 0/1/2 for PLL1/4/6 */
#define CPG_SAMPLL_CLK1(n) (0x04 + (16 * n)) #define CPG_SAMPLL_CLK1(n) (0x04 + (16 * n))

View File

@@ -160,7 +160,7 @@ static void __init omap_clk_register_apll(void *user,
ad->clk_bypass = __clk_get_hw(clk); ad->clk_bypass = __clk_get_hw(clk);
name = ti_dt_clk_name(node); name = ti_dt_clk_name(node);
clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk); of_clk_add_provider(node, of_clk_src_simple_get, clk);
kfree(init->parent_names); kfree(init->parent_names);
@@ -400,7 +400,7 @@ static void __init of_omap2_apll_setup(struct device_node *node)
goto cleanup; goto cleanup;
name = ti_dt_clk_name(node); name = ti_dt_clk_name(node);
clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk); of_clk_add_provider(node, of_clk_src_simple_get, clk);
kfree(init); kfree(init);

View File

@@ -197,7 +197,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
init.parent_names = parent_names; init.parent_names = parent_names;
clk = ti_clk_register(NULL, &clk_hw->hw, name); clk = of_ti_clk_register(node, &clk_hw->hw, name);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk); of_clk_add_provider(node, of_clk_src_simple_get, clk);

View File

@@ -475,7 +475,7 @@ void __init ti_clk_add_aliases(void)
clkspec.np = np; clkspec.np = np;
clk = of_clk_get_from_provider(&clkspec); clk = of_clk_get_from_provider(&clkspec);
ti_clk_add_alias(NULL, clk, ti_dt_clk_name(np)); ti_clk_add_alias(clk, ti_dt_clk_name(np));
} }
} }
@@ -528,7 +528,6 @@ void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
/** /**
* ti_clk_add_alias - add a clock alias for a TI clock * ti_clk_add_alias - add a clock alias for a TI clock
* @dev: device alias for this clock
* @clk: clock handle to create alias for * @clk: clock handle to create alias for
* @con: connection ID for this clock * @con: connection ID for this clock
* *
@@ -536,7 +535,7 @@ void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
* and assigns the data to it. Returns 0 if successful, negative error * and assigns the data to it. Returns 0 if successful, negative error
* value otherwise. * value otherwise.
*/ */
int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con) int ti_clk_add_alias(struct clk *clk, const char *con)
{ {
struct clk_lookup *cl; struct clk_lookup *cl;
@@ -550,8 +549,6 @@ int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con)
if (!cl) if (!cl)
return -ENOMEM; return -ENOMEM;
if (dev)
cl->dev_id = dev_name(dev);
cl->con_id = con; cl->con_id = con;
cl->clk = clk; cl->clk = clk;
@@ -561,8 +558,8 @@ int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con)
} }
/** /**
* ti_clk_register - register a TI clock to the common clock framework * of_ti_clk_register - register a TI clock to the common clock framework
* @dev: device for this clock * @node: device node for this clock
* @hw: hardware clock handle * @hw: hardware clock handle
* @con: connection ID for this clock * @con: connection ID for this clock
* *
@@ -570,17 +567,18 @@ int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con)
* alias for it. Returns a handle to the registered clock if successful, * alias for it. Returns a handle to the registered clock if successful,
* ERR_PTR value in failure. * ERR_PTR value in failure.
*/ */
struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw, struct clk *of_ti_clk_register(struct device_node *node, struct clk_hw *hw,
const char *con) const char *con)
{ {
struct clk *clk; struct clk *clk;
int ret; int ret;
clk = clk_register(dev, hw); ret = of_clk_hw_register(node, hw);
if (IS_ERR(clk)) if (ret)
return clk; return ERR_PTR(ret);
ret = ti_clk_add_alias(dev, clk, con); clk = hw->clk;
ret = ti_clk_add_alias(clk, con);
if (ret) { if (ret) {
clk_unregister(clk); clk_unregister(clk);
return ERR_PTR(ret); return ERR_PTR(ret);
@@ -590,8 +588,8 @@ struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
} }
/** /**
* ti_clk_register_omap_hw - register a clk_hw_omap to the clock framework * of_ti_clk_register_omap_hw - register a clk_hw_omap to the clock framework
* @dev: device for this clock * @node: device node for this clock
* @hw: hardware clock handle * @hw: hardware clock handle
* @con: connection ID for this clock * @con: connection ID for this clock
* *
@@ -600,13 +598,13 @@ struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
* Returns a handle to the registered clock if successful, ERR_PTR value * Returns a handle to the registered clock if successful, ERR_PTR value
* in failure. * in failure.
*/ */
struct clk *ti_clk_register_omap_hw(struct device *dev, struct clk_hw *hw, struct clk *of_ti_clk_register_omap_hw(struct device_node *node,
const char *con) struct clk_hw *hw, const char *con)
{ {
struct clk *clk; struct clk *clk;
struct clk_hw_omap *oclk; struct clk_hw_omap *oclk;
clk = ti_clk_register(dev, hw, con); clk = of_ti_clk_register(node, hw, con);
if (IS_ERR(clk)) if (IS_ERR(clk))
return clk; return clk;

View File

@@ -308,7 +308,7 @@ _ti_clkctrl_clk_register(struct omap_clkctrl_provider *provider,
init.ops = ops; init.ops = ops;
init.flags = 0; init.flags = 0;
clk = ti_clk_register(NULL, clk_hw, init.name); clk = of_ti_clk_register(node, clk_hw, init.name);
if (IS_ERR_OR_NULL(clk)) { if (IS_ERR_OR_NULL(clk)) {
ret = -EINVAL; ret = -EINVAL;
goto cleanup; goto cleanup;
@@ -689,7 +689,7 @@ clkdm_found:
init.ops = &omap4_clkctrl_clk_ops; init.ops = &omap4_clkctrl_clk_ops;
hw->hw.init = &init; hw->hw.init = &init;
clk = ti_clk_register_omap_hw(NULL, &hw->hw, init.name); clk = of_ti_clk_register_omap_hw(node, &hw->hw, init.name);
if (IS_ERR_OR_NULL(clk)) if (IS_ERR_OR_NULL(clk))
goto cleanup; goto cleanup;

View File

@@ -199,12 +199,12 @@ extern const struct omap_clkctrl_data dm816_clkctrl_data[];
typedef void (*ti_of_clk_init_cb_t)(void *, struct device_node *); typedef void (*ti_of_clk_init_cb_t)(void *, struct device_node *);
struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw, struct clk *of_ti_clk_register(struct device_node *node, struct clk_hw *hw,
const char *con);
struct clk *ti_clk_register_omap_hw(struct device *dev, struct clk_hw *hw,
const char *con); const char *con);
struct clk *of_ti_clk_register_omap_hw(struct device_node *node,
struct clk_hw *hw, const char *con);
const char *ti_dt_clk_name(struct device_node *np); const char *ti_dt_clk_name(struct device_node *np);
int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con); int ti_clk_add_alias(struct clk *clk, const char *con);
void ti_clk_add_aliases(void); void ti_clk_add_aliases(void);
void ti_clk_latch(struct clk_omap_reg *reg, s8 shift); void ti_clk_latch(struct clk_omap_reg *reg, s8 shift);

View File

@@ -176,7 +176,7 @@ static void __init _register_composite(void *user,
&ti_composite_gate_ops, 0); &ti_composite_gate_ops, 0);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
ret = ti_clk_add_alias(NULL, clk, name); ret = ti_clk_add_alias(clk, name);
if (ret) { if (ret) {
clk_unregister(clk); clk_unregister(clk);
goto cleanup; goto cleanup;

View File

@@ -309,7 +309,6 @@ static struct clk *_register_divider(struct device_node *node,
u32 flags, u32 flags,
struct clk_omap_divider *div) struct clk_omap_divider *div)
{ {
struct clk *clk;
struct clk_init_data init; struct clk_init_data init;
const char *parent_name; const char *parent_name;
const char *name; const char *name;
@@ -326,12 +325,7 @@ static struct clk *_register_divider(struct device_node *node,
div->hw.init = &init; div->hw.init = &init;
/* register the clock */ /* register the clock */
clk = ti_clk_register(NULL, &div->hw, name); return of_ti_clk_register(node, &div->hw, name);
if (IS_ERR(clk))
kfree(div);
return clk;
} }
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,

View File

@@ -187,7 +187,7 @@ static void __init _register_dpll(void *user,
/* register the clock */ /* register the clock */
name = ti_dt_clk_name(node); name = ti_dt_clk_name(node);
clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk); of_clk_add_provider(node, of_clk_src_simple_get, clk);
@@ -259,7 +259,7 @@ static void _register_dpll_x2(struct device_node *node,
#endif #endif
/* register the clock */ /* register the clock */
clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (IS_ERR(clk)) if (IS_ERR(clk))
kfree(clk_hw); kfree(clk_hw);

View File

@@ -54,7 +54,7 @@ static void __init of_ti_fixed_factor_clk_setup(struct device_node *node)
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk); of_clk_add_provider(node, of_clk_src_simple_get, clk);
of_ti_clk_autoidle_setup(node); of_ti_clk_autoidle_setup(node);
ti_clk_add_alias(NULL, clk, clk_name); ti_clk_add_alias(clk, clk_name);
} }
} }
CLK_OF_DECLARE(ti_fixed_factor_clk, "ti,fixed-factor-clock", CLK_OF_DECLARE(ti_fixed_factor_clk, "ti,fixed-factor-clock",

View File

@@ -85,7 +85,7 @@ static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw)
return ret; return ret;
} }
static struct clk *_register_gate(struct device *dev, const char *name, static struct clk *_register_gate(struct device_node *node, const char *name,
const char *parent_name, unsigned long flags, const char *parent_name, unsigned long flags,
struct clk_omap_reg *reg, u8 bit_idx, struct clk_omap_reg *reg, u8 bit_idx,
u8 clk_gate_flags, const struct clk_ops *ops, u8 clk_gate_flags, const struct clk_ops *ops,
@@ -115,7 +115,7 @@ static struct clk *_register_gate(struct device *dev, const char *name,
init.flags = flags; init.flags = flags;
clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (IS_ERR(clk)) if (IS_ERR(clk))
kfree(clk_hw); kfree(clk_hw);
@@ -158,7 +158,7 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
clk_gate_flags |= INVERT_ENABLE; clk_gate_flags |= INVERT_ENABLE;
name = ti_dt_clk_name(node); name = ti_dt_clk_name(node);
clk = _register_gate(NULL, name, parent_name, flags, &reg, clk = _register_gate(node, name, parent_name, flags, &reg,
enable_bit, clk_gate_flags, ops, hw_ops); enable_bit, clk_gate_flags, ops, hw_ops);
if (!IS_ERR(clk)) if (!IS_ERR(clk))

View File

@@ -24,7 +24,8 @@ static const struct clk_ops ti_interface_clk_ops = {
.is_enabled = &omap2_dflt_clk_is_enabled, .is_enabled = &omap2_dflt_clk_is_enabled,
}; };
static struct clk *_register_interface(struct device *dev, const char *name, static struct clk *_register_interface(struct device_node *node,
const char *name,
const char *parent_name, const char *parent_name,
struct clk_omap_reg *reg, u8 bit_idx, struct clk_omap_reg *reg, u8 bit_idx,
const struct clk_hw_omap_ops *ops) const struct clk_hw_omap_ops *ops)
@@ -49,7 +50,7 @@ static struct clk *_register_interface(struct device *dev, const char *name,
init.num_parents = 1; init.num_parents = 1;
init.parent_names = &parent_name; init.parent_names = &parent_name;
clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name);
if (IS_ERR(clk)) if (IS_ERR(clk))
kfree(clk_hw); kfree(clk_hw);
@@ -80,7 +81,7 @@ static void __init _of_ti_interface_clk_setup(struct device_node *node,
} }
name = ti_dt_clk_name(node); name = ti_dt_clk_name(node);
clk = _register_interface(NULL, name, parent_name, &reg, clk = _register_interface(node, name, parent_name, &reg,
enable_bit, ops); enable_bit, ops);
if (!IS_ERR(clk)) if (!IS_ERR(clk))

View File

@@ -118,7 +118,7 @@ const struct clk_ops ti_clk_mux_ops = {
.restore_context = clk_mux_restore_context, .restore_context = clk_mux_restore_context,
}; };
static struct clk *_register_mux(struct device *dev, const char *name, static struct clk *_register_mux(struct device_node *node, const char *name,
const char * const *parent_names, const char * const *parent_names,
u8 num_parents, unsigned long flags, u8 num_parents, unsigned long flags,
struct clk_omap_reg *reg, u8 shift, u32 mask, struct clk_omap_reg *reg, u8 shift, u32 mask,
@@ -148,7 +148,7 @@ static struct clk *_register_mux(struct device *dev, const char *name,
mux->table = table; mux->table = table;
mux->hw.init = &init; mux->hw.init = &init;
clk = ti_clk_register(dev, &mux->hw, name); clk = of_ti_clk_register(node, &mux->hw, name);
if (IS_ERR(clk)) if (IS_ERR(clk))
kfree(mux); kfree(mux);
@@ -207,7 +207,7 @@ static void of_mux_clk_setup(struct device_node *node)
mask = (1 << fls(mask)) - 1; mask = (1 << fls(mask)) - 1;
name = ti_dt_clk_name(node); name = ti_dt_clk_name(node);
clk = _register_mux(NULL, name, parent_names, num_parents, clk = _register_mux(node, name, parent_names, num_parents,
flags, &reg, shift, mask, latch, clk_mux_flags, flags, &reg, shift, mask, latch, clk_mux_flags,
NULL); NULL);

View File

@@ -817,8 +817,9 @@ static u64 __arch_timer_check_delta(void)
* Note that TVAL is signed, thus has only 31 of its * Note that TVAL is signed, thus has only 31 of its
* 32 bits to express magnitude. * 32 bits to express magnitude.
*/ */
MIDR_ALL_VERSIONS(MIDR_CPU_MODEL(ARM_CPU_IMP_APM, MIDR_REV_RANGE(MIDR_CPU_MODEL(ARM_CPU_IMP_APM,
APM_CPU_PART_POTENZA)), APM_CPU_PART_XGENE),
APM_CPU_VAR_POTENZA, 0x0, 0xf),
{}, {},
}; };

View File

@@ -141,6 +141,8 @@ struct dmtimer {
struct platform_device *pdev; struct platform_device *pdev;
struct list_head node; struct list_head node;
struct notifier_block nb; struct notifier_block nb;
struct notifier_block fclk_nb;
unsigned long fclk_rate;
}; };
static u32 omap_reserved_systimers; static u32 omap_reserved_systimers;
@@ -254,8 +256,7 @@ static inline void __omap_dm_timer_enable_posted(struct dmtimer *timer)
timer->posted = OMAP_TIMER_POSTED; timer->posted = OMAP_TIMER_POSTED;
} }
static inline void __omap_dm_timer_stop(struct dmtimer *timer, static inline void __omap_dm_timer_stop(struct dmtimer *timer)
unsigned long rate)
{ {
u32 l; u32 l;
@@ -270,7 +271,7 @@ static inline void __omap_dm_timer_stop(struct dmtimer *timer,
* Wait for functional clock period x 3.5 to make sure that * Wait for functional clock period x 3.5 to make sure that
* timer is stopped * timer is stopped
*/ */
udelay(3500000 / rate + 1); udelay(3500000 / timer->fclk_rate + 1);
#endif #endif
} }
@@ -349,6 +350,21 @@ static int omap_timer_context_notifier(struct notifier_block *nb,
return NOTIFY_OK; return NOTIFY_OK;
} }
static int omap_timer_fclk_notifier(struct notifier_block *nb,
unsigned long event, void *data)
{
struct clk_notifier_data *clk_data = data;
struct dmtimer *timer = container_of(nb, struct dmtimer, fclk_nb);
switch (event) {
case POST_RATE_CHANGE:
timer->fclk_rate = clk_data->new_rate;
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
static int omap_dm_timer_reset(struct dmtimer *timer) static int omap_dm_timer_reset(struct dmtimer *timer)
{ {
u32 l, timeout = 100000; u32 l, timeout = 100000;
@@ -742,7 +758,6 @@ static int omap_dm_timer_stop(struct omap_dm_timer *cookie)
{ {
struct dmtimer *timer; struct dmtimer *timer;
struct device *dev; struct device *dev;
unsigned long rate = 0;
timer = to_dmtimer(cookie); timer = to_dmtimer(cookie);
if (unlikely(!timer)) if (unlikely(!timer))
@@ -750,10 +765,7 @@ static int omap_dm_timer_stop(struct omap_dm_timer *cookie)
dev = &timer->pdev->dev; dev = &timer->pdev->dev;
if (!timer->omap1) __omap_dm_timer_stop(timer);
rate = clk_get_rate(timer->fclk);
__omap_dm_timer_stop(timer, rate);
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
@@ -1112,6 +1124,14 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
timer->fclk = devm_clk_get(dev, "fck"); timer->fclk = devm_clk_get(dev, "fck");
if (IS_ERR(timer->fclk)) if (IS_ERR(timer->fclk))
return PTR_ERR(timer->fclk); return PTR_ERR(timer->fclk);
timer->fclk_nb.notifier_call = omap_timer_fclk_notifier;
ret = devm_clk_notifier_register(dev, timer->fclk,
&timer->fclk_nb);
if (ret)
return ret;
timer->fclk_rate = clk_get_rate(timer->fclk);
} else { } else {
timer->fclk = ERR_PTR(-ENODEV); timer->fclk = ERR_PTR(-ENODEV);
} }

View File

@@ -566,7 +566,8 @@ static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
if (keylen != CHACHA_KEY_SIZE + saltlen) if (keylen != CHACHA_KEY_SIZE + saltlen)
return -EINVAL; return -EINVAL;
ctx->cdata.key_virt = key; memcpy(ctx->key, key, keylen);
ctx->cdata.key_virt = ctx->key;
ctx->cdata.keylen = keylen - saltlen; ctx->cdata.keylen = keylen - saltlen;
return chachapoly_set_sh_desc(aead); return chachapoly_set_sh_desc(aead);

View File

@@ -639,7 +639,8 @@ static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
if (keylen != CHACHA_KEY_SIZE + saltlen) if (keylen != CHACHA_KEY_SIZE + saltlen)
return -EINVAL; return -EINVAL;
ctx->cdata.key_virt = key; memcpy(ctx->key, key, keylen);
ctx->cdata.key_virt = ctx->key;
ctx->cdata.keylen = keylen - saltlen; ctx->cdata.keylen = keylen - saltlen;
return chachapoly_set_sh_desc(aead); return chachapoly_set_sh_desc(aead);

View File

@@ -443,10 +443,10 @@ static int __sev_init_ex_locked(int *error)
static int __sev_platform_init_locked(int *error) static int __sev_platform_init_locked(int *error)
{ {
int rc = 0, psp_ret = SEV_RET_NO_FW_CALL;
struct psp_device *psp = psp_master; struct psp_device *psp = psp_master;
struct sev_device *sev;
int rc = 0, psp_ret = -1;
int (*init_function)(int *error); int (*init_function)(int *error);
struct sev_device *sev;
if (!psp || !psp->sev_data) if (!psp || !psp->sev_data)
return -ENODEV; return -ENODEV;
@@ -474,9 +474,11 @@ static int __sev_platform_init_locked(int *error)
* initialization function should succeed by replacing the state * initialization function should succeed by replacing the state
* with a reset state. * with a reset state.
*/ */
dev_err(sev->dev, "SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state."); dev_err(sev->dev,
"SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state.");
rc = init_function(&psp_ret); rc = init_function(&psp_ret);
} }
if (error) if (error)
*error = psp_ret; *error = psp_ret;

View File

@@ -3,6 +3,6 @@ obj-$(CONFIG_CRYPTO_DEV_HISI_HPRE) += hpre/
obj-$(CONFIG_CRYPTO_DEV_HISI_SEC) += sec/ obj-$(CONFIG_CRYPTO_DEV_HISI_SEC) += sec/
obj-$(CONFIG_CRYPTO_DEV_HISI_SEC2) += sec2/ obj-$(CONFIG_CRYPTO_DEV_HISI_SEC2) += sec2/
obj-$(CONFIG_CRYPTO_DEV_HISI_QM) += hisi_qm.o obj-$(CONFIG_CRYPTO_DEV_HISI_QM) += hisi_qm.o
hisi_qm-objs = qm.o sgl.o hisi_qm-objs = qm.o sgl.o debugfs.o
obj-$(CONFIG_CRYPTO_DEV_HISI_ZIP) += zip/ obj-$(CONFIG_CRYPTO_DEV_HISI_ZIP) += zip/
obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += trng/ obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += trng/

File diff suppressed because it is too large Load Diff

View File

@@ -431,8 +431,11 @@ static u32 uacce_mode = UACCE_MODE_NOUACCE;
module_param_cb(uacce_mode, &hpre_uacce_mode_ops, &uacce_mode, 0444); module_param_cb(uacce_mode, &hpre_uacce_mode_ops, &uacce_mode, 0444);
MODULE_PARM_DESC(uacce_mode, UACCE_MODE_DESC); MODULE_PARM_DESC(uacce_mode, UACCE_MODE_DESC);
static bool pf_q_num_flag;
static int pf_q_num_set(const char *val, const struct kernel_param *kp) static int pf_q_num_set(const char *val, const struct kernel_param *kp)
{ {
pf_q_num_flag = true;
return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_HPRE_PF); return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_HPRE_PF);
} }
@@ -1031,7 +1034,7 @@ static int hpre_cluster_debugfs_init(struct hisi_qm *qm)
for (i = 0; i < clusters_num; i++) { for (i = 0; i < clusters_num; i++) {
ret = snprintf(buf, HPRE_DBGFS_VAL_MAX_LEN, "cluster%d", i); ret = snprintf(buf, HPRE_DBGFS_VAL_MAX_LEN, "cluster%d", i);
if (ret < 0) if (ret >= HPRE_DBGFS_VAL_MAX_LEN)
return -EINVAL; return -EINVAL;
tmp_d = debugfs_create_dir(buf, qm->debug.debug_root); tmp_d = debugfs_create_dir(buf, qm->debug.debug_root);
@@ -1101,8 +1104,7 @@ static int hpre_debugfs_init(struct hisi_qm *qm)
qm->debug.sqe_mask_offset = HPRE_SQE_MASK_OFFSET; qm->debug.sqe_mask_offset = HPRE_SQE_MASK_OFFSET;
qm->debug.sqe_mask_len = HPRE_SQE_MASK_LEN; qm->debug.sqe_mask_len = HPRE_SQE_MASK_LEN;
ret = hisi_qm_diff_regs_init(qm, hpre_diff_regs, ret = hisi_qm_regs_debugfs_init(qm, hpre_diff_regs, ARRAY_SIZE(hpre_diff_regs));
ARRAY_SIZE(hpre_diff_regs));
if (ret) { if (ret) {
dev_warn(dev, "Failed to init HPRE diff regs!\n"); dev_warn(dev, "Failed to init HPRE diff regs!\n");
goto debugfs_remove; goto debugfs_remove;
@@ -1121,7 +1123,7 @@ static int hpre_debugfs_init(struct hisi_qm *qm)
return 0; return 0;
failed_to_create: failed_to_create:
hisi_qm_diff_regs_uninit(qm, ARRAY_SIZE(hpre_diff_regs)); hisi_qm_regs_debugfs_uninit(qm, ARRAY_SIZE(hpre_diff_regs));
debugfs_remove: debugfs_remove:
debugfs_remove_recursive(qm->debug.debug_root); debugfs_remove_recursive(qm->debug.debug_root);
return ret; return ret;
@@ -1129,7 +1131,7 @@ debugfs_remove:
static void hpre_debugfs_exit(struct hisi_qm *qm) static void hpre_debugfs_exit(struct hisi_qm *qm)
{ {
hisi_qm_diff_regs_uninit(qm, ARRAY_SIZE(hpre_diff_regs)); hisi_qm_regs_debugfs_uninit(qm, ARRAY_SIZE(hpre_diff_regs));
debugfs_remove_recursive(qm->debug.debug_root); debugfs_remove_recursive(qm->debug.debug_root);
} }
@@ -1156,6 +1158,8 @@ static int hpre_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
qm->qp_num = pf_q_num; qm->qp_num = pf_q_num;
qm->debug.curr_qm_qp_num = pf_q_num; qm->debug.curr_qm_qp_num = pf_q_num;
qm->qm_list = &hpre_devices; qm->qm_list = &hpre_devices;
if (pf_q_num_flag)
set_bit(QM_MODULE_PARAM, &qm->misc_ctl);
} }
ret = hisi_qm_init(qm); ret = hisi_qm_init(qm);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2022 HiSilicon Limited. */
#ifndef QM_COMMON_H
#define QM_COMMON_H
#define QM_DBG_READ_LEN 256
struct qm_cqe {
__le32 rsvd0;
__le16 cmd_id;
__le16 rsvd1;
__le16 sq_head;
__le16 sq_num;
__le16 rsvd2;
__le16 w7;
};
struct qm_eqe {
__le32 dw0;
};
struct qm_aeqe {
__le32 dw0;
};
struct qm_sqc {
__le16 head;
__le16 tail;
__le32 base_l;
__le32 base_h;
__le32 dw3;
__le16 w8;
__le16 rsvd0;
__le16 pasid;
__le16 w11;
__le16 cq_num;
__le16 w13;
__le32 rsvd1;
};
struct qm_cqc {
__le16 head;
__le16 tail;
__le32 base_l;
__le32 base_h;
__le32 dw3;
__le16 w8;
__le16 rsvd0;
__le16 pasid;
__le16 w11;
__le32 dw6;
__le32 rsvd1;
};
struct qm_eqc {
__le16 head;
__le16 tail;
__le32 base_l;
__le32 base_h;
__le32 dw3;
__le32 rsvd[2];
__le32 dw6;
};
struct qm_aeqc {
__le16 head;
__le16 tail;
__le32 base_l;
__le32 base_h;
__le32 dw3;
__le32 rsvd[2];
__le32 dw6;
};
static const char * const qm_s[] = {
"init", "start", "close", "stop",
};
void *hisi_qm_ctx_alloc(struct hisi_qm *qm, size_t ctx_size,
dma_addr_t *dma_addr);
void hisi_qm_ctx_free(struct hisi_qm *qm, size_t ctx_size,
const void *ctx_addr, dma_addr_t *dma_addr);
void hisi_qm_show_last_dfx_regs(struct hisi_qm *qm);
void hisi_qm_set_algqos_init(struct hisi_qm *qm);
#endif

View File

@@ -312,8 +312,11 @@ static int sec_diff_regs_show(struct seq_file *s, void *unused)
} }
DEFINE_SHOW_ATTRIBUTE(sec_diff_regs); DEFINE_SHOW_ATTRIBUTE(sec_diff_regs);
static bool pf_q_num_flag;
static int sec_pf_q_num_set(const char *val, const struct kernel_param *kp) static int sec_pf_q_num_set(const char *val, const struct kernel_param *kp)
{ {
pf_q_num_flag = true;
return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_SEC_PF); return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_SEC_PF);
} }
@@ -899,8 +902,7 @@ static int sec_debugfs_init(struct hisi_qm *qm)
qm->debug.sqe_mask_offset = SEC_SQE_MASK_OFFSET; qm->debug.sqe_mask_offset = SEC_SQE_MASK_OFFSET;
qm->debug.sqe_mask_len = SEC_SQE_MASK_LEN; qm->debug.sqe_mask_len = SEC_SQE_MASK_LEN;
ret = hisi_qm_diff_regs_init(qm, sec_diff_regs, ret = hisi_qm_regs_debugfs_init(qm, sec_diff_regs, ARRAY_SIZE(sec_diff_regs));
ARRAY_SIZE(sec_diff_regs));
if (ret) { if (ret) {
dev_warn(dev, "Failed to init SEC diff regs!\n"); dev_warn(dev, "Failed to init SEC diff regs!\n");
goto debugfs_remove; goto debugfs_remove;
@@ -915,7 +917,7 @@ static int sec_debugfs_init(struct hisi_qm *qm)
return 0; return 0;
failed_to_create: failed_to_create:
hisi_qm_diff_regs_uninit(qm, ARRAY_SIZE(sec_diff_regs)); hisi_qm_regs_debugfs_uninit(qm, ARRAY_SIZE(sec_diff_regs));
debugfs_remove: debugfs_remove:
debugfs_remove_recursive(sec_debugfs_root); debugfs_remove_recursive(sec_debugfs_root);
return ret; return ret;
@@ -923,7 +925,7 @@ debugfs_remove:
static void sec_debugfs_exit(struct hisi_qm *qm) static void sec_debugfs_exit(struct hisi_qm *qm)
{ {
hisi_qm_diff_regs_uninit(qm, ARRAY_SIZE(sec_diff_regs)); hisi_qm_regs_debugfs_uninit(qm, ARRAY_SIZE(sec_diff_regs));
debugfs_remove_recursive(qm->debug.debug_root); debugfs_remove_recursive(qm->debug.debug_root);
} }
@@ -1123,6 +1125,8 @@ static int sec_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
qm->qp_num = pf_q_num; qm->qp_num = pf_q_num;
qm->debug.curr_qm_qp_num = pf_q_num; qm->debug.curr_qm_qp_num = pf_q_num;
qm->qm_list = &sec_devices; qm->qm_list = &sec_devices;
if (pf_q_num_flag)
set_bit(QM_MODULE_PARAM, &qm->misc_ctl);
} else if (qm->fun_type == QM_HW_VF && qm->ver == QM_HW_V1) { } else if (qm->fun_type == QM_HW_VF && qm->ver == QM_HW_V1) {
/* /*
* have no way to get qm configure in VM in v1 hardware, * have no way to get qm configure in VM in v1 hardware,

View File

@@ -365,8 +365,11 @@ static u32 uacce_mode = UACCE_MODE_NOUACCE;
module_param_cb(uacce_mode, &zip_uacce_mode_ops, &uacce_mode, 0444); module_param_cb(uacce_mode, &zip_uacce_mode_ops, &uacce_mode, 0444);
MODULE_PARM_DESC(uacce_mode, UACCE_MODE_DESC); MODULE_PARM_DESC(uacce_mode, UACCE_MODE_DESC);
static bool pf_q_num_flag;
static int pf_q_num_set(const char *val, const struct kernel_param *kp) static int pf_q_num_set(const char *val, const struct kernel_param *kp)
{ {
pf_q_num_flag = true;
return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_ZIP_PF); return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_ZIP_PF);
} }
@@ -849,8 +852,7 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm)
qm->debug.sqe_mask_offset = HZIP_SQE_MASK_OFFSET; qm->debug.sqe_mask_offset = HZIP_SQE_MASK_OFFSET;
qm->debug.sqe_mask_len = HZIP_SQE_MASK_LEN; qm->debug.sqe_mask_len = HZIP_SQE_MASK_LEN;
qm->debug.debug_root = dev_d; qm->debug.debug_root = dev_d;
ret = hisi_qm_diff_regs_init(qm, hzip_diff_regs, ret = hisi_qm_regs_debugfs_init(qm, hzip_diff_regs, ARRAY_SIZE(hzip_diff_regs));
ARRAY_SIZE(hzip_diff_regs));
if (ret) { if (ret) {
dev_warn(dev, "Failed to init ZIP diff regs!\n"); dev_warn(dev, "Failed to init ZIP diff regs!\n");
goto debugfs_remove; goto debugfs_remove;
@@ -869,7 +871,7 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm)
return 0; return 0;
failed_to_create: failed_to_create:
hisi_qm_diff_regs_uninit(qm, ARRAY_SIZE(hzip_diff_regs)); hisi_qm_regs_debugfs_uninit(qm, ARRAY_SIZE(hzip_diff_regs));
debugfs_remove: debugfs_remove:
debugfs_remove_recursive(hzip_debugfs_root); debugfs_remove_recursive(hzip_debugfs_root);
return ret; return ret;
@@ -895,7 +897,7 @@ static void hisi_zip_debug_regs_clear(struct hisi_qm *qm)
static void hisi_zip_debugfs_exit(struct hisi_qm *qm) static void hisi_zip_debugfs_exit(struct hisi_qm *qm)
{ {
hisi_qm_diff_regs_uninit(qm, ARRAY_SIZE(hzip_diff_regs)); hisi_qm_regs_debugfs_uninit(qm, ARRAY_SIZE(hzip_diff_regs));
debugfs_remove_recursive(qm->debug.debug_root); debugfs_remove_recursive(qm->debug.debug_root);
@@ -1141,6 +1143,8 @@ static int hisi_zip_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
qm->qp_num = pf_q_num; qm->qp_num = pf_q_num;
qm->debug.curr_qm_qp_num = pf_q_num; qm->debug.curr_qm_qp_num = pf_q_num;
qm->qm_list = &zip_devices; qm->qm_list = &zip_devices;
if (pf_q_num_flag)
set_bit(QM_MODULE_PARAM, &qm->misc_ctl);
} else if (qm->fun_type == QM_HW_VF && qm->ver == QM_HW_V1) { } else if (qm->fun_type == QM_HW_VF && qm->ver == QM_HW_V1) {
/* /*
* have no way to get qm configure in VM in v1 hardware, * have no way to get qm configure in VM in v1 hardware,

Some files were not shown because too many files have changed in this diff Show More