mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
Merge tag 'v5.19-rc7' into android-mainline
Linux 5.19-rc7 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ieda07c96a10bed5974efb6b1b97ae93d8ebd95e9
This commit is contained in:
4
CREDITS
4
CREDITS
@@ -627,6 +627,10 @@ S: 48287 Sawleaf
|
||||
S: Fremont, California 94539
|
||||
S: USA
|
||||
|
||||
N: Tomas Cech
|
||||
E: sleep_walker@suse.com
|
||||
D: arm/palm treo support
|
||||
|
||||
N: Florent Chabaud
|
||||
E: florent.chabaud@polytechnique.org
|
||||
D: software suspend
|
||||
|
||||
@@ -94,6 +94,7 @@ if:
|
||||
- allwinner,sun8i-a83t-display-engine
|
||||
- allwinner,sun8i-r40-display-engine
|
||||
- allwinner,sun9i-a80-display-engine
|
||||
- allwinner,sun20i-d1-display-engine
|
||||
- allwinner,sun50i-a64-display-engine
|
||||
|
||||
then:
|
||||
|
||||
@@ -301,7 +301,7 @@ through which it can issue requests and negotiate::
|
||||
void (*issue_read)(struct netfs_io_subrequest *subreq);
|
||||
bool (*is_still_valid)(struct netfs_io_request *rreq);
|
||||
int (*check_write_begin)(struct file *file, loff_t pos, unsigned len,
|
||||
struct folio *folio, void **_fsdata);
|
||||
struct folio **foliop, void **_fsdata);
|
||||
void (*done)(struct netfs_io_request *rreq);
|
||||
};
|
||||
|
||||
@@ -381,8 +381,10 @@ The operations are as follows:
|
||||
allocated/grabbed the folio to be modified to allow the filesystem to flush
|
||||
conflicting state before allowing it to be modified.
|
||||
|
||||
It should return 0 if everything is now fine, -EAGAIN if the folio should be
|
||||
regrabbed and any other error code to abort the operation.
|
||||
It may unlock and discard the folio it was given and set the caller's folio
|
||||
pointer to NULL. It should return 0 if everything is now fine (``*foliop``
|
||||
left set) or the op should be retried (``*foliop`` cleared) and any other
|
||||
error code to abort the operation.
|
||||
|
||||
* ``done``
|
||||
|
||||
|
||||
@@ -5657,6 +5657,7 @@ by a string of size ``name_size``.
|
||||
#define KVM_STATS_UNIT_BYTES (0x1 << KVM_STATS_UNIT_SHIFT)
|
||||
#define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT)
|
||||
#define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT)
|
||||
#define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT)
|
||||
#define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES
|
||||
|
||||
#define KVM_STATS_BASE_SHIFT 8
|
||||
@@ -5702,14 +5703,13 @@ Bits 0-3 of ``flags`` encode the type:
|
||||
by the ``hist_param`` field. The range of the Nth bucket (1 <= N < ``size``)
|
||||
is [``hist_param``*(N-1), ``hist_param``*N), while the range of the last
|
||||
bucket is [``hist_param``*(``size``-1), +INF). (+INF means positive infinity
|
||||
value.) The bucket value indicates how many samples fell in the bucket's range.
|
||||
value.)
|
||||
* ``KVM_STATS_TYPE_LOG_HIST``
|
||||
The statistic is reported as a logarithmic histogram. The number of
|
||||
buckets is specified by the ``size`` field. The range of the first bucket is
|
||||
[0, 1), while the range of the last bucket is [pow(2, ``size``-2), +INF).
|
||||
Otherwise, The Nth bucket (1 < N < ``size``) covers
|
||||
[pow(2, N-2), pow(2, N-1)). The bucket value indicates how many samples fell
|
||||
in the bucket's range.
|
||||
[pow(2, N-2), pow(2, N-1)).
|
||||
|
||||
Bits 4-7 of ``flags`` encode the unit:
|
||||
|
||||
@@ -5724,6 +5724,15 @@ Bits 4-7 of ``flags`` encode the unit:
|
||||
It indicates that the statistics data is used to measure time or latency.
|
||||
* ``KVM_STATS_UNIT_CYCLES``
|
||||
It indicates that the statistics data is used to measure CPU clock cycles.
|
||||
* ``KVM_STATS_UNIT_BOOLEAN``
|
||||
It indicates that the statistic will always be either 0 or 1. Boolean
|
||||
statistics of "peak" type will never go back from 1 to 0. Boolean
|
||||
statistics can be linear histograms (with two buckets) but not logarithmic
|
||||
histograms.
|
||||
|
||||
Note that, in the case of histograms, the unit applies to the bucket
|
||||
ranges, while the bucket value indicates how many samples fell in the
|
||||
bucket's range.
|
||||
|
||||
Bits 8-11 of ``flags``, together with ``exponent``, encode the scale of the
|
||||
unit:
|
||||
@@ -5746,7 +5755,7 @@ the corresponding statistics data.
|
||||
|
||||
The ``bucket_size`` field is used as a parameter for histogram statistics data.
|
||||
It is only used by linear histogram statistics data, specifying the size of a
|
||||
bucket.
|
||||
bucket in the unit expressed by bits 4-11 of ``flags`` together with ``exponent``.
|
||||
|
||||
The ``name`` field is the name string of the statistics data. The name string
|
||||
starts at the end of ``struct kvm_stats_desc``. The maximum length including
|
||||
|
||||
12
MAINTAINERS
12
MAINTAINERS
@@ -2498,10 +2498,8 @@ F: drivers/power/reset/oxnas-restart.c
|
||||
N: oxnas
|
||||
|
||||
ARM/PALM TREO SUPPORT
|
||||
M: Tomas Cech <sleep_walker@suse.com>
|
||||
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
|
||||
S: Maintained
|
||||
W: http://hackndev.com
|
||||
S: Orphan
|
||||
F: arch/arm/mach-pxa/palmtreo.*
|
||||
|
||||
ARM/PALMTX,PALMT5,PALMLD,PALMTE2,PALMTC SUPPORT
|
||||
@@ -14371,7 +14369,8 @@ S: Maintained
|
||||
F: drivers/net/phy/nxp-c45-tja11xx.c
|
||||
|
||||
NXP FSPI DRIVER
|
||||
M: Ashish Kumar <ashish.kumar@nxp.com>
|
||||
M: Han Xu <han.xu@nxp.com>
|
||||
M: Haibo Chen <haibo.chen@nxp.com>
|
||||
R: Yogesh Gaur <yogeshgaur.83@gmail.com>
|
||||
L: linux-spi@vger.kernel.org
|
||||
S: Maintained
|
||||
@@ -17281,12 +17280,15 @@ N: riscv
|
||||
K: riscv
|
||||
|
||||
RISC-V/MICROCHIP POLARFIRE SOC SUPPORT
|
||||
M: Lewis Hanly <lewis.hanly@microchip.com>
|
||||
M: Conor Dooley <conor.dooley@microchip.com>
|
||||
M: Daire McNamara <daire.mcnamara@microchip.com>
|
||||
L: linux-riscv@lists.infradead.org
|
||||
S: Supported
|
||||
F: arch/riscv/boot/dts/microchip/
|
||||
F: drivers/char/hw_random/mpfs-rng.c
|
||||
F: drivers/clk/microchip/clk-mpfs.c
|
||||
F: drivers/mailbox/mailbox-mpfs.c
|
||||
F: drivers/pci/controller/pcie-microchip-host.c
|
||||
F: drivers/soc/microchip/
|
||||
F: include/soc/microchip/mpfs.h
|
||||
|
||||
|
||||
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@
|
||||
VERSION = 5
|
||||
PATCHLEVEL = 19
|
||||
SUBLEVEL = 0
|
||||
EXTRAVERSION = -rc6
|
||||
EXTRAVERSION = -rc7
|
||||
NAME = Superb Owl
|
||||
|
||||
# *DOCUMENTATION*
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
reg = <0x28>;
|
||||
#gpio-cells = <2>;
|
||||
gpio-controller;
|
||||
ngpio = <32>;
|
||||
ngpios = <62>;
|
||||
};
|
||||
|
||||
sgtl5000: codec@a {
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
atmel_mxt_ts: touchscreen@4a {
|
||||
compatible = "atmel,maxtouch";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_atmel_conn>;
|
||||
pinctrl-0 = <&pinctrl_atmel_conn &pinctrl_atmel_snvs_conn>;
|
||||
reg = <0x4a>;
|
||||
interrupt-parent = <&gpio5>;
|
||||
interrupts = <4 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 107 / INT */
|
||||
@@ -331,7 +331,6 @@
|
||||
pinctrl_atmel_conn: atmelconngrp {
|
||||
fsl,pins = <
|
||||
MX6UL_PAD_JTAG_MOD__GPIO1_IO10 0xb0a0 /* SODIMM 106 */
|
||||
MX6ULL_PAD_SNVS_TAMPER4__GPIO5_IO04 0xb0a0 /* SODIMM 107 */
|
||||
>;
|
||||
};
|
||||
|
||||
@@ -684,6 +683,12 @@
|
||||
};
|
||||
|
||||
&iomuxc_snvs {
|
||||
pinctrl_atmel_snvs_conn: atmelsnvsconngrp {
|
||||
fsl,pins = <
|
||||
MX6ULL_PAD_SNVS_TAMPER4__GPIO5_IO04 0xb0a0 /* SODIMM 107 */
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_snvs_gpio1: snvsgpio1grp {
|
||||
fsl,pins = <
|
||||
MX6ULL_PAD_SNVS_TAMPER6__GPIO5_IO06 0x110a0 /* SODIMM 93 */
|
||||
|
||||
@@ -87,22 +87,22 @@
|
||||
|
||||
phy4: ethernet-phy@5 {
|
||||
reg = <5>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_ACTIVE_HIGH>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_OPEN_DRAIN>;
|
||||
};
|
||||
|
||||
phy5: ethernet-phy@6 {
|
||||
reg = <6>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_ACTIVE_HIGH>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_OPEN_DRAIN>;
|
||||
};
|
||||
|
||||
phy6: ethernet-phy@7 {
|
||||
reg = <7>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_ACTIVE_HIGH>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_OPEN_DRAIN>;
|
||||
};
|
||||
|
||||
phy7: ethernet-phy@8 {
|
||||
reg = <8>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_ACTIVE_HIGH>;
|
||||
coma-mode-gpios = <&gpio 37 GPIO_OPEN_DRAIN>;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -506,6 +506,8 @@
|
||||
interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
|
||||
clock-names = "core", "iface";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&blsp1_uart2_default>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -581,6 +583,9 @@
|
||||
interrupts = <GIC_SPI 113 IRQ_TYPE_NONE>;
|
||||
clocks = <&gcc GCC_BLSP2_UART1_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>;
|
||||
clock-names = "core", "iface";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&blsp2_uart1_default>;
|
||||
pinctrl-1 = <&blsp2_uart1_sleep>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -599,6 +604,8 @@
|
||||
interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&gcc GCC_BLSP2_UART4_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>;
|
||||
clock-names = "core", "iface";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&blsp2_uart4_default>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@@ -639,6 +646,9 @@
|
||||
interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&gcc GCC_BLSP2_QUP6_I2C_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>;
|
||||
clock-names = "core", "iface";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&blsp2_i2c6_default>;
|
||||
pinctrl-1 = <&blsp2_i2c6_sleep>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
};
|
||||
@@ -1256,7 +1266,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
blsp1_uart2_active: blsp1-uart2-active {
|
||||
blsp1_uart2_default: blsp1-uart2-default {
|
||||
rx {
|
||||
pins = "gpio5";
|
||||
function = "blsp_uart2";
|
||||
@@ -1272,7 +1282,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
blsp2_uart1_active: blsp2-uart1-active {
|
||||
blsp2_uart1_default: blsp2-uart1-default {
|
||||
tx-rts {
|
||||
pins = "gpio41", "gpio44";
|
||||
function = "blsp_uart7";
|
||||
@@ -1295,7 +1305,7 @@
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
blsp2_uart4_active: blsp2-uart4-active {
|
||||
blsp2_uart4_default: blsp2-uart4-default {
|
||||
tx-rts {
|
||||
pins = "gpio53", "gpio56";
|
||||
function = "blsp_uart10";
|
||||
@@ -1406,7 +1416,19 @@
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
/* BLSP2_I2C6 info is missing - nobody uses it though? */
|
||||
blsp2_i2c6_default: blsp2-i2c6-default {
|
||||
pins = "gpio87", "gpio88";
|
||||
function = "blsp_i2c12";
|
||||
drive-strength = <2>;
|
||||
bias-disable;
|
||||
};
|
||||
|
||||
blsp2_i2c6_sleep: blsp2-i2c6-sleep {
|
||||
pins = "gpio87", "gpio88";
|
||||
function = "blsp_i2c12";
|
||||
drive-strength = <2>;
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
spi8_default: spi8_default {
|
||||
mosi {
|
||||
|
||||
@@ -1124,7 +1124,7 @@
|
||||
clocks = <&pmc PMC_TYPE_PERIPHERAL 55>, <&pmc PMC_TYPE_GCK 55>;
|
||||
clock-names = "pclk", "gclk";
|
||||
assigned-clocks = <&pmc PMC_TYPE_CORE PMC_I2S1_MUX>;
|
||||
assigned-parrents = <&pmc PMC_TYPE_GCK 55>;
|
||||
assigned-clock-parents = <&pmc PMC_TYPE_GCK 55>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
flash@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
compatible = "mxicy,mx25l1606e", "winbond,w25q128";
|
||||
compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <40000000>;
|
||||
};
|
||||
|
||||
@@ -311,7 +311,7 @@ void __init rockchip_suspend_init(void)
|
||||
&match);
|
||||
if (!match) {
|
||||
pr_err("Failed to find PMU node\n");
|
||||
return;
|
||||
goto out_put;
|
||||
}
|
||||
pm_data = (struct rockchip_pm_data *) match->data;
|
||||
|
||||
@@ -320,9 +320,12 @@ void __init rockchip_suspend_init(void)
|
||||
|
||||
if (ret) {
|
||||
pr_err("%s: matches init error %d\n", __func__, ret);
|
||||
return;
|
||||
goto out_put;
|
||||
}
|
||||
}
|
||||
|
||||
suspend_set_ops(pm_data->ops);
|
||||
|
||||
out_put:
|
||||
of_node_put(np);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
/delete-node/ cpu@3;
|
||||
};
|
||||
|
||||
timer {
|
||||
compatible = "arm,armv8-timer";
|
||||
interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
|
||||
<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
|
||||
<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
|
||||
<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>;
|
||||
};
|
||||
|
||||
pmu {
|
||||
compatible = "arm,cortex-a53-pmu";
|
||||
interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
device_type = "cpu";
|
||||
compatible = "brcm,brahma-b53";
|
||||
reg = <0x0>;
|
||||
enable-method = "spin-table";
|
||||
cpu-release-addr = <0x0 0xfff8>;
|
||||
next-level-cache = <&l2>;
|
||||
};
|
||||
|
||||
|
||||
@@ -224,9 +224,12 @@
|
||||
little-endian;
|
||||
};
|
||||
|
||||
efuse@1e80000 {
|
||||
sfp: efuse@1e80000 {
|
||||
compatible = "fsl,ls1028a-sfp";
|
||||
reg = <0x0 0x1e80000 0x0 0x10000>;
|
||||
clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL
|
||||
QORIQ_CLK_PLL_DIV(4)>;
|
||||
clock-names = "sfp";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
|
||||
@@ -376,7 +376,8 @@ camera: &i2c7 {
|
||||
<&cru ACLK_VIO>,
|
||||
<&cru ACLK_GIC_PRE>,
|
||||
<&cru PCLK_DDR>,
|
||||
<&cru ACLK_HDCP>;
|
||||
<&cru ACLK_HDCP>,
|
||||
<&cru ACLK_VDU>;
|
||||
assigned-clock-rates =
|
||||
<600000000>, <1600000000>,
|
||||
<1000000000>,
|
||||
@@ -388,6 +389,7 @@ camera: &i2c7 {
|
||||
<400000000>,
|
||||
<200000000>,
|
||||
<200000000>,
|
||||
<400000000>,
|
||||
<400000000>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1462,7 +1462,8 @@
|
||||
<&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>,
|
||||
<&cru ACLK_VIO>, <&cru ACLK_HDCP>,
|
||||
<&cru ACLK_GIC_PRE>,
|
||||
<&cru PCLK_DDR>;
|
||||
<&cru PCLK_DDR>,
|
||||
<&cru ACLK_VDU>;
|
||||
assigned-clock-rates =
|
||||
<594000000>, <800000000>,
|
||||
<1000000000>,
|
||||
@@ -1473,7 +1474,8 @@
|
||||
<100000000>, <50000000>,
|
||||
<400000000>, <400000000>,
|
||||
<200000000>,
|
||||
<200000000>;
|
||||
<200000000>,
|
||||
<400000000>;
|
||||
};
|
||||
|
||||
grf: syscon@ff770000 {
|
||||
|
||||
@@ -687,6 +687,7 @@
|
||||
};
|
||||
|
||||
&usb_host0_xhci {
|
||||
dr_mode = "host";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>;
|
||||
assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>;
|
||||
clock_in_out = "input";
|
||||
phy-mode = "rgmii-id";
|
||||
phy-mode = "rgmii";
|
||||
phy-supply = <&vcc_3v3>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gmac1m1_miim
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
riscv,isa = "rv64imafdc";
|
||||
clocks = <&clkcfg CLK_CPU>;
|
||||
tlb-split;
|
||||
next-level-cache = <&cctrllr>;
|
||||
status = "okay";
|
||||
|
||||
cpu1_intc: interrupt-controller {
|
||||
@@ -77,6 +78,7 @@
|
||||
riscv,isa = "rv64imafdc";
|
||||
clocks = <&clkcfg CLK_CPU>;
|
||||
tlb-split;
|
||||
next-level-cache = <&cctrllr>;
|
||||
status = "okay";
|
||||
|
||||
cpu2_intc: interrupt-controller {
|
||||
@@ -104,6 +106,7 @@
|
||||
riscv,isa = "rv64imafdc";
|
||||
clocks = <&clkcfg CLK_CPU>;
|
||||
tlb-split;
|
||||
next-level-cache = <&cctrllr>;
|
||||
status = "okay";
|
||||
|
||||
cpu3_intc: interrupt-controller {
|
||||
@@ -131,6 +134,7 @@
|
||||
riscv,isa = "rv64imafdc";
|
||||
clocks = <&clkcfg CLK_CPU>;
|
||||
tlb-split;
|
||||
next-level-cache = <&cctrllr>;
|
||||
status = "okay";
|
||||
cpu4_intc: interrupt-controller {
|
||||
#interrupt-cells = <1>;
|
||||
|
||||
@@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin,
|
||||
cpu_apply_errata |= tmp;
|
||||
}
|
||||
}
|
||||
if (cpu_apply_errata != cpu_req_errata)
|
||||
if (stage != RISCV_ALTERNATIVES_MODULE &&
|
||||
cpu_apply_errata != cpu_req_errata)
|
||||
warn_miss_errata(cpu_req_errata - cpu_apply_errata);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ static inline pud_t pfn_pud(unsigned long pfn, pgprot_t prot)
|
||||
|
||||
static inline unsigned long _pud_pfn(pud_t pud)
|
||||
{
|
||||
return pud_val(pud) >> _PAGE_PFN_SHIFT;
|
||||
return __page_val_to_pfn(pud_val(pud));
|
||||
}
|
||||
|
||||
static inline pmd_t *pud_pgtable(pud_t pud)
|
||||
@@ -278,13 +278,13 @@ static inline p4d_t pfn_p4d(unsigned long pfn, pgprot_t prot)
|
||||
|
||||
static inline unsigned long _p4d_pfn(p4d_t p4d)
|
||||
{
|
||||
return p4d_val(p4d) >> _PAGE_PFN_SHIFT;
|
||||
return __page_val_to_pfn(p4d_val(p4d));
|
||||
}
|
||||
|
||||
static inline pud_t *p4d_pgtable(p4d_t p4d)
|
||||
{
|
||||
if (pgtable_l4_enabled)
|
||||
return (pud_t *)pfn_to_virt(p4d_val(p4d) >> _PAGE_PFN_SHIFT);
|
||||
return (pud_t *)pfn_to_virt(__page_val_to_pfn(p4d_val(p4d)));
|
||||
|
||||
return (pud_t *)pud_pgtable((pud_t) { p4d_val(p4d) });
|
||||
}
|
||||
@@ -292,7 +292,7 @@ static inline pud_t *p4d_pgtable(p4d_t p4d)
|
||||
|
||||
static inline struct page *p4d_page(p4d_t p4d)
|
||||
{
|
||||
return pfn_to_page(p4d_val(p4d) >> _PAGE_PFN_SHIFT);
|
||||
return pfn_to_page(__page_val_to_pfn(p4d_val(p4d)));
|
||||
}
|
||||
|
||||
#define pud_index(addr) (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
|
||||
@@ -347,7 +347,7 @@ static inline void pgd_clear(pgd_t *pgd)
|
||||
static inline p4d_t *pgd_pgtable(pgd_t pgd)
|
||||
{
|
||||
if (pgtable_l5_enabled)
|
||||
return (p4d_t *)pfn_to_virt(pgd_val(pgd) >> _PAGE_PFN_SHIFT);
|
||||
return (p4d_t *)pfn_to_virt(__page_val_to_pfn(pgd_val(pgd)));
|
||||
|
||||
return (p4d_t *)p4d_pgtable((p4d_t) { pgd_val(pgd) });
|
||||
}
|
||||
@@ -355,7 +355,7 @@ static inline p4d_t *pgd_pgtable(pgd_t pgd)
|
||||
|
||||
static inline struct page *pgd_page(pgd_t pgd)
|
||||
{
|
||||
return pfn_to_page(pgd_val(pgd) >> _PAGE_PFN_SHIFT);
|
||||
return pfn_to_page(__page_val_to_pfn(pgd_val(pgd)));
|
||||
}
|
||||
#define pgd_page(pgd) pgd_page(pgd)
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ static inline pgd_t pfn_pgd(unsigned long pfn, pgprot_t prot)
|
||||
|
||||
static inline unsigned long _pgd_pfn(pgd_t pgd)
|
||||
{
|
||||
return pgd_val(pgd) >> _PAGE_PFN_SHIFT;
|
||||
return __page_val_to_pfn(pgd_val(pgd));
|
||||
}
|
||||
|
||||
static inline struct page *pmd_page(pmd_t pmd)
|
||||
@@ -590,14 +590,14 @@ static inline pmd_t pmd_mkinvalid(pmd_t pmd)
|
||||
return __pmd(pmd_val(pmd) & ~(_PAGE_PRESENT|_PAGE_PROT_NONE));
|
||||
}
|
||||
|
||||
#define __pmd_to_phys(pmd) (pmd_val(pmd) >> _PAGE_PFN_SHIFT << PAGE_SHIFT)
|
||||
#define __pmd_to_phys(pmd) (__page_val_to_pfn(pmd_val(pmd)) << PAGE_SHIFT)
|
||||
|
||||
static inline unsigned long pmd_pfn(pmd_t pmd)
|
||||
{
|
||||
return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
|
||||
}
|
||||
|
||||
#define __pud_to_phys(pud) (pud_val(pud) >> _PAGE_PFN_SHIFT << PAGE_SHIFT)
|
||||
#define __pud_to_phys(pud) (__page_val_to_pfn(pud_val(pud)) << PAGE_SHIFT)
|
||||
|
||||
static inline unsigned long pud_pfn(pud_t pud)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ static inline unsigned long gstage_pte_index(gpa_t addr, u32 level)
|
||||
|
||||
static inline unsigned long gstage_pte_page_vaddr(pte_t pte)
|
||||
{
|
||||
return (unsigned long)pfn_to_virt(pte_val(pte) >> _PAGE_PFN_SHIFT);
|
||||
return (unsigned long)pfn_to_virt(__page_val_to_pfn(pte_val(pte)));
|
||||
}
|
||||
|
||||
static int gstage_page_size_to_level(unsigned long page_size, u32 *out_level)
|
||||
|
||||
@@ -781,9 +781,11 @@ static void kvm_riscv_check_vcpu_requests(struct kvm_vcpu *vcpu)
|
||||
|
||||
if (kvm_request_pending(vcpu)) {
|
||||
if (kvm_check_request(KVM_REQ_SLEEP, vcpu)) {
|
||||
kvm_vcpu_srcu_read_unlock(vcpu);
|
||||
rcuwait_wait_event(wait,
|
||||
(!vcpu->arch.power_off) && (!vcpu->arch.pause),
|
||||
TASK_INTERRUPTIBLE);
|
||||
kvm_vcpu_srcu_read_lock(vcpu);
|
||||
|
||||
if (vcpu->arch.power_off || vcpu->arch.pause) {
|
||||
/*
|
||||
|
||||
@@ -82,7 +82,7 @@ endif
|
||||
|
||||
ifdef CONFIG_EXPOLINE
|
||||
ifdef CONFIG_EXPOLINE_EXTERN
|
||||
KBUILD_LDFLAGS_MODULE += arch/s390/lib/expoline.o
|
||||
KBUILD_LDFLAGS_MODULE += arch/s390/lib/expoline/expoline.o
|
||||
CC_FLAGS_EXPOLINE := -mindirect-branch=thunk-extern
|
||||
CC_FLAGS_EXPOLINE += -mfunction-return=thunk-extern
|
||||
else
|
||||
@@ -163,6 +163,12 @@ vdso_prepare: prepare0
|
||||
$(Q)$(MAKE) $(build)=arch/s390/kernel/vdso64 include/generated/vdso64-offsets.h
|
||||
$(if $(CONFIG_COMPAT),$(Q)$(MAKE) \
|
||||
$(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h)
|
||||
|
||||
ifdef CONFIG_EXPOLINE_EXTERN
|
||||
modules_prepare: expoline_prepare
|
||||
expoline_prepare:
|
||||
$(Q)$(MAKE) $(build)=arch/s390/lib/expoline arch/s390/lib/expoline/expoline.o
|
||||
endif
|
||||
endif
|
||||
|
||||
# Don't use tabs in echo arguments
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#ifndef _ASM_S390_NOSPEC_ASM_H
|
||||
#define _ASM_S390_NOSPEC_ASM_H
|
||||
|
||||
#include <asm/alternative-asm.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/dwarf.h>
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
|
||||
@@ -7,7 +7,6 @@ lib-y += delay.o string.o uaccess.o find.o spinlock.o
|
||||
obj-y += mem.o xor.o
|
||||
lib-$(CONFIG_KPROBES) += probes.o
|
||||
lib-$(CONFIG_UPROBES) += probes.o
|
||||
obj-$(CONFIG_EXPOLINE_EXTERN) += expoline.o
|
||||
obj-$(CONFIG_S390_KPROBES_SANITY_TEST) += test_kprobes_s390.o
|
||||
test_kprobes_s390-objs += test_kprobes_asm.o test_kprobes.o
|
||||
|
||||
@@ -22,3 +21,5 @@ obj-$(CONFIG_S390_MODULES_SANITY_TEST) += test_modules.o
|
||||
obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) += test_modules_helpers.o
|
||||
|
||||
lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
|
||||
|
||||
obj-$(CONFIG_EXPOLINE_EXTERN) += expoline/
|
||||
|
||||
3
arch/s390/lib/expoline/Makefile
Normal file
3
arch/s390/lib/expoline/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
obj-y += expoline.o
|
||||
@@ -432,6 +432,10 @@ void apply_retpolines(s32 *start, s32 *end)
|
||||
{
|
||||
}
|
||||
|
||||
void apply_returns(s32 *start, s32 *end)
|
||||
{
|
||||
}
|
||||
|
||||
void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -727,7 +727,6 @@ native_irq_return_ldt:
|
||||
pushq %rdi /* Stash user RDI */
|
||||
swapgs /* to kernel GS */
|
||||
SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi /* to kernel CR3 */
|
||||
UNTRAIN_RET
|
||||
|
||||
movq PER_CPU_VAR(espfix_waddr), %rdi
|
||||
movq %rax, (0*8)(%rdi) /* user RAX */
|
||||
|
||||
@@ -16,6 +16,12 @@ bool cpc_supported_by_cpu(void)
|
||||
switch (boot_cpu_data.x86_vendor) {
|
||||
case X86_VENDOR_AMD:
|
||||
case X86_VENDOR_HYGON:
|
||||
if (boot_cpu_data.x86 == 0x19 && ((boot_cpu_data.x86_model <= 0x0f) ||
|
||||
(boot_cpu_data.x86_model >= 0x20 && boot_cpu_data.x86_model <= 0x2f)))
|
||||
return true;
|
||||
else if (boot_cpu_data.x86 == 0x17 &&
|
||||
boot_cpu_data.x86_model >= 0x70 && boot_cpu_data.x86_model <= 0x7f)
|
||||
return true;
|
||||
return boot_cpu_has(X86_FEATURE_CPPC);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -793,7 +793,7 @@ enum retbleed_mitigation_cmd {
|
||||
RETBLEED_CMD_IBPB,
|
||||
};
|
||||
|
||||
const char * const retbleed_strings[] = {
|
||||
static const char * const retbleed_strings[] = {
|
||||
[RETBLEED_MITIGATION_NONE] = "Vulnerable",
|
||||
[RETBLEED_MITIGATION_UNRET] = "Mitigation: untrained return thunk",
|
||||
[RETBLEED_MITIGATION_IBPB] = "Mitigation: IBPB",
|
||||
@@ -1181,7 +1181,7 @@ spectre_v2_user_select_mitigation(void)
|
||||
if (retbleed_mitigation == RETBLEED_MITIGATION_UNRET) {
|
||||
if (mode != SPECTRE_V2_USER_STRICT &&
|
||||
mode != SPECTRE_V2_USER_STRICT_PREFERRED)
|
||||
pr_info("Selecting STIBP always-on mode to complement retbleed mitigation'\n");
|
||||
pr_info("Selecting STIBP always-on mode to complement retbleed mitigation\n");
|
||||
mode = SPECTRE_V2_USER_STRICT_PREFERRED;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <asm/cpufeatures.h>
|
||||
#include <asm/percpu.h>
|
||||
#include <asm/nops.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
#include <asm/bootparam.h>
|
||||
#include <asm/export.h>
|
||||
#include <asm/pgtable_32.h>
|
||||
|
||||
@@ -189,9 +189,6 @@
|
||||
#define X8(x...) X4(x), X4(x)
|
||||
#define X16(x...) X8(x), X8(x)
|
||||
|
||||
#define NR_FASTOP (ilog2(sizeof(ulong)) + 1)
|
||||
#define FASTOP_SIZE (8 * (1 + HAS_KERNEL_IBT))
|
||||
|
||||
struct opcode {
|
||||
u64 flags;
|
||||
u8 intercept;
|
||||
@@ -306,9 +303,15 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
|
||||
* Moreover, they are all exactly FASTOP_SIZE bytes long, so functions for
|
||||
* different operand sizes can be reached by calculation, rather than a jump
|
||||
* table (which would be bigger than the code).
|
||||
*
|
||||
* The 16 byte alignment, considering 5 bytes for the RET thunk, 3 for ENDBR
|
||||
* and 1 for the straight line speculation INT3, leaves 7 bytes for the
|
||||
* body of the function. Currently none is larger than 4.
|
||||
*/
|
||||
static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);
|
||||
|
||||
#define FASTOP_SIZE 16
|
||||
|
||||
#define __FOP_FUNC(name) \
|
||||
".align " __stringify(FASTOP_SIZE) " \n\t" \
|
||||
".type " name ", @function \n\t" \
|
||||
@@ -442,11 +445,7 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);
|
||||
* RET | JMP __x86_return_thunk [1,5 bytes; CONFIG_RETHUNK]
|
||||
* INT3 [1 byte; CONFIG_SLS]
|
||||
*/
|
||||
#define RET_LENGTH (1 + (4 * IS_ENABLED(CONFIG_RETHUNK)) + \
|
||||
IS_ENABLED(CONFIG_SLS))
|
||||
#define SETCC_LENGTH (ENDBR_INSN_SIZE + 3 + RET_LENGTH)
|
||||
#define SETCC_ALIGN (4 << ((SETCC_LENGTH > 4) & 1) << ((SETCC_LENGTH > 8) & 1))
|
||||
static_assert(SETCC_LENGTH <= SETCC_ALIGN);
|
||||
#define SETCC_ALIGN 16
|
||||
|
||||
#define FOP_SETCC(op) \
|
||||
".align " __stringify(SETCC_ALIGN) " \n\t" \
|
||||
|
||||
@@ -2278,7 +2278,6 @@ static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct loaded_vmcs *vmcs0
|
||||
SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
|
||||
SECONDARY_EXEC_APIC_REGISTER_VIRT |
|
||||
SECONDARY_EXEC_ENABLE_VMFUNC |
|
||||
SECONDARY_EXEC_TSC_SCALING |
|
||||
SECONDARY_EXEC_DESC);
|
||||
|
||||
if (nested_cpu_has(vmcs12,
|
||||
|
||||
@@ -298,7 +298,7 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = {
|
||||
STATS_DESC_COUNTER(VCPU, directed_yield_successful),
|
||||
STATS_DESC_COUNTER(VCPU, preemption_reported),
|
||||
STATS_DESC_COUNTER(VCPU, preemption_other),
|
||||
STATS_DESC_ICOUNTER(VCPU, guest_mode)
|
||||
STATS_DESC_IBOOLEAN(VCPU, guest_mode)
|
||||
};
|
||||
|
||||
const struct kvm_stats_header kvm_vcpu_stats_header = {
|
||||
@@ -9143,15 +9143,17 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr,
|
||||
*/
|
||||
static void kvm_pv_kick_cpu_op(struct kvm *kvm, int apicid)
|
||||
{
|
||||
struct kvm_lapic_irq lapic_irq;
|
||||
/*
|
||||
* All other fields are unused for APIC_DM_REMRD, but may be consumed by
|
||||
* common code, e.g. for tracing. Defer initialization to the compiler.
|
||||
*/
|
||||
struct kvm_lapic_irq lapic_irq = {
|
||||
.delivery_mode = APIC_DM_REMRD,
|
||||
.dest_mode = APIC_DEST_PHYSICAL,
|
||||
.shorthand = APIC_DEST_NOSHORT,
|
||||
.dest_id = apicid,
|
||||
};
|
||||
|
||||
lapic_irq.shorthand = APIC_DEST_NOSHORT;
|
||||
lapic_irq.dest_mode = APIC_DEST_PHYSICAL;
|
||||
lapic_irq.level = 0;
|
||||
lapic_irq.dest_id = apicid;
|
||||
lapic_irq.msi_redir_hint = false;
|
||||
|
||||
lapic_irq.delivery_mode = APIC_DM_REMRD;
|
||||
kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,10 +77,20 @@ static uint8_t __pte2cachemode_tbl[8] = {
|
||||
[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
|
||||
};
|
||||
|
||||
/* Check that the write-protect PAT entry is set for write-protect */
|
||||
/*
|
||||
* Check that the write-protect PAT entry is set for write-protect.
|
||||
* To do this without making assumptions how PAT has been set up (Xen has
|
||||
* another layout than the kernel), translate the _PAGE_CACHE_MODE_WP cache
|
||||
* mode via the __cachemode2pte_tbl[] into protection bits (those protection
|
||||
* bits will select a cache mode of WP or better), and then translate the
|
||||
* protection bits back into the cache mode using __pte2cm_idx() and the
|
||||
* __pte2cachemode_tbl[] array. This will return the really used cache mode.
|
||||
*/
|
||||
bool x86_has_pat_wp(void)
|
||||
{
|
||||
return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] == _PAGE_CACHE_MODE_WP;
|
||||
uint16_t prot = __cachemode2pte_tbl[_PAGE_CACHE_MODE_WP];
|
||||
|
||||
return __pte2cachemode_tbl[__pte2cm_idx(prot)] == _PAGE_CACHE_MODE_WP;
|
||||
}
|
||||
|
||||
enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <linux/objtool.h>
|
||||
#include <asm/page_types.h>
|
||||
#include <asm/segment.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
.text
|
||||
.code64
|
||||
@@ -75,7 +76,9 @@ STACK_FRAME_NON_STANDARD __efi64_thunk
|
||||
1: movq 0x20(%rsp), %rsp
|
||||
pop %rbx
|
||||
pop %rbp
|
||||
RET
|
||||
ANNOTATE_UNRET_SAFE
|
||||
ret
|
||||
int3
|
||||
|
||||
.code32
|
||||
2: pushl $__KERNEL_CS
|
||||
|
||||
@@ -345,6 +345,7 @@ void __blk_queue_split(struct request_queue *q, struct bio **bio,
|
||||
/* there isn't chance to merge the splitted bio */
|
||||
split->bi_opf |= REQ_NOMERGE;
|
||||
|
||||
blkcg_bio_issue_init(split);
|
||||
bio_chain(split, *bio);
|
||||
trace_block_split(split, (*bio)->bi_iter.bi_sector);
|
||||
submit_bio_noacct(*bio);
|
||||
|
||||
@@ -73,7 +73,7 @@ module_param(device_id_scheme, bool, 0444);
|
||||
static int only_lcd = -1;
|
||||
module_param(only_lcd, int, 0444);
|
||||
|
||||
static bool has_backlight;
|
||||
static bool may_report_brightness_keys;
|
||||
static int register_count;
|
||||
static DEFINE_MUTEX(register_count_mutex);
|
||||
static DEFINE_MUTEX(video_list_lock);
|
||||
@@ -1224,7 +1224,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
|
||||
acpi_video_device_find_cap(data);
|
||||
|
||||
if (data->cap._BCM && data->cap._BCL)
|
||||
has_backlight = true;
|
||||
may_report_brightness_keys = true;
|
||||
|
||||
mutex_lock(&video->device_list_lock);
|
||||
list_add_tail(&data->entry, &video->video_device_list);
|
||||
@@ -1693,6 +1693,9 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
|
||||
break;
|
||||
}
|
||||
|
||||
if (keycode)
|
||||
may_report_brightness_keys = true;
|
||||
|
||||
acpi_notifier_call_chain(device, event, 0);
|
||||
|
||||
if (keycode && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS)) {
|
||||
@@ -2253,7 +2256,7 @@ void acpi_video_unregister(void)
|
||||
if (register_count) {
|
||||
acpi_bus_unregister_driver(&acpi_video_bus);
|
||||
register_count = 0;
|
||||
has_backlight = false;
|
||||
may_report_brightness_keys = false;
|
||||
}
|
||||
mutex_unlock(®ister_count_mutex);
|
||||
}
|
||||
@@ -2275,7 +2278,7 @@ void acpi_video_unregister_backlight(void)
|
||||
|
||||
bool acpi_video_handles_brightness_key_presses(void)
|
||||
{
|
||||
return has_backlight &&
|
||||
return may_report_brightness_keys &&
|
||||
(report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses);
|
||||
|
||||
@@ -1174,7 +1174,7 @@ static void __cold entropy_timer(struct timer_list *timer)
|
||||
*/
|
||||
static void __cold try_to_generate_entropy(void)
|
||||
{
|
||||
enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = 32 };
|
||||
enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = HZ / 30 };
|
||||
struct entropy_timer_state stack;
|
||||
unsigned int i, num_different = 0;
|
||||
unsigned long last = random_get_entropy();
|
||||
|
||||
@@ -439,9 +439,13 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
|
||||
|
||||
/* Both presence and absence of sram regulator are valid cases. */
|
||||
info->sram_reg = regulator_get_optional(cpu_dev, "sram");
|
||||
if (IS_ERR(info->sram_reg))
|
||||
if (IS_ERR(info->sram_reg)) {
|
||||
ret = PTR_ERR(info->sram_reg);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
goto out_free_resources;
|
||||
|
||||
info->sram_reg = NULL;
|
||||
else {
|
||||
} else {
|
||||
ret = regulator_enable(info->sram_reg);
|
||||
if (ret) {
|
||||
dev_warn(cpu_dev, "cpu%d: failed to enable vsram\n", cpu);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <linux/efi.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
static void (*orig_pm_power_off)(void);
|
||||
static struct sys_off_handler *efi_sys_off_handler;
|
||||
|
||||
int efi_reboot_quirk_mode = -1;
|
||||
|
||||
@@ -51,15 +51,11 @@ bool __weak efi_poweroff_required(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void efi_power_off(void)
|
||||
static int efi_power_off(struct sys_off_data *data)
|
||||
{
|
||||
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
|
||||
/*
|
||||
* The above call should not return, if it does fall back to
|
||||
* the original power off method (typically ACPI poweroff).
|
||||
*/
|
||||
if (orig_pm_power_off)
|
||||
orig_pm_power_off();
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static int __init efi_shutdown_init(void)
|
||||
@@ -68,8 +64,13 @@ static int __init efi_shutdown_init(void)
|
||||
return -ENODEV;
|
||||
|
||||
if (efi_poweroff_required()) {
|
||||
orig_pm_power_off = pm_power_off;
|
||||
pm_power_off = efi_power_off;
|
||||
/* SYS_OFF_PRIO_FIRMWARE + 1 so that it runs before acpi_power_off */
|
||||
efi_sys_off_handler =
|
||||
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
|
||||
SYS_OFF_PRIO_FIRMWARE + 1,
|
||||
efi_power_off, NULL);
|
||||
if (IS_ERR(efi_sys_off_handler))
|
||||
return PTR_ERR(efi_sys_off_handler);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -991,28 +991,22 @@ static struct configfs_attribute *gpio_sim_device_config_attrs[] = {
|
||||
};
|
||||
|
||||
struct gpio_sim_chip_name_ctx {
|
||||
struct gpio_sim_device *dev;
|
||||
struct fwnode_handle *swnode;
|
||||
char *page;
|
||||
};
|
||||
|
||||
static int gpio_sim_emit_chip_name(struct device *dev, void *data)
|
||||
{
|
||||
struct gpio_sim_chip_name_ctx *ctx = data;
|
||||
struct fwnode_handle *swnode;
|
||||
struct gpio_sim_bank *bank;
|
||||
|
||||
/* This would be the sysfs device exported in /sys/class/gpio. */
|
||||
if (dev->class)
|
||||
return 0;
|
||||
|
||||
swnode = dev_fwnode(dev);
|
||||
if (device_match_fwnode(dev, ctx->swnode))
|
||||
return sprintf(ctx->page, "%s\n", dev_name(dev));
|
||||
|
||||
list_for_each_entry(bank, &ctx->dev->bank_list, siblings) {
|
||||
if (bank->swnode == swnode)
|
||||
return sprintf(ctx->page, "%s\n", dev_name(dev));
|
||||
}
|
||||
|
||||
return -ENODATA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t gpio_sim_bank_config_chip_name_show(struct config_item *item,
|
||||
@@ -1020,7 +1014,7 @@ static ssize_t gpio_sim_bank_config_chip_name_show(struct config_item *item,
|
||||
{
|
||||
struct gpio_sim_bank *bank = to_gpio_sim_bank(item);
|
||||
struct gpio_sim_device *dev = gpio_sim_bank_get_device(bank);
|
||||
struct gpio_sim_chip_name_ctx ctx = { dev, page };
|
||||
struct gpio_sim_chip_name_ctx ctx = { bank->swnode, page };
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->lock);
|
||||
|
||||
@@ -256,7 +256,6 @@ config DRM_AMDGPU
|
||||
select HWMON
|
||||
select BACKLIGHT_CLASS_DEVICE
|
||||
select INTERVAL_TREE
|
||||
select DRM_BUDDY
|
||||
help
|
||||
Choose this option if you have a recent AMD Radeon graphics card.
|
||||
|
||||
|
||||
@@ -30,15 +30,12 @@
|
||||
#include <drm/ttm/ttm_resource.h>
|
||||
#include <drm/ttm/ttm_range_manager.h>
|
||||
|
||||
#include "amdgpu_vram_mgr.h"
|
||||
|
||||
/* state back for walking over vram_mgr and gtt_mgr allocations */
|
||||
struct amdgpu_res_cursor {
|
||||
uint64_t start;
|
||||
uint64_t size;
|
||||
uint64_t remaining;
|
||||
void *node;
|
||||
uint32_t mem_type;
|
||||
struct drm_mm_node *node;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -55,63 +52,27 @@ static inline void amdgpu_res_first(struct ttm_resource *res,
|
||||
uint64_t start, uint64_t size,
|
||||
struct amdgpu_res_cursor *cur)
|
||||
{
|
||||
struct drm_buddy_block *block;
|
||||
struct list_head *head, *next;
|
||||
struct drm_mm_node *node;
|
||||
|
||||
if (!res)
|
||||
goto fallback;
|
||||
if (!res || res->mem_type == TTM_PL_SYSTEM) {
|
||||
cur->start = start;
|
||||
cur->size = size;
|
||||
cur->remaining = size;
|
||||
cur->node = NULL;
|
||||
WARN_ON(res && start + size > res->num_pages << PAGE_SHIFT);
|
||||
return;
|
||||
}
|
||||
|
||||
BUG_ON(start + size > res->num_pages << PAGE_SHIFT);
|
||||
|
||||
cur->mem_type = res->mem_type;
|
||||
node = to_ttm_range_mgr_node(res)->mm_nodes;
|
||||
while (start >= node->size << PAGE_SHIFT)
|
||||
start -= node++->size << PAGE_SHIFT;
|
||||
|
||||
switch (cur->mem_type) {
|
||||
case TTM_PL_VRAM:
|
||||
head = &to_amdgpu_vram_mgr_resource(res)->blocks;
|
||||
|
||||
block = list_first_entry_or_null(head,
|
||||
struct drm_buddy_block,
|
||||
link);
|
||||
if (!block)
|
||||
goto fallback;
|
||||
|
||||
while (start >= amdgpu_vram_mgr_block_size(block)) {
|
||||
start -= amdgpu_vram_mgr_block_size(block);
|
||||
|
||||
next = block->link.next;
|
||||
if (next != head)
|
||||
block = list_entry(next, struct drm_buddy_block, link);
|
||||
}
|
||||
|
||||
cur->start = amdgpu_vram_mgr_block_start(block) + start;
|
||||
cur->size = min(amdgpu_vram_mgr_block_size(block) - start, size);
|
||||
cur->remaining = size;
|
||||
cur->node = block;
|
||||
break;
|
||||
case TTM_PL_TT:
|
||||
node = to_ttm_range_mgr_node(res)->mm_nodes;
|
||||
while (start >= node->size << PAGE_SHIFT)
|
||||
start -= node++->size << PAGE_SHIFT;
|
||||
|
||||
cur->start = (node->start << PAGE_SHIFT) + start;
|
||||
cur->size = min((node->size << PAGE_SHIFT) - start, size);
|
||||
cur->remaining = size;
|
||||
cur->node = node;
|
||||
break;
|
||||
default:
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
fallback:
|
||||
cur->start = start;
|
||||
cur->size = size;
|
||||
cur->start = (node->start << PAGE_SHIFT) + start;
|
||||
cur->size = min((node->size << PAGE_SHIFT) - start, size);
|
||||
cur->remaining = size;
|
||||
cur->node = NULL;
|
||||
WARN_ON(res && start + size > res->num_pages << PAGE_SHIFT);
|
||||
return;
|
||||
cur->node = node;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,9 +85,7 @@ fallback:
|
||||
*/
|
||||
static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size)
|
||||
{
|
||||
struct drm_buddy_block *block;
|
||||
struct drm_mm_node *node;
|
||||
struct list_head *next;
|
||||
struct drm_mm_node *node = cur->node;
|
||||
|
||||
BUG_ON(size > cur->remaining);
|
||||
|
||||
@@ -140,27 +99,9 @@ static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (cur->mem_type) {
|
||||
case TTM_PL_VRAM:
|
||||
block = cur->node;
|
||||
|
||||
next = block->link.next;
|
||||
block = list_entry(next, struct drm_buddy_block, link);
|
||||
|
||||
cur->node = block;
|
||||
cur->start = amdgpu_vram_mgr_block_start(block);
|
||||
cur->size = min(amdgpu_vram_mgr_block_size(block), cur->remaining);
|
||||
break;
|
||||
case TTM_PL_TT:
|
||||
node = cur->node;
|
||||
|
||||
cur->node = ++node;
|
||||
cur->start = node->start << PAGE_SHIFT;
|
||||
cur->size = min(node->size << PAGE_SHIFT, cur->remaining);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
cur->node = ++node;
|
||||
cur->start = node->start << PAGE_SHIFT;
|
||||
cur->size = min(node->size << PAGE_SHIFT, cur->remaining);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <linux/dma-direction.h>
|
||||
#include <drm/gpu_scheduler.h>
|
||||
#include "amdgpu_vram_mgr.h"
|
||||
#include "amdgpu.h"
|
||||
|
||||
#define AMDGPU_PL_GDS (TTM_PL_PRIV + 0)
|
||||
@@ -39,6 +38,15 @@
|
||||
|
||||
#define AMDGPU_POISON 0xd0bed0be
|
||||
|
||||
struct amdgpu_vram_mgr {
|
||||
struct ttm_resource_manager manager;
|
||||
struct drm_mm mm;
|
||||
spinlock_t lock;
|
||||
struct list_head reservations_pending;
|
||||
struct list_head reserved_pages;
|
||||
atomic64_t vis_usage;
|
||||
};
|
||||
|
||||
struct amdgpu_gtt_mgr {
|
||||
struct ttm_resource_manager manager;
|
||||
struct drm_mm mm;
|
||||
|
||||
@@ -32,10 +32,8 @@
|
||||
#include "atom.h"
|
||||
|
||||
struct amdgpu_vram_reservation {
|
||||
u64 start;
|
||||
u64 size;
|
||||
struct list_head allocated;
|
||||
struct list_head blocks;
|
||||
struct list_head node;
|
||||
struct drm_mm_node mm_node;
|
||||
};
|
||||
|
||||
static inline struct amdgpu_vram_mgr *
|
||||
@@ -188,18 +186,18 @@ const struct attribute_group amdgpu_vram_mgr_attr_group = {
|
||||
};
|
||||
|
||||
/**
|
||||
* amdgpu_vram_mgr_vis_size - Calculate visible block size
|
||||
* amdgpu_vram_mgr_vis_size - Calculate visible node size
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @block: DRM BUDDY block structure
|
||||
* @node: MM node structure
|
||||
*
|
||||
* Calculate how many bytes of the DRM BUDDY block are inside visible VRAM
|
||||
* Calculate how many bytes of the MM node are inside visible VRAM
|
||||
*/
|
||||
static u64 amdgpu_vram_mgr_vis_size(struct amdgpu_device *adev,
|
||||
struct drm_buddy_block *block)
|
||||
struct drm_mm_node *node)
|
||||
{
|
||||
u64 start = amdgpu_vram_mgr_block_start(block);
|
||||
u64 end = start + amdgpu_vram_mgr_block_size(block);
|
||||
uint64_t start = node->start << PAGE_SHIFT;
|
||||
uint64_t end = (node->size + node->start) << PAGE_SHIFT;
|
||||
|
||||
if (start >= adev->gmc.visible_vram_size)
|
||||
return 0;
|
||||
@@ -220,9 +218,9 @@ u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo)
|
||||
{
|
||||
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
|
||||
struct ttm_resource *res = bo->tbo.resource;
|
||||
struct amdgpu_vram_mgr_resource *vres = to_amdgpu_vram_mgr_resource(res);
|
||||
struct drm_buddy_block *block;
|
||||
u64 usage = 0;
|
||||
unsigned pages = res->num_pages;
|
||||
struct drm_mm_node *mm;
|
||||
u64 usage;
|
||||
|
||||
if (amdgpu_gmc_vram_full_visible(&adev->gmc))
|
||||
return amdgpu_bo_size(bo);
|
||||
@@ -230,8 +228,9 @@ u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo)
|
||||
if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
|
||||
return 0;
|
||||
|
||||
list_for_each_entry(block, &vres->blocks, link)
|
||||
usage += amdgpu_vram_mgr_vis_size(adev, block);
|
||||
mm = &container_of(res, struct ttm_range_mgr_node, base)->mm_nodes[0];
|
||||
for (usage = 0; pages; pages -= mm->size, mm++)
|
||||
usage += amdgpu_vram_mgr_vis_size(adev, mm);
|
||||
|
||||
return usage;
|
||||
}
|
||||
@@ -241,30 +240,23 @@ static void amdgpu_vram_mgr_do_reserve(struct ttm_resource_manager *man)
|
||||
{
|
||||
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
|
||||
struct amdgpu_device *adev = to_amdgpu_device(mgr);
|
||||
struct drm_buddy *mm = &mgr->mm;
|
||||
struct drm_mm *mm = &mgr->mm;
|
||||
struct amdgpu_vram_reservation *rsv, *temp;
|
||||
struct drm_buddy_block *block;
|
||||
uint64_t vis_usage;
|
||||
|
||||
list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, blocks) {
|
||||
if (drm_buddy_alloc_blocks(mm, rsv->start, rsv->start + rsv->size,
|
||||
rsv->size, mm->chunk_size, &rsv->allocated,
|
||||
DRM_BUDDY_RANGE_ALLOCATION))
|
||||
continue;
|
||||
|
||||
block = amdgpu_vram_mgr_first_block(&rsv->allocated);
|
||||
if (!block)
|
||||
list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, node) {
|
||||
if (drm_mm_reserve_node(mm, &rsv->mm_node))
|
||||
continue;
|
||||
|
||||
dev_dbg(adev->dev, "Reservation 0x%llx - %lld, Succeeded\n",
|
||||
rsv->start, rsv->size);
|
||||
rsv->mm_node.start, rsv->mm_node.size);
|
||||
|
||||
vis_usage = amdgpu_vram_mgr_vis_size(adev, block);
|
||||
vis_usage = amdgpu_vram_mgr_vis_size(adev, &rsv->mm_node);
|
||||
atomic64_add(vis_usage, &mgr->vis_usage);
|
||||
spin_lock(&man->bdev->lru_lock);
|
||||
man->usage += rsv->size;
|
||||
man->usage += rsv->mm_node.size << PAGE_SHIFT;
|
||||
spin_unlock(&man->bdev->lru_lock);
|
||||
list_move(&rsv->blocks, &mgr->reserved_pages);
|
||||
list_move(&rsv->node, &mgr->reserved_pages);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,16 +278,14 @@ int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr,
|
||||
if (!rsv)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_LIST_HEAD(&rsv->allocated);
|
||||
INIT_LIST_HEAD(&rsv->blocks);
|
||||
INIT_LIST_HEAD(&rsv->node);
|
||||
rsv->mm_node.start = start >> PAGE_SHIFT;
|
||||
rsv->mm_node.size = size >> PAGE_SHIFT;
|
||||
|
||||
rsv->start = start;
|
||||
rsv->size = size;
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
list_add_tail(&rsv->blocks, &mgr->reservations_pending);
|
||||
spin_lock(&mgr->lock);
|
||||
list_add_tail(&rsv->node, &mgr->reservations_pending);
|
||||
amdgpu_vram_mgr_do_reserve(&mgr->manager);
|
||||
mutex_unlock(&mgr->lock);
|
||||
spin_unlock(&mgr->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -317,19 +307,19 @@ int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr,
|
||||
struct amdgpu_vram_reservation *rsv;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
spin_lock(&mgr->lock);
|
||||
|
||||
list_for_each_entry(rsv, &mgr->reservations_pending, blocks) {
|
||||
if (rsv->start <= start &&
|
||||
(start < (rsv->start + rsv->size))) {
|
||||
list_for_each_entry(rsv, &mgr->reservations_pending, node) {
|
||||
if ((rsv->mm_node.start <= start) &&
|
||||
(start < (rsv->mm_node.start + rsv->mm_node.size))) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
list_for_each_entry(rsv, &mgr->reserved_pages, blocks) {
|
||||
if (rsv->start <= start &&
|
||||
(start < (rsv->start + rsv->size))) {
|
||||
list_for_each_entry(rsv, &mgr->reserved_pages, node) {
|
||||
if ((rsv->mm_node.start <= start) &&
|
||||
(start < (rsv->mm_node.start + rsv->mm_node.size))) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
@@ -337,10 +327,32 @@ int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr,
|
||||
|
||||
ret = -ENOENT;
|
||||
out:
|
||||
mutex_unlock(&mgr->lock);
|
||||
spin_unlock(&mgr->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_vram_mgr_virt_start - update virtual start address
|
||||
*
|
||||
* @mem: ttm_resource to update
|
||||
* @node: just allocated node
|
||||
*
|
||||
* Calculate a virtual BO start address to easily check if everything is CPU
|
||||
* accessible.
|
||||
*/
|
||||
static void amdgpu_vram_mgr_virt_start(struct ttm_resource *mem,
|
||||
struct drm_mm_node *node)
|
||||
{
|
||||
unsigned long start;
|
||||
|
||||
start = node->start + node->size;
|
||||
if (start > mem->num_pages)
|
||||
start -= mem->num_pages;
|
||||
else
|
||||
start = 0;
|
||||
mem->start = max(mem->start, start);
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_vram_mgr_new - allocate new ranges
|
||||
*
|
||||
@@ -356,44 +368,46 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
|
||||
const struct ttm_place *place,
|
||||
struct ttm_resource **res)
|
||||
{
|
||||
u64 vis_usage = 0, max_bytes, cur_size, min_block_size;
|
||||
unsigned long lpfn, num_nodes, pages_per_node, pages_left, pages;
|
||||
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
|
||||
struct amdgpu_device *adev = to_amdgpu_device(mgr);
|
||||
struct amdgpu_vram_mgr_resource *vres;
|
||||
u64 size, remaining_size, lpfn, fpfn;
|
||||
struct drm_buddy *mm = &mgr->mm;
|
||||
struct drm_buddy_block *block;
|
||||
unsigned long pages_per_block;
|
||||
uint64_t vis_usage = 0, mem_bytes, max_bytes;
|
||||
struct ttm_range_mgr_node *node;
|
||||
struct drm_mm *mm = &mgr->mm;
|
||||
enum drm_mm_insert_mode mode;
|
||||
unsigned i;
|
||||
int r;
|
||||
|
||||
lpfn = place->lpfn << PAGE_SHIFT;
|
||||
lpfn = place->lpfn;
|
||||
if (!lpfn)
|
||||
lpfn = man->size;
|
||||
|
||||
fpfn = place->fpfn << PAGE_SHIFT;
|
||||
lpfn = man->size >> PAGE_SHIFT;
|
||||
|
||||
max_bytes = adev->gmc.mc_vram_size;
|
||||
if (tbo->type != ttm_bo_type_kernel)
|
||||
max_bytes -= AMDGPU_VM_RESERVED_VRAM;
|
||||
|
||||
mem_bytes = tbo->base.size;
|
||||
if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
|
||||
pages_per_block = ~0ul;
|
||||
pages_per_node = ~0ul;
|
||||
num_nodes = 1;
|
||||
} else {
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
pages_per_block = HPAGE_PMD_NR;
|
||||
pages_per_node = HPAGE_PMD_NR;
|
||||
#else
|
||||
/* default to 2MB */
|
||||
pages_per_block = 2UL << (20UL - PAGE_SHIFT);
|
||||
pages_per_node = 2UL << (20UL - PAGE_SHIFT);
|
||||
#endif
|
||||
pages_per_block = max_t(uint32_t, pages_per_block,
|
||||
tbo->page_alignment);
|
||||
pages_per_node = max_t(uint32_t, pages_per_node,
|
||||
tbo->page_alignment);
|
||||
num_nodes = DIV_ROUND_UP_ULL(PFN_UP(mem_bytes), pages_per_node);
|
||||
}
|
||||
|
||||
vres = kzalloc(sizeof(*vres), GFP_KERNEL);
|
||||
if (!vres)
|
||||
node = kvmalloc(struct_size(node, mm_nodes, num_nodes),
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!node)
|
||||
return -ENOMEM;
|
||||
|
||||
ttm_resource_init(tbo, place, &vres->base);
|
||||
ttm_resource_init(tbo, place, &node->base);
|
||||
|
||||
/* bail out quickly if there's likely not enough VRAM for this BO */
|
||||
if (ttm_resource_manager_usage(man) > max_bytes) {
|
||||
@@ -401,130 +415,66 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
|
||||
goto error_fini;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&vres->blocks);
|
||||
|
||||
mode = DRM_MM_INSERT_BEST;
|
||||
if (place->flags & TTM_PL_FLAG_TOPDOWN)
|
||||
vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION;
|
||||
mode = DRM_MM_INSERT_HIGH;
|
||||
|
||||
if (fpfn || lpfn != man->size)
|
||||
/* Allocate blocks in desired range */
|
||||
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
|
||||
pages_left = node->base.num_pages;
|
||||
|
||||
remaining_size = vres->base.num_pages << PAGE_SHIFT;
|
||||
/* Limit maximum size to 2GB due to SG table limitations */
|
||||
pages = min(pages_left, 2UL << (30 - PAGE_SHIFT));
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
while (remaining_size) {
|
||||
if (tbo->page_alignment)
|
||||
min_block_size = tbo->page_alignment << PAGE_SHIFT;
|
||||
else
|
||||
min_block_size = mgr->default_page_size;
|
||||
i = 0;
|
||||
spin_lock(&mgr->lock);
|
||||
while (pages_left) {
|
||||
uint32_t alignment = tbo->page_alignment;
|
||||
|
||||
BUG_ON(min_block_size < mm->chunk_size);
|
||||
if (pages >= pages_per_node)
|
||||
alignment = pages_per_node;
|
||||
|
||||
/* Limit maximum size to 2GiB due to SG table limitations */
|
||||
size = min(remaining_size, 2ULL << 30);
|
||||
|
||||
if (size >= pages_per_block << PAGE_SHIFT)
|
||||
min_block_size = pages_per_block << PAGE_SHIFT;
|
||||
|
||||
cur_size = size;
|
||||
|
||||
if (fpfn + size != place->lpfn << PAGE_SHIFT) {
|
||||
/*
|
||||
* Except for actual range allocation, modify the size and
|
||||
* min_block_size conforming to continuous flag enablement
|
||||
*/
|
||||
if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
|
||||
size = roundup_pow_of_two(size);
|
||||
min_block_size = size;
|
||||
/*
|
||||
* Modify the size value if size is not
|
||||
* aligned with min_block_size
|
||||
*/
|
||||
} else if (!IS_ALIGNED(size, min_block_size)) {
|
||||
size = round_up(size, min_block_size);
|
||||
r = drm_mm_insert_node_in_range(mm, &node->mm_nodes[i], pages,
|
||||
alignment, 0, place->fpfn,
|
||||
lpfn, mode);
|
||||
if (unlikely(r)) {
|
||||
if (pages > pages_per_node) {
|
||||
if (is_power_of_2(pages))
|
||||
pages = pages / 2;
|
||||
else
|
||||
pages = rounddown_pow_of_two(pages);
|
||||
continue;
|
||||
}
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
r = drm_buddy_alloc_blocks(mm, fpfn,
|
||||
lpfn,
|
||||
size,
|
||||
min_block_size,
|
||||
&vres->blocks,
|
||||
vres->flags);
|
||||
if (unlikely(r))
|
||||
goto error_free_blocks;
|
||||
vis_usage += amdgpu_vram_mgr_vis_size(adev, &node->mm_nodes[i]);
|
||||
amdgpu_vram_mgr_virt_start(&node->base, &node->mm_nodes[i]);
|
||||
pages_left -= pages;
|
||||
++i;
|
||||
|
||||
if (size > remaining_size)
|
||||
remaining_size = 0;
|
||||
else
|
||||
remaining_size -= size;
|
||||
if (pages > pages_left)
|
||||
pages = pages_left;
|
||||
}
|
||||
mutex_unlock(&mgr->lock);
|
||||
spin_unlock(&mgr->lock);
|
||||
|
||||
if (cur_size != size) {
|
||||
struct drm_buddy_block *block;
|
||||
struct list_head *trim_list;
|
||||
u64 original_size;
|
||||
LIST_HEAD(temp);
|
||||
|
||||
trim_list = &vres->blocks;
|
||||
original_size = vres->base.num_pages << PAGE_SHIFT;
|
||||
|
||||
/*
|
||||
* If size value is rounded up to min_block_size, trim the last
|
||||
* block to the required size
|
||||
*/
|
||||
if (!list_is_singular(&vres->blocks)) {
|
||||
block = list_last_entry(&vres->blocks, typeof(*block), link);
|
||||
list_move_tail(&block->link, &temp);
|
||||
trim_list = &temp;
|
||||
/*
|
||||
* Compute the original_size value by subtracting the
|
||||
* last block size with (aligned size - original size)
|
||||
*/
|
||||
original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size);
|
||||
}
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
drm_buddy_block_trim(mm,
|
||||
original_size,
|
||||
trim_list);
|
||||
mutex_unlock(&mgr->lock);
|
||||
|
||||
if (!list_empty(&temp))
|
||||
list_splice_tail(trim_list, &vres->blocks);
|
||||
}
|
||||
|
||||
list_for_each_entry(block, &vres->blocks, link)
|
||||
vis_usage += amdgpu_vram_mgr_vis_size(adev, block);
|
||||
|
||||
block = amdgpu_vram_mgr_first_block(&vres->blocks);
|
||||
if (!block) {
|
||||
r = -EINVAL;
|
||||
goto error_fini;
|
||||
}
|
||||
|
||||
vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT;
|
||||
|
||||
if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks))
|
||||
vres->base.placement |= TTM_PL_FLAG_CONTIGUOUS;
|
||||
if (i == 1)
|
||||
node->base.placement |= TTM_PL_FLAG_CONTIGUOUS;
|
||||
|
||||
if (adev->gmc.xgmi.connected_to_cpu)
|
||||
vres->base.bus.caching = ttm_cached;
|
||||
node->base.bus.caching = ttm_cached;
|
||||
else
|
||||
vres->base.bus.caching = ttm_write_combined;
|
||||
node->base.bus.caching = ttm_write_combined;
|
||||
|
||||
atomic64_add(vis_usage, &mgr->vis_usage);
|
||||
*res = &vres->base;
|
||||
*res = &node->base;
|
||||
return 0;
|
||||
|
||||
error_free_blocks:
|
||||
drm_buddy_free_list(mm, &vres->blocks);
|
||||
mutex_unlock(&mgr->lock);
|
||||
error_free:
|
||||
while (i--)
|
||||
drm_mm_remove_node(&node->mm_nodes[i]);
|
||||
spin_unlock(&mgr->lock);
|
||||
error_fini:
|
||||
ttm_resource_fini(man, &vres->base);
|
||||
kfree(vres);
|
||||
ttm_resource_fini(man, &node->base);
|
||||
kvfree(node);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -540,26 +490,27 @@ error_fini:
|
||||
static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man,
|
||||
struct ttm_resource *res)
|
||||
{
|
||||
struct amdgpu_vram_mgr_resource *vres = to_amdgpu_vram_mgr_resource(res);
|
||||
struct ttm_range_mgr_node *node = to_ttm_range_mgr_node(res);
|
||||
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
|
||||
struct amdgpu_device *adev = to_amdgpu_device(mgr);
|
||||
struct drm_buddy *mm = &mgr->mm;
|
||||
struct drm_buddy_block *block;
|
||||
uint64_t vis_usage = 0;
|
||||
unsigned i, pages;
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
list_for_each_entry(block, &vres->blocks, link)
|
||||
vis_usage += amdgpu_vram_mgr_vis_size(adev, block);
|
||||
spin_lock(&mgr->lock);
|
||||
for (i = 0, pages = res->num_pages; pages;
|
||||
pages -= node->mm_nodes[i].size, ++i) {
|
||||
struct drm_mm_node *mm = &node->mm_nodes[i];
|
||||
|
||||
drm_mm_remove_node(mm);
|
||||
vis_usage += amdgpu_vram_mgr_vis_size(adev, mm);
|
||||
}
|
||||
amdgpu_vram_mgr_do_reserve(man);
|
||||
|
||||
drm_buddy_free_list(mm, &vres->blocks);
|
||||
mutex_unlock(&mgr->lock);
|
||||
spin_unlock(&mgr->lock);
|
||||
|
||||
atomic64_sub(vis_usage, &mgr->vis_usage);
|
||||
|
||||
ttm_resource_fini(man, res);
|
||||
kfree(vres);
|
||||
kvfree(node);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -591,7 +542,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev,
|
||||
if (!*sgt)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Determine the number of DRM_BUDDY blocks to export */
|
||||
/* Determine the number of DRM_MM nodes to export */
|
||||
amdgpu_res_first(res, offset, length, &cursor);
|
||||
while (cursor.remaining) {
|
||||
num_entries++;
|
||||
@@ -607,10 +558,10 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev,
|
||||
sg->length = 0;
|
||||
|
||||
/*
|
||||
* Walk down DRM_BUDDY blocks to populate scatterlist nodes
|
||||
* @note: Use iterator api to get first the DRM_BUDDY block
|
||||
* Walk down DRM_MM nodes to populate scatterlist nodes
|
||||
* @note: Use iterator api to get first the DRM_MM node
|
||||
* and the number of bytes from it. Access the following
|
||||
* DRM_BUDDY block(s) if more buffer needs to exported
|
||||
* DRM_MM node(s) if more buffer needs to exported
|
||||
*/
|
||||
amdgpu_res_first(res, offset, length, &cursor);
|
||||
for_each_sgtable_sg((*sgt), sg, i) {
|
||||
@@ -697,22 +648,13 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man,
|
||||
struct drm_printer *printer)
|
||||
{
|
||||
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
|
||||
struct drm_buddy *mm = &mgr->mm;
|
||||
struct drm_buddy_block *block;
|
||||
|
||||
drm_printf(printer, " vis usage:%llu\n",
|
||||
amdgpu_vram_mgr_vis_usage(mgr));
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
drm_printf(printer, "default_page_size: %lluKiB\n",
|
||||
mgr->default_page_size >> 10);
|
||||
|
||||
drm_buddy_print(mm, printer);
|
||||
|
||||
drm_printf(printer, "reserved:\n");
|
||||
list_for_each_entry(block, &mgr->reserved_pages, link)
|
||||
drm_buddy_block_print(mm, block, printer);
|
||||
mutex_unlock(&mgr->lock);
|
||||
spin_lock(&mgr->lock);
|
||||
drm_mm_print(&mgr->mm, printer);
|
||||
spin_unlock(&mgr->lock);
|
||||
}
|
||||
|
||||
static const struct ttm_resource_manager_func amdgpu_vram_mgr_func = {
|
||||
@@ -732,21 +674,16 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr;
|
||||
struct ttm_resource_manager *man = &mgr->manager;
|
||||
int err;
|
||||
|
||||
ttm_resource_manager_init(man, &adev->mman.bdev,
|
||||
adev->gmc.real_vram_size);
|
||||
|
||||
man->func = &amdgpu_vram_mgr_func;
|
||||
|
||||
err = drm_buddy_init(&mgr->mm, man->size, PAGE_SIZE);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
mutex_init(&mgr->lock);
|
||||
drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT);
|
||||
spin_lock_init(&mgr->lock);
|
||||
INIT_LIST_HEAD(&mgr->reservations_pending);
|
||||
INIT_LIST_HEAD(&mgr->reserved_pages);
|
||||
mgr->default_page_size = PAGE_SIZE;
|
||||
|
||||
ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, &mgr->manager);
|
||||
ttm_resource_manager_set_used(man, true);
|
||||
@@ -774,16 +711,16 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, blocks)
|
||||
spin_lock(&mgr->lock);
|
||||
list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, node)
|
||||
kfree(rsv);
|
||||
|
||||
list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, blocks) {
|
||||
drm_buddy_free_list(&mgr->mm, &rsv->blocks);
|
||||
list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, node) {
|
||||
drm_mm_remove_node(&rsv->mm_node);
|
||||
kfree(rsv);
|
||||
}
|
||||
drm_buddy_fini(&mgr->mm);
|
||||
mutex_unlock(&mgr->lock);
|
||||
drm_mm_takedown(&mgr->mm);
|
||||
spin_unlock(&mgr->lock);
|
||||
|
||||
ttm_resource_manager_cleanup(man);
|
||||
ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, NULL);
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/* SPDX-License-Identifier: MIT
|
||||
* Copyright 2021 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __AMDGPU_VRAM_MGR_H__
|
||||
#define __AMDGPU_VRAM_MGR_H__
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
|
||||
struct amdgpu_vram_mgr {
|
||||
struct ttm_resource_manager manager;
|
||||
struct drm_buddy mm;
|
||||
/* protects access to buffer objects */
|
||||
struct mutex lock;
|
||||
struct list_head reservations_pending;
|
||||
struct list_head reserved_pages;
|
||||
atomic64_t vis_usage;
|
||||
u64 default_page_size;
|
||||
};
|
||||
|
||||
struct amdgpu_vram_mgr_resource {
|
||||
struct ttm_resource base;
|
||||
struct list_head blocks;
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
static inline u64 amdgpu_vram_mgr_block_start(struct drm_buddy_block *block)
|
||||
{
|
||||
return drm_buddy_block_offset(block);
|
||||
}
|
||||
|
||||
static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
|
||||
{
|
||||
return PAGE_SIZE << drm_buddy_block_order(block);
|
||||
}
|
||||
|
||||
static inline struct drm_buddy_block *
|
||||
amdgpu_vram_mgr_first_block(struct list_head *list)
|
||||
{
|
||||
return list_first_entry_or_null(list, struct drm_buddy_block, link);
|
||||
}
|
||||
|
||||
static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
|
||||
{
|
||||
struct drm_buddy_block *block;
|
||||
u64 start, size;
|
||||
|
||||
block = amdgpu_vram_mgr_first_block(head);
|
||||
if (!block)
|
||||
return false;
|
||||
|
||||
while (head != block->link.next) {
|
||||
start = amdgpu_vram_mgr_block_start(block);
|
||||
size = amdgpu_vram_mgr_block_size(block);
|
||||
|
||||
block = list_entry(block->link.next, struct drm_buddy_block, link);
|
||||
if (start + size != amdgpu_vram_mgr_block_start(block))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline struct amdgpu_vram_mgr_resource *
|
||||
to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
|
||||
{
|
||||
return container_of(res, struct amdgpu_vram_mgr_resource, base);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -184,6 +184,8 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
|
||||
/* Navi2x+, Navi1x+ */
|
||||
if (gc_version == IP_VERSION(10, 3, 6))
|
||||
kfd->device_info.no_atomic_fw_version = 14;
|
||||
else if (gc_version == IP_VERSION(10, 3, 7))
|
||||
kfd->device_info.no_atomic_fw_version = 3;
|
||||
else if (gc_version >= IP_VERSION(10, 3, 0))
|
||||
kfd->device_info.no_atomic_fw_version = 92;
|
||||
else if (gc_version >= IP_VERSION(10, 1, 1))
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/component.h>
|
||||
#include <linux/dmi.h>
|
||||
|
||||
#include <drm/display/drm_dp_mst_helper.h>
|
||||
#include <drm/display/drm_hdmi_helper.h>
|
||||
@@ -462,6 +463,26 @@ static void dm_pflip_high_irq(void *interrupt_params)
|
||||
vrr_active, (int) !e);
|
||||
}
|
||||
|
||||
static void dm_crtc_handle_vblank(struct amdgpu_crtc *acrtc)
|
||||
{
|
||||
struct drm_crtc *crtc = &acrtc->base;
|
||||
struct drm_device *dev = crtc->dev;
|
||||
unsigned long flags;
|
||||
|
||||
drm_crtc_handle_vblank(crtc);
|
||||
|
||||
spin_lock_irqsave(&dev->event_lock, flags);
|
||||
|
||||
/* Send completion event for cursor-only commits */
|
||||
if (acrtc->event && acrtc->pflip_status != AMDGPU_FLIP_SUBMITTED) {
|
||||
drm_crtc_send_vblank_event(crtc, acrtc->event);
|
||||
drm_crtc_vblank_put(crtc);
|
||||
acrtc->event = NULL;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
}
|
||||
|
||||
static void dm_vupdate_high_irq(void *interrupt_params)
|
||||
{
|
||||
struct common_irq_params *irq_params = interrupt_params;
|
||||
@@ -500,7 +521,7 @@ static void dm_vupdate_high_irq(void *interrupt_params)
|
||||
* if a pageflip happened inside front-porch.
|
||||
*/
|
||||
if (vrr_active) {
|
||||
drm_crtc_handle_vblank(&acrtc->base);
|
||||
dm_crtc_handle_vblank(acrtc);
|
||||
|
||||
/* BTR processing for pre-DCE12 ASICs */
|
||||
if (acrtc->dm_irq_params.stream &&
|
||||
@@ -552,7 +573,7 @@ static void dm_crtc_high_irq(void *interrupt_params)
|
||||
* to dm_vupdate_high_irq after end of front-porch.
|
||||
*/
|
||||
if (!vrr_active)
|
||||
drm_crtc_handle_vblank(&acrtc->base);
|
||||
dm_crtc_handle_vblank(acrtc);
|
||||
|
||||
/**
|
||||
* Following stuff must happen at start of vblank, for crc
|
||||
@@ -1382,6 +1403,41 @@ static bool dm_should_disable_stutter(struct pci_dev *pdev)
|
||||
return false;
|
||||
}
|
||||
|
||||
static const struct dmi_system_id hpd_disconnect_quirk_table[] = {
|
||||
{
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3660"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3260"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3460"),
|
||||
},
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
static void retrieve_dmi_info(struct amdgpu_display_manager *dm)
|
||||
{
|
||||
const struct dmi_system_id *dmi_id;
|
||||
|
||||
dm->aux_hpd_discon_quirk = false;
|
||||
|
||||
dmi_id = dmi_first_match(hpd_disconnect_quirk_table);
|
||||
if (dmi_id) {
|
||||
dm->aux_hpd_discon_quirk = true;
|
||||
DRM_INFO("aux_hpd_discon_quirk attached\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int amdgpu_dm_init(struct amdgpu_device *adev)
|
||||
{
|
||||
struct dc_init_data init_data;
|
||||
@@ -1508,6 +1564,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&adev->dm.da_list);
|
||||
|
||||
retrieve_dmi_info(&adev->dm);
|
||||
|
||||
/* Display Core create. */
|
||||
adev->dm.dc = dc_create(&init_data);
|
||||
|
||||
@@ -5407,7 +5466,7 @@ fill_blending_from_plane_state(const struct drm_plane_state *plane_state,
|
||||
}
|
||||
}
|
||||
|
||||
if (per_pixel_alpha && plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE)
|
||||
if (*per_pixel_alpha && plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE)
|
||||
*pre_multiplied_alpha = false;
|
||||
}
|
||||
|
||||
@@ -9135,6 +9194,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
|
||||
struct amdgpu_bo *abo;
|
||||
uint32_t target_vblank, last_flip_vblank;
|
||||
bool vrr_active = amdgpu_dm_vrr_active(acrtc_state);
|
||||
bool cursor_update = false;
|
||||
bool pflip_present = false;
|
||||
struct {
|
||||
struct dc_surface_update surface_updates[MAX_SURFACES];
|
||||
@@ -9170,8 +9230,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
|
||||
struct dm_plane_state *dm_new_plane_state = to_dm_plane_state(new_plane_state);
|
||||
|
||||
/* Cursor plane is handled after stream updates */
|
||||
if (plane->type == DRM_PLANE_TYPE_CURSOR)
|
||||
if (plane->type == DRM_PLANE_TYPE_CURSOR) {
|
||||
if ((fb && crtc == pcrtc) ||
|
||||
(old_plane_state->fb && old_plane_state->crtc == pcrtc))
|
||||
cursor_update = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!fb || !crtc || pcrtc != crtc)
|
||||
continue;
|
||||
@@ -9334,6 +9399,17 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
|
||||
bundle->stream_update.vrr_infopacket =
|
||||
&acrtc_state->stream->vrr_infopacket;
|
||||
}
|
||||
} else if (cursor_update && acrtc_state->active_planes > 0 &&
|
||||
!acrtc_state->force_dpms_off &&
|
||||
acrtc_attach->base.state->event) {
|
||||
drm_crtc_vblank_get(pcrtc);
|
||||
|
||||
spin_lock_irqsave(&pcrtc->dev->event_lock, flags);
|
||||
|
||||
acrtc_attach->event = acrtc_attach->base.state->event;
|
||||
acrtc_attach->base.state->event = NULL;
|
||||
|
||||
spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags);
|
||||
}
|
||||
|
||||
/* Update the planes if changed or disable if we don't have any. */
|
||||
|
||||
@@ -540,6 +540,14 @@ struct amdgpu_display_manager {
|
||||
* last successfully applied backlight values.
|
||||
*/
|
||||
u32 actual_brightness[AMDGPU_DM_MAX_NUM_EDP];
|
||||
|
||||
/**
|
||||
* @aux_hpd_discon_quirk:
|
||||
*
|
||||
* quirk for hpd discon while aux is on-going.
|
||||
* occurred on certain intel platform
|
||||
*/
|
||||
bool aux_hpd_discon_quirk;
|
||||
};
|
||||
|
||||
enum dsc_clock_force_state {
|
||||
|
||||
@@ -56,6 +56,8 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
|
||||
ssize_t result = 0;
|
||||
struct aux_payload payload;
|
||||
enum aux_return_code_type operation_result;
|
||||
struct amdgpu_device *adev;
|
||||
struct ddc_service *ddc;
|
||||
|
||||
if (WARN_ON(msg->size > 16))
|
||||
return -E2BIG;
|
||||
@@ -74,6 +76,21 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
|
||||
result = dc_link_aux_transfer_raw(TO_DM_AUX(aux)->ddc_service, &payload,
|
||||
&operation_result);
|
||||
|
||||
/*
|
||||
* w/a on certain intel platform where hpd is unexpected to pull low during
|
||||
* 1st sideband message transaction by return AUX_RET_ERROR_HPD_DISCON
|
||||
* aux transaction is succuess in such case, therefore bypass the error
|
||||
*/
|
||||
ddc = TO_DM_AUX(aux)->ddc_service;
|
||||
adev = ddc->ctx->driver_context;
|
||||
if (adev->dm.aux_hpd_discon_quirk) {
|
||||
if (msg->address == DP_SIDEBAND_MSG_DOWN_REQ_BASE &&
|
||||
operation_result == AUX_RET_ERROR_HPD_DISCON) {
|
||||
result = 0;
|
||||
operation_result = AUX_RET_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (payload.write && result >= 0)
|
||||
result = msg->size;
|
||||
|
||||
|
||||
@@ -1117,12 +1117,13 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
|
||||
* on certain displays, such as the Sharp 4k. 36bpp is needed
|
||||
* to support SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 and
|
||||
* SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616 with actual > 10 bpc
|
||||
* precision on at least DCN display engines. However, at least
|
||||
* Carrizo with DCE_VERSION_11_0 does not like 36 bpp lb depth,
|
||||
* so use only 30 bpp on DCE_VERSION_11_0. Testing with DCE 11.2 and 8.3
|
||||
* did not show such problems, so this seems to be the exception.
|
||||
* precision on DCN display engines, but apparently not for DCE, as
|
||||
* far as testing on DCE-11.2 and DCE-8 showed. Various DCE parts have
|
||||
* problems: Carrizo with DCE_VERSION_11_0 does not like 36 bpp lb depth,
|
||||
* neither do DCE-8 at 4k resolution, or DCE-11.2 (broken identify pixel
|
||||
* passthrough). Therefore only use 36 bpp on DCN where it is actually needed.
|
||||
*/
|
||||
if (plane_state->ctx->dce_version > DCE_VERSION_11_0)
|
||||
if (plane_state->ctx->dce_version > DCE_VERSION_MAX)
|
||||
pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_36BPP;
|
||||
else
|
||||
pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_30BPP;
|
||||
|
||||
@@ -1228,6 +1228,8 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
|
||||
uint32_t crystal_clock_freq = 2500;
|
||||
uint32_t tach_period;
|
||||
|
||||
if (speed == 0)
|
||||
return -EINVAL;
|
||||
/*
|
||||
* To prevent from possible overheat, some ASICs may have requirement
|
||||
* for minimum fan speed:
|
||||
|
||||
@@ -60,6 +60,8 @@ __i915_gem_object_create_region(struct intel_memory_region *mem,
|
||||
if (page_size)
|
||||
default_page_size = page_size;
|
||||
|
||||
/* We should be able to fit a page within an sg entry */
|
||||
GEM_BUG_ON(overflows_type(default_page_size, u32));
|
||||
GEM_BUG_ON(!is_power_of_2_u64(default_page_size));
|
||||
GEM_BUG_ON(default_page_size < PAGE_SIZE);
|
||||
|
||||
|
||||
@@ -620,10 +620,15 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
|
||||
struct ttm_resource *res)
|
||||
{
|
||||
struct ttm_buffer_object *bo = i915_gem_to_ttm(obj);
|
||||
u32 page_alignment;
|
||||
|
||||
if (!i915_ttm_gtt_binds_lmem(res))
|
||||
return i915_ttm_tt_get_st(bo->ttm);
|
||||
|
||||
page_alignment = bo->page_alignment << PAGE_SHIFT;
|
||||
if (!page_alignment)
|
||||
page_alignment = obj->mm.region->min_page_size;
|
||||
|
||||
/*
|
||||
* If CPU mapping differs, we need to add the ttm_tt pages to
|
||||
* the resulting st. Might make sense for GGTT.
|
||||
@@ -634,7 +639,8 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
|
||||
struct i915_refct_sgt *rsgt;
|
||||
|
||||
rsgt = intel_region_ttm_resource_to_rsgt(obj->mm.region,
|
||||
res);
|
||||
res,
|
||||
page_alignment);
|
||||
if (IS_ERR(rsgt))
|
||||
return rsgt;
|
||||
|
||||
@@ -643,7 +649,8 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
|
||||
return i915_refct_sgt_get(obj->ttm.cached_io_rsgt);
|
||||
}
|
||||
|
||||
return intel_region_ttm_resource_to_rsgt(obj->mm.region, res);
|
||||
return intel_region_ttm_resource_to_rsgt(obj->mm.region, res,
|
||||
page_alignment);
|
||||
}
|
||||
|
||||
static int i915_ttm_truncate(struct drm_i915_gem_object *obj)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include "gt/intel_engine.h"
|
||||
#include "gt/intel_rps.h"
|
||||
|
||||
#include "i915_gem_ioctls.h"
|
||||
#include "i915_gem_object.h"
|
||||
@@ -31,6 +32,37 @@ i915_gem_object_wait_fence(struct dma_fence *fence,
|
||||
timeout);
|
||||
}
|
||||
|
||||
static void
|
||||
i915_gem_object_boost(struct dma_resv *resv, unsigned int flags)
|
||||
{
|
||||
struct dma_resv_iter cursor;
|
||||
struct dma_fence *fence;
|
||||
|
||||
/*
|
||||
* Prescan all fences for potential boosting before we begin waiting.
|
||||
*
|
||||
* When we wait, we wait on outstanding fences serially. If the
|
||||
* dma-resv contains a sequence such as 1:1, 1:2 instead of a reduced
|
||||
* form 1:2, then as we look at each wait in turn we see that each
|
||||
* request is currently executing and not worthy of boosting. But if
|
||||
* we only happen to look at the final fence in the sequence (because
|
||||
* of request coalescing or splitting between read/write arrays by
|
||||
* the iterator), then we would boost. As such our decision to boost
|
||||
* or not is delicately balanced on the order we wait on fences.
|
||||
*
|
||||
* So instead of looking for boosts sequentially, look for all boosts
|
||||
* upfront and then wait on the outstanding fences.
|
||||
*/
|
||||
|
||||
dma_resv_iter_begin(&cursor, resv,
|
||||
dma_resv_usage_rw(flags & I915_WAIT_ALL));
|
||||
dma_resv_for_each_fence_unlocked(&cursor, fence)
|
||||
if (dma_fence_is_i915(fence) &&
|
||||
!i915_request_started(to_request(fence)))
|
||||
intel_rps_boost(to_request(fence));
|
||||
dma_resv_iter_end(&cursor);
|
||||
}
|
||||
|
||||
static long
|
||||
i915_gem_object_wait_reservation(struct dma_resv *resv,
|
||||
unsigned int flags,
|
||||
@@ -40,6 +72,8 @@ i915_gem_object_wait_reservation(struct dma_resv *resv,
|
||||
struct dma_fence *fence;
|
||||
long ret = timeout ?: 1;
|
||||
|
||||
i915_gem_object_boost(resv, flags);
|
||||
|
||||
dma_resv_iter_begin(&cursor, resv,
|
||||
dma_resv_usage_rw(flags & I915_WAIT_ALL));
|
||||
dma_resv_for_each_fence_unlocked(&cursor, fence) {
|
||||
|
||||
@@ -1209,6 +1209,20 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt)
|
||||
mutex_lock(>->tlb_invalidate_lock);
|
||||
intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
|
||||
|
||||
spin_lock_irq(&uncore->lock); /* serialise invalidate with GT reset */
|
||||
|
||||
for_each_engine(engine, gt, id) {
|
||||
struct reg_and_bit rb;
|
||||
|
||||
rb = get_reg_and_bit(engine, regs == gen8_regs, regs, num);
|
||||
if (!i915_mmio_reg_offset(rb.reg))
|
||||
continue;
|
||||
|
||||
intel_uncore_write_fw(uncore, rb.reg, rb.bit);
|
||||
}
|
||||
|
||||
spin_unlock_irq(&uncore->lock);
|
||||
|
||||
for_each_engine(engine, gt, id) {
|
||||
/*
|
||||
* HW architecture suggest typical invalidation time at 40us,
|
||||
@@ -1223,7 +1237,6 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt)
|
||||
if (!i915_mmio_reg_offset(rb.reg))
|
||||
continue;
|
||||
|
||||
intel_uncore_write_fw(uncore, rb.reg, rb.bit);
|
||||
if (__intel_wait_for_register_fw(uncore,
|
||||
rb.reg, rb.bit, 0,
|
||||
timeout_us, timeout_ms,
|
||||
|
||||
@@ -300,9 +300,9 @@ static int gen6_hw_domain_reset(struct intel_gt *gt, u32 hw_domain_mask)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gen6_reset_engines(struct intel_gt *gt,
|
||||
intel_engine_mask_t engine_mask,
|
||||
unsigned int retry)
|
||||
static int __gen6_reset_engines(struct intel_gt *gt,
|
||||
intel_engine_mask_t engine_mask,
|
||||
unsigned int retry)
|
||||
{
|
||||
struct intel_engine_cs *engine;
|
||||
u32 hw_mask;
|
||||
@@ -321,6 +321,20 @@ static int gen6_reset_engines(struct intel_gt *gt,
|
||||
return gen6_hw_domain_reset(gt, hw_mask);
|
||||
}
|
||||
|
||||
static int gen6_reset_engines(struct intel_gt *gt,
|
||||
intel_engine_mask_t engine_mask,
|
||||
unsigned int retry)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(>->uncore->lock, flags);
|
||||
ret = __gen6_reset_engines(gt, engine_mask, retry);
|
||||
spin_unlock_irqrestore(>->uncore->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct intel_engine_cs *find_sfc_paired_vecs_engine(struct intel_engine_cs *engine)
|
||||
{
|
||||
int vecs_id;
|
||||
@@ -487,9 +501,9 @@ static void gen11_unlock_sfc(struct intel_engine_cs *engine)
|
||||
rmw_clear_fw(uncore, sfc_lock.lock_reg, sfc_lock.lock_bit);
|
||||
}
|
||||
|
||||
static int gen11_reset_engines(struct intel_gt *gt,
|
||||
intel_engine_mask_t engine_mask,
|
||||
unsigned int retry)
|
||||
static int __gen11_reset_engines(struct intel_gt *gt,
|
||||
intel_engine_mask_t engine_mask,
|
||||
unsigned int retry)
|
||||
{
|
||||
struct intel_engine_cs *engine;
|
||||
intel_engine_mask_t tmp;
|
||||
@@ -583,8 +597,11 @@ static int gen8_reset_engines(struct intel_gt *gt,
|
||||
struct intel_engine_cs *engine;
|
||||
const bool reset_non_ready = retry >= 1;
|
||||
intel_engine_mask_t tmp;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(>->uncore->lock, flags);
|
||||
|
||||
for_each_engine_masked(engine, gt, engine_mask, tmp) {
|
||||
ret = gen8_engine_reset_prepare(engine);
|
||||
if (ret && !reset_non_ready)
|
||||
@@ -612,17 +629,19 @@ static int gen8_reset_engines(struct intel_gt *gt,
|
||||
* This is best effort, so ignore any error from the initial reset.
|
||||
*/
|
||||
if (IS_DG2(gt->i915) && engine_mask == ALL_ENGINES)
|
||||
gen11_reset_engines(gt, gt->info.engine_mask, 0);
|
||||
__gen11_reset_engines(gt, gt->info.engine_mask, 0);
|
||||
|
||||
if (GRAPHICS_VER(gt->i915) >= 11)
|
||||
ret = gen11_reset_engines(gt, engine_mask, retry);
|
||||
ret = __gen11_reset_engines(gt, engine_mask, retry);
|
||||
else
|
||||
ret = gen6_reset_engines(gt, engine_mask, retry);
|
||||
ret = __gen6_reset_engines(gt, engine_mask, retry);
|
||||
|
||||
skip_reset:
|
||||
for_each_engine_masked(engine, gt, engine_mask, tmp)
|
||||
gen8_engine_reset_cancel(engine);
|
||||
|
||||
spin_unlock_irqrestore(>->uncore->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,8 +176,8 @@ static int live_lrc_layout(void *arg)
|
||||
continue;
|
||||
|
||||
hw = shmem_pin_map(engine->default_state);
|
||||
if (IS_ERR(hw)) {
|
||||
err = PTR_ERR(hw);
|
||||
if (!hw) {
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
hw += LRC_STATE_OFFSET / sizeof(*hw);
|
||||
@@ -365,8 +365,8 @@ static int live_lrc_fixed(void *arg)
|
||||
continue;
|
||||
|
||||
hw = shmem_pin_map(engine->default_state);
|
||||
if (IS_ERR(hw)) {
|
||||
err = PTR_ERR(hw);
|
||||
if (!hw) {
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
hw += LRC_STATE_OFFSET / sizeof(*hw);
|
||||
|
||||
@@ -3117,9 +3117,9 @@ void intel_gvt_update_reg_whitelist(struct intel_vgpu *vgpu)
|
||||
continue;
|
||||
|
||||
vaddr = shmem_pin_map(engine->default_state);
|
||||
if (IS_ERR(vaddr)) {
|
||||
gvt_err("failed to map %s->default state, err:%zd\n",
|
||||
engine->name, PTR_ERR(vaddr));
|
||||
if (!vaddr) {
|
||||
gvt_err("failed to map %s->default state\n",
|
||||
engine->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size)
|
||||
* drm_mm_node
|
||||
* @node: The drm_mm_node.
|
||||
* @region_start: An offset to add to the dma addresses of the sg list.
|
||||
* @page_alignment: Required page alignment for each sg entry. Power of two.
|
||||
*
|
||||
* Create a struct sg_table, initializing it from a struct drm_mm_node,
|
||||
* taking a maximum segment length into account, splitting into segments
|
||||
@@ -77,22 +78,25 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size)
|
||||
* error code cast to an error pointer on failure.
|
||||
*/
|
||||
struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
|
||||
u64 region_start)
|
||||
u64 region_start,
|
||||
u32 page_alignment)
|
||||
{
|
||||
const u64 max_segment = SZ_1G; /* Do we have a limit on this? */
|
||||
u64 segment_pages = max_segment >> PAGE_SHIFT;
|
||||
const u32 max_segment = round_down(UINT_MAX, page_alignment);
|
||||
const u32 segment_pages = max_segment >> PAGE_SHIFT;
|
||||
u64 block_size, offset, prev_end;
|
||||
struct i915_refct_sgt *rsgt;
|
||||
struct sg_table *st;
|
||||
struct scatterlist *sg;
|
||||
|
||||
GEM_BUG_ON(!max_segment);
|
||||
|
||||
rsgt = kmalloc(sizeof(*rsgt), GFP_KERNEL);
|
||||
if (!rsgt)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
i915_refct_sgt_init(rsgt, node->size << PAGE_SHIFT);
|
||||
st = &rsgt->table;
|
||||
if (sg_alloc_table(st, DIV_ROUND_UP(node->size, segment_pages),
|
||||
if (sg_alloc_table(st, DIV_ROUND_UP_ULL(node->size, segment_pages),
|
||||
GFP_KERNEL)) {
|
||||
i915_refct_sgt_put(rsgt);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
@@ -112,12 +116,14 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
|
||||
sg = __sg_next(sg);
|
||||
|
||||
sg_dma_address(sg) = region_start + offset;
|
||||
GEM_BUG_ON(!IS_ALIGNED(sg_dma_address(sg),
|
||||
page_alignment));
|
||||
sg_dma_len(sg) = 0;
|
||||
sg->length = 0;
|
||||
st->nents++;
|
||||
}
|
||||
|
||||
len = min(block_size, max_segment - sg->length);
|
||||
len = min_t(u64, block_size, max_segment - sg->length);
|
||||
sg->length += len;
|
||||
sg_dma_len(sg) += len;
|
||||
|
||||
@@ -138,6 +144,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
|
||||
* i915_buddy_block list
|
||||
* @res: The struct i915_ttm_buddy_resource.
|
||||
* @region_start: An offset to add to the dma addresses of the sg list.
|
||||
* @page_alignment: Required page alignment for each sg entry. Power of two.
|
||||
*
|
||||
* Create a struct sg_table, initializing it from struct i915_buddy_block list,
|
||||
* taking a maximum segment length into account, splitting into segments
|
||||
@@ -147,11 +154,12 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
|
||||
* error code cast to an error pointer on failure.
|
||||
*/
|
||||
struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
|
||||
u64 region_start)
|
||||
u64 region_start,
|
||||
u32 page_alignment)
|
||||
{
|
||||
struct i915_ttm_buddy_resource *bman_res = to_ttm_buddy_resource(res);
|
||||
const u64 size = res->num_pages << PAGE_SHIFT;
|
||||
const u64 max_segment = rounddown(UINT_MAX, PAGE_SIZE);
|
||||
const u32 max_segment = round_down(UINT_MAX, page_alignment);
|
||||
struct drm_buddy *mm = bman_res->mm;
|
||||
struct list_head *blocks = &bman_res->blocks;
|
||||
struct drm_buddy_block *block;
|
||||
@@ -161,6 +169,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
|
||||
resource_size_t prev_end;
|
||||
|
||||
GEM_BUG_ON(list_empty(blocks));
|
||||
GEM_BUG_ON(!max_segment);
|
||||
|
||||
rsgt = kmalloc(sizeof(*rsgt), GFP_KERNEL);
|
||||
if (!rsgt)
|
||||
@@ -191,12 +200,14 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
|
||||
sg = __sg_next(sg);
|
||||
|
||||
sg_dma_address(sg) = region_start + offset;
|
||||
GEM_BUG_ON(!IS_ALIGNED(sg_dma_address(sg),
|
||||
page_alignment));
|
||||
sg_dma_len(sg) = 0;
|
||||
sg->length = 0;
|
||||
st->nents++;
|
||||
}
|
||||
|
||||
len = min(block_size, max_segment - sg->length);
|
||||
len = min_t(u64, block_size, max_segment - sg->length);
|
||||
sg->length += len;
|
||||
sg_dma_len(sg) += len;
|
||||
|
||||
|
||||
@@ -213,9 +213,11 @@ static inline void __i915_refct_sgt_init(struct i915_refct_sgt *rsgt,
|
||||
void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size);
|
||||
|
||||
struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
|
||||
u64 region_start);
|
||||
u64 region_start,
|
||||
u32 page_alignment);
|
||||
|
||||
struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
|
||||
u64 region_start);
|
||||
u64 region_start,
|
||||
u32 page_alignment);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -152,6 +152,7 @@ int intel_region_ttm_fini(struct intel_memory_region *mem)
|
||||
* Convert an opaque TTM resource manager resource to a refcounted sg_table.
|
||||
* @mem: The memory region.
|
||||
* @res: The resource manager resource obtained from the TTM resource manager.
|
||||
* @page_alignment: Required page alignment for each sg entry. Power of two.
|
||||
*
|
||||
* The gem backends typically use sg-tables for operations on the underlying
|
||||
* io_memory. So provide a way for the backends to translate the
|
||||
@@ -161,16 +162,19 @@ int intel_region_ttm_fini(struct intel_memory_region *mem)
|
||||
*/
|
||||
struct i915_refct_sgt *
|
||||
intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem,
|
||||
struct ttm_resource *res)
|
||||
struct ttm_resource *res,
|
||||
u32 page_alignment)
|
||||
{
|
||||
if (mem->is_range_manager) {
|
||||
struct ttm_range_mgr_node *range_node =
|
||||
to_ttm_range_mgr_node(res);
|
||||
|
||||
return i915_rsgt_from_mm_node(&range_node->mm_nodes[0],
|
||||
mem->region.start);
|
||||
mem->region.start,
|
||||
page_alignment);
|
||||
} else {
|
||||
return i915_rsgt_from_buddy_resource(res, mem->region.start);
|
||||
return i915_rsgt_from_buddy_resource(res, mem->region.start,
|
||||
page_alignment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ int intel_region_ttm_fini(struct intel_memory_region *mem);
|
||||
|
||||
struct i915_refct_sgt *
|
||||
intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem,
|
||||
struct ttm_resource *res);
|
||||
struct ttm_resource *res,
|
||||
u32 page_alignment);
|
||||
|
||||
void intel_region_ttm_resource_free(struct intel_memory_region *mem,
|
||||
struct ttm_resource *res);
|
||||
|
||||
@@ -742,7 +742,7 @@ static int pot_hole(struct i915_address_space *vm,
|
||||
u64 addr;
|
||||
|
||||
for (addr = round_up(hole_start + min_alignment, step) - min_alignment;
|
||||
addr <= round_down(hole_end - (2 * min_alignment), step) - min_alignment;
|
||||
hole_end > addr && hole_end - addr >= 2 * min_alignment;
|
||||
addr += step) {
|
||||
err = i915_vma_pin(vma, 0, 0, addr | flags);
|
||||
if (err) {
|
||||
|
||||
@@ -451,7 +451,6 @@ out_put:
|
||||
|
||||
static int igt_mock_max_segment(void *arg)
|
||||
{
|
||||
const unsigned int max_segment = rounddown(UINT_MAX, PAGE_SIZE);
|
||||
struct intel_memory_region *mem = arg;
|
||||
struct drm_i915_private *i915 = mem->i915;
|
||||
struct i915_ttm_buddy_resource *res;
|
||||
@@ -460,7 +459,10 @@ static int igt_mock_max_segment(void *arg)
|
||||
struct drm_buddy *mm;
|
||||
struct list_head *blocks;
|
||||
struct scatterlist *sg;
|
||||
I915_RND_STATE(prng);
|
||||
LIST_HEAD(objects);
|
||||
unsigned int max_segment;
|
||||
unsigned int ps;
|
||||
u64 size;
|
||||
int err = 0;
|
||||
|
||||
@@ -472,7 +474,13 @@ static int igt_mock_max_segment(void *arg)
|
||||
*/
|
||||
|
||||
size = SZ_8G;
|
||||
mem = mock_region_create(i915, 0, size, PAGE_SIZE, 0, 0);
|
||||
ps = PAGE_SIZE;
|
||||
if (i915_prandom_u64_state(&prng) & 1)
|
||||
ps = SZ_64K; /* For something like DG2 */
|
||||
|
||||
max_segment = round_down(UINT_MAX, ps);
|
||||
|
||||
mem = mock_region_create(i915, 0, size, ps, 0, 0);
|
||||
if (IS_ERR(mem))
|
||||
return PTR_ERR(mem);
|
||||
|
||||
@@ -498,12 +506,21 @@ static int igt_mock_max_segment(void *arg)
|
||||
}
|
||||
|
||||
for (sg = obj->mm.pages->sgl; sg; sg = sg_next(sg)) {
|
||||
dma_addr_t daddr = sg_dma_address(sg);
|
||||
|
||||
if (sg->length > max_segment) {
|
||||
pr_err("%s: Created an oversized scatterlist entry, %u > %u\n",
|
||||
__func__, sg->length, max_segment);
|
||||
err = -EINVAL;
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
if (!IS_ALIGNED(daddr, ps)) {
|
||||
pr_err("%s: Created an unaligned scatterlist entry, addr=%pa, ps=%u\n",
|
||||
__func__, &daddr, ps);
|
||||
err = -EINVAL;
|
||||
goto out_close;
|
||||
}
|
||||
}
|
||||
|
||||
out_close:
|
||||
|
||||
@@ -33,7 +33,8 @@ static int mock_region_get_pages(struct drm_i915_gem_object *obj)
|
||||
return PTR_ERR(obj->mm.res);
|
||||
|
||||
obj->mm.rsgt = intel_region_ttm_resource_to_rsgt(obj->mm.region,
|
||||
obj->mm.res);
|
||||
obj->mm.res,
|
||||
obj->mm.region->min_page_size);
|
||||
if (IS_ERR(obj->mm.rsgt)) {
|
||||
err = PTR_ERR(obj->mm.rsgt);
|
||||
goto err_free_resource;
|
||||
|
||||
@@ -900,6 +900,11 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
|
||||
} else {
|
||||
dev_warn(dev, "Unexpected ACPI resources: gpio_count %d, gpio_int_idx %d\n",
|
||||
ts->gpio_count, ts->gpio_int_idx);
|
||||
/*
|
||||
* On some devices _PS0 does a reset for us and
|
||||
* sometimes this is necessary for things to work.
|
||||
*/
|
||||
acpi_device_fix_up_power(ACPI_COMPANION(dev));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1654,6 +1654,9 @@ static int usbtouch_probe(struct usb_interface *intf,
|
||||
if (id->driver_info == DEVTYPE_IGNORE)
|
||||
return -ENODEV;
|
||||
|
||||
if (id->driver_info >= ARRAY_SIZE(usbtouch_dev_info))
|
||||
return -ENODEV;
|
||||
|
||||
endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting);
|
||||
if (!endpoint)
|
||||
return -ENXIO;
|
||||
|
||||
@@ -758,7 +758,9 @@ batt_err:
|
||||
|
||||
static int wm97xx_mfd_remove(struct platform_device *pdev)
|
||||
{
|
||||
return wm97xx_remove(&pdev->dev);
|
||||
wm97xx_remove(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused wm97xx_suspend(struct device *dev)
|
||||
|
||||
@@ -3786,7 +3786,7 @@ static int nvme_add_ns_cdev(struct nvme_ns *ns)
|
||||
}
|
||||
|
||||
static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
|
||||
unsigned nsid, struct nvme_ns_ids *ids)
|
||||
unsigned nsid, struct nvme_ns_ids *ids, bool is_shared)
|
||||
{
|
||||
struct nvme_ns_head *head;
|
||||
size_t size = sizeof(*head);
|
||||
@@ -3810,6 +3810,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
|
||||
head->subsys = ctrl->subsys;
|
||||
head->ns_id = nsid;
|
||||
head->ids = *ids;
|
||||
head->shared = is_shared;
|
||||
kref_init(&head->ref);
|
||||
|
||||
if (head->ids.csi) {
|
||||
@@ -3891,12 +3892,11 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
|
||||
nsid);
|
||||
goto out_unlock;
|
||||
}
|
||||
head = nvme_alloc_ns_head(ctrl, nsid, ids);
|
||||
head = nvme_alloc_ns_head(ctrl, nsid, ids, is_shared);
|
||||
if (IS_ERR(head)) {
|
||||
ret = PTR_ERR(head);
|
||||
goto out_unlock;
|
||||
}
|
||||
head->shared = is_shared;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
if (!is_shared || !head->shared) {
|
||||
|
||||
@@ -2690,8 +2690,13 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
|
||||
struct pci_dev *pdev = to_pci_dev(dev->dev);
|
||||
|
||||
mutex_lock(&dev->shutdown_lock);
|
||||
if (pci_device_is_present(pdev) && pci_is_enabled(pdev)) {
|
||||
u32 csts = readl(dev->bar + NVME_REG_CSTS);
|
||||
if (pci_is_enabled(pdev)) {
|
||||
u32 csts;
|
||||
|
||||
if (pci_device_is_present(pdev))
|
||||
csts = readl(dev->bar + NVME_REG_CSTS);
|
||||
else
|
||||
csts = ~0;
|
||||
|
||||
if (dev->ctrl.state == NVME_CTRL_LIVE ||
|
||||
dev->ctrl.state == NVME_CTRL_RESETTING) {
|
||||
|
||||
@@ -91,6 +91,8 @@
|
||||
#define AMD_CPU_ID_PCO AMD_CPU_ID_RV
|
||||
#define AMD_CPU_ID_CZN AMD_CPU_ID_RN
|
||||
#define AMD_CPU_ID_YC 0x14B5
|
||||
#define AMD_CPU_ID_CB 0x14D8
|
||||
#define AMD_CPU_ID_PS 0x14E8
|
||||
|
||||
#define PMC_MSG_DELAY_MIN_US 50
|
||||
#define RESPONSE_REGISTER_LOOP_MAX 20000
|
||||
@@ -318,6 +320,8 @@ static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev,
|
||||
val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_CZN);
|
||||
break;
|
||||
case AMD_CPU_ID_YC:
|
||||
case AMD_CPU_ID_CB:
|
||||
case AMD_CPU_ID_PS:
|
||||
val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_YC);
|
||||
break;
|
||||
default:
|
||||
@@ -491,7 +495,8 @@ static void amd_pmc_dbgfs_register(struct amd_pmc_dev *dev)
|
||||
&amd_pmc_idlemask_fops);
|
||||
/* Enable STB only when the module_param is set */
|
||||
if (enable_stb) {
|
||||
if (dev->cpu_id == AMD_CPU_ID_YC)
|
||||
if (dev->cpu_id == AMD_CPU_ID_YC || dev->cpu_id == AMD_CPU_ID_CB ||
|
||||
dev->cpu_id == AMD_CPU_ID_PS)
|
||||
debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev,
|
||||
&amd_pmc_stb_debugfs_fops_v2);
|
||||
else
|
||||
@@ -615,6 +620,8 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
|
||||
return MSG_OS_HINT_PCO;
|
||||
case AMD_CPU_ID_RN:
|
||||
case AMD_CPU_ID_YC:
|
||||
case AMD_CPU_ID_CB:
|
||||
case AMD_CPU_ID_PS:
|
||||
return MSG_OS_HINT_RN;
|
||||
}
|
||||
return -EINVAL;
|
||||
@@ -735,6 +742,8 @@ static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
|
||||
#endif
|
||||
|
||||
static const struct pci_device_id pmc_pci_ids[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_PS) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_CB) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_YC) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_CZN) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_RN) },
|
||||
@@ -877,7 +886,7 @@ static int amd_pmc_probe(struct platform_device *pdev)
|
||||
|
||||
mutex_init(&dev->lock);
|
||||
|
||||
if (enable_stb && dev->cpu_id == AMD_CPU_ID_YC) {
|
||||
if (enable_stb && (dev->cpu_id == AMD_CPU_ID_YC || dev->cpu_id == AMD_CPU_ID_CB)) {
|
||||
err = amd_pmc_s2d_init(dev);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -915,6 +924,7 @@ static const struct acpi_device_id amd_pmc_acpi_ids[] = {
|
||||
{"AMDI0005", 0},
|
||||
{"AMDI0006", 0},
|
||||
{"AMDI0007", 0},
|
||||
{"AMDI0008", 0},
|
||||
{"AMD0004", 0},
|
||||
{"AMD0005", 0},
|
||||
{ }
|
||||
|
||||
@@ -522,6 +522,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
|
||||
{ KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
|
||||
{ KE_KEY, 0x32, { KEY_MUTE } },
|
||||
{ KE_KEY, 0x35, { KEY_SCREENLOCK } },
|
||||
{ KE_KEY, 0x38, { KEY_PROG3 } }, /* Armoury Crate */
|
||||
{ KE_KEY, 0x40, { KEY_PREVIOUSSONG } },
|
||||
{ KE_KEY, 0x41, { KEY_NEXTSONG } },
|
||||
{ KE_KEY, 0x43, { KEY_STOPCD } }, /* Stop/Eject */
|
||||
@@ -574,6 +575,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
|
||||
{ KE_KEY, 0xA5, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV + HDMI */
|
||||
{ KE_KEY, 0xA6, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + HDMI */
|
||||
{ KE_KEY, 0xA7, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + HDMI */
|
||||
{ KE_KEY, 0xB3, { KEY_PROG4 } }, /* AURA */
|
||||
{ KE_KEY, 0xB5, { KEY_CALC } },
|
||||
{ KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
|
||||
{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
|
||||
|
||||
@@ -150,6 +150,7 @@ static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = {
|
||||
DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M AORUS PRO-P"),
|
||||
DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M DS3H"),
|
||||
DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B660 GAMING X DDR4"),
|
||||
DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B660I AORUS PRO DDR4"),
|
||||
DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("Z390 I AORUS PRO WIFI-CF"),
|
||||
DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("Z490 AORUS ELITE AC"),
|
||||
DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("X570 AORUS ELITE"),
|
||||
|
||||
@@ -50,7 +50,8 @@ static const struct dmi_system_id atomisp2_led_systems[] __initconst = {
|
||||
{
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),
|
||||
/* Non exact match to also match T100TAF */
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "T100TA"),
|
||||
},
|
||||
.driver_data = &asus_t100ta_lookup,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
config INTEL_IFS
|
||||
tristate "Intel In Field Scan"
|
||||
depends on X86 && CPU_SUP_INTEL && 64BIT && SMP
|
||||
# Discussion on the list has shown that the sysfs API needs a bit
|
||||
# more work, mark this as broken for now
|
||||
depends on BROKEN
|
||||
select INTEL_IFS_DEVICE
|
||||
help
|
||||
Enable support for the In Field Scan capability in select
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#include <linux/pinctrl/machine.h>
|
||||
#include <linux/platform_data/lp855x.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/power/bq24190_charger.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/rmi.h>
|
||||
#include <linux/serdev.h>
|
||||
#include <linux/spi/spi.h>
|
||||
@@ -889,6 +889,7 @@ static const struct pinctrl_map lenovo_yoga_tab2_830_1050_codec_pinctrl_map =
|
||||
"INT33FC:02", "pmu_clk2_grp", "pmu_clk");
|
||||
|
||||
static struct pinctrl *lenovo_yoga_tab2_830_1050_codec_pinctrl;
|
||||
static struct sys_off_handler *lenovo_yoga_tab2_830_1050_sys_off_handler;
|
||||
|
||||
static int __init lenovo_yoga_tab2_830_1050_init_codec(void)
|
||||
{
|
||||
@@ -933,9 +934,11 @@ err_put_device:
|
||||
* followed by a normal 3 second press to recover. Avoid this by doing an EFI
|
||||
* poweroff instead.
|
||||
*/
|
||||
static void lenovo_yoga_tab2_830_1050_power_off(void)
|
||||
static int lenovo_yoga_tab2_830_1050_power_off(struct sys_off_data *data)
|
||||
{
|
||||
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static int __init lenovo_yoga_tab2_830_1050_init(void)
|
||||
@@ -950,13 +953,19 @@ static int __init lenovo_yoga_tab2_830_1050_init(void)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pm_power_off = lenovo_yoga_tab2_830_1050_power_off;
|
||||
/* SYS_OFF_PRIO_FIRMWARE + 1 so that it runs before acpi_power_off */
|
||||
lenovo_yoga_tab2_830_1050_sys_off_handler =
|
||||
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE + 1,
|
||||
lenovo_yoga_tab2_830_1050_power_off, NULL);
|
||||
if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler))
|
||||
return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void lenovo_yoga_tab2_830_1050_exit(void)
|
||||
{
|
||||
pm_power_off = NULL; /* Just turn poweroff into halt on module unload */
|
||||
unregister_sys_off_handler(lenovo_yoga_tab2_830_1050_sys_off_handler);
|
||||
|
||||
if (lenovo_yoga_tab2_830_1050_codec_pinctrl) {
|
||||
pinctrl_put(lenovo_yoga_tab2_830_1050_codec_pinctrl);
|
||||
|
||||
@@ -146,6 +146,7 @@ static int __init versatile_reboot_probe(void)
|
||||
versatile_reboot_type = (enum versatile_reboot)reboot_id->data;
|
||||
|
||||
syscon_regmap = syscon_node_to_regmap(np);
|
||||
of_node_put(np);
|
||||
if (IS_ERR(syscon_regmap))
|
||||
return PTR_ERR(syscon_regmap);
|
||||
|
||||
|
||||
@@ -3148,6 +3148,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||
ret = ab8500_fg_init_hw_registers(di);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to initialize registers\n");
|
||||
destroy_workqueue(di->fg_wq);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3159,6 +3160,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||
di->fg_psy = devm_power_supply_register(dev, &ab8500_fg_desc, &psy_cfg);
|
||||
if (IS_ERR(di->fg_psy)) {
|
||||
dev_err(dev, "failed to register FG psy\n");
|
||||
destroy_workqueue(di->fg_wq);
|
||||
return PTR_ERR(di->fg_psy);
|
||||
}
|
||||
|
||||
@@ -3174,8 +3176,10 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||
/* Register primary interrupt handlers */
|
||||
for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq); i++) {
|
||||
irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name);
|
||||
if (irq < 0)
|
||||
if (irq < 0) {
|
||||
destroy_workqueue(di->fg_wq);
|
||||
return irq;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(dev, irq, NULL,
|
||||
ab8500_fg_irq[i].isr,
|
||||
@@ -3185,6 +3189,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||
if (ret != 0) {
|
||||
dev_err(dev, "failed to request %s IRQ %d: %d\n",
|
||||
ab8500_fg_irq[i].name, irq, ret);
|
||||
destroy_workqueue(di->fg_wq);
|
||||
return ret;
|
||||
}
|
||||
dev_dbg(dev, "Requested %s IRQ %d: %d\n",
|
||||
@@ -3200,6 +3205,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||
ret = ab8500_fg_sysfs_init(di);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to create sysfs entry\n");
|
||||
destroy_workqueue(di->fg_wq);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3207,6 +3213,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to create FG psy\n");
|
||||
ab8500_fg_sysfs_exit(di);
|
||||
destroy_workqueue(di->fg_wq);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -924,17 +924,17 @@ int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *t
|
||||
{
|
||||
int i, high, low;
|
||||
|
||||
/* Break loop at table_len - 1 because that is the highest index */
|
||||
for (i = 0; i < table_len - 1; i++)
|
||||
for (i = 0; i < table_len; i++)
|
||||
if (temp > table[i].temp)
|
||||
break;
|
||||
|
||||
/* The library function will deal with high == low */
|
||||
if ((i == 0) || (i == (table_len - 1)))
|
||||
high = i;
|
||||
if (i == 0)
|
||||
high = low = i;
|
||||
else if (i == table_len)
|
||||
high = low = i - 1;
|
||||
else
|
||||
high = i - 1;
|
||||
low = i;
|
||||
high = (low = i) - 1;
|
||||
|
||||
return fixp_linear_interpolate(table[low].temp,
|
||||
table[low].resistance,
|
||||
@@ -1036,17 +1036,17 @@ int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
|
||||
{
|
||||
int i, high, low;
|
||||
|
||||
/* Break loop at table_len - 1 because that is the highest index */
|
||||
for (i = 0; i < table_len - 1; i++)
|
||||
for (i = 0; i < table_len; i++)
|
||||
if (ocv > table[i].ocv)
|
||||
break;
|
||||
|
||||
/* The library function will deal with high == low */
|
||||
if ((i == 0) || (i == (table_len - 1)))
|
||||
high = i - 1;
|
||||
if (i == 0)
|
||||
high = low = i;
|
||||
else if (i == table_len)
|
||||
high = low = i - 1;
|
||||
else
|
||||
high = i; /* i.e. i == 0 */
|
||||
low = i;
|
||||
high = (low = i) - 1;
|
||||
|
||||
return fixp_linear_interpolate(table[low].ocv,
|
||||
table[low].capacity,
|
||||
|
||||
@@ -1435,7 +1435,7 @@ static int __verify_queue_reservations(struct device_driver *drv, void *data)
|
||||
if (ap_drv->in_use) {
|
||||
rc = ap_drv->in_use(ap_perms.apm, newaqm);
|
||||
if (rc)
|
||||
return -EBUSY;
|
||||
rc = -EBUSY;
|
||||
}
|
||||
|
||||
/* release the driver's module */
|
||||
|
||||
@@ -3195,6 +3195,9 @@ static int megasas_map_queues(struct Scsi_Host *shost)
|
||||
qoff += map->nr_queues;
|
||||
offset += map->nr_queues;
|
||||
|
||||
/* we never use READ queue, so can't cheat blk-mq */
|
||||
shost->tag_set.map[HCTX_TYPE_READ].nr_queues = 0;
|
||||
|
||||
/* Setup Poll hctx */
|
||||
map = &shost->tag_set.map[HCTX_TYPE_POLL];
|
||||
map->nr_queues = instance->iopoll_q_count;
|
||||
|
||||
@@ -3145,15 +3145,6 @@ void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i)
|
||||
if (!phy->phy_attached)
|
||||
return;
|
||||
|
||||
if (sas_phy->phy) {
|
||||
struct sas_phy *sphy = sas_phy->phy;
|
||||
sphy->negotiated_linkrate = sas_phy->linkrate;
|
||||
sphy->minimum_linkrate = phy->minimum_linkrate;
|
||||
sphy->minimum_linkrate_hw = SAS_LINK_RATE_1_5_GBPS;
|
||||
sphy->maximum_linkrate = phy->maximum_linkrate;
|
||||
sphy->maximum_linkrate_hw = phy->maximum_linkrate;
|
||||
}
|
||||
|
||||
if (phy->phy_type & PORT_TYPE_SAS) {
|
||||
struct sas_identify_frame *id;
|
||||
id = (struct sas_identify_frame *)phy->frame_rcvd;
|
||||
@@ -3177,26 +3168,22 @@ void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate)
|
||||
switch (link_rate) {
|
||||
case PHY_SPEED_120:
|
||||
phy->sas_phy.linkrate = SAS_LINK_RATE_12_0_GBPS;
|
||||
phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_12_0_GBPS;
|
||||
break;
|
||||
case PHY_SPEED_60:
|
||||
phy->sas_phy.linkrate = SAS_LINK_RATE_6_0_GBPS;
|
||||
phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_6_0_GBPS;
|
||||
break;
|
||||
case PHY_SPEED_30:
|
||||
phy->sas_phy.linkrate = SAS_LINK_RATE_3_0_GBPS;
|
||||
phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_3_0_GBPS;
|
||||
break;
|
||||
case PHY_SPEED_15:
|
||||
phy->sas_phy.linkrate = SAS_LINK_RATE_1_5_GBPS;
|
||||
phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_1_5_GBPS;
|
||||
break;
|
||||
}
|
||||
sas_phy->negotiated_linkrate = phy->sas_phy.linkrate;
|
||||
sas_phy->maximum_linkrate_hw = SAS_LINK_RATE_6_0_GBPS;
|
||||
sas_phy->maximum_linkrate_hw = phy->maximum_linkrate;
|
||||
sas_phy->minimum_linkrate_hw = SAS_LINK_RATE_1_5_GBPS;
|
||||
sas_phy->maximum_linkrate = SAS_LINK_RATE_6_0_GBPS;
|
||||
sas_phy->minimum_linkrate = SAS_LINK_RATE_1_5_GBPS;
|
||||
sas_phy->maximum_linkrate = phy->maximum_linkrate;
|
||||
sas_phy->minimum_linkrate = phy->minimum_linkrate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -143,6 +143,8 @@ static void pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, int phy_id)
|
||||
struct asd_sas_phy *sas_phy = &phy->sas_phy;
|
||||
phy->phy_state = PHY_LINK_DISABLE;
|
||||
phy->pm8001_ha = pm8001_ha;
|
||||
phy->minimum_linkrate = SAS_LINK_RATE_1_5_GBPS;
|
||||
phy->maximum_linkrate = SAS_LINK_RATE_6_0_GBPS;
|
||||
sas_phy->enabled = (phy_id < pm8001_ha->chip->n_phy) ? 1 : 0;
|
||||
sas_phy->class = SAS;
|
||||
sas_phy->iproto = SAS_PROTOCOL_ALL;
|
||||
|
||||
@@ -3723,8 +3723,12 @@ static int mpi_phy_stop_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
|
||||
pm8001_dbg(pm8001_ha, MSG, "phy:0x%x status:0x%x\n",
|
||||
phyid, status);
|
||||
if (status == PHY_STOP_SUCCESS ||
|
||||
status == PHY_STOP_ERR_DEVICE_ATTACHED)
|
||||
status == PHY_STOP_ERR_DEVICE_ATTACHED) {
|
||||
phy->phy_state = PHY_LINK_DISABLE;
|
||||
phy->sas_phy.phy->negotiated_linkrate = SAS_PHY_DISABLED;
|
||||
phy->sas_phy.linkrate = SAS_PHY_DISABLED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#define AMD_SPI_RX_COUNT_REG 0x4B
|
||||
#define AMD_SPI_STATUS_REG 0x4C
|
||||
|
||||
#define AMD_SPI_FIFO_SIZE 70
|
||||
#define AMD_SPI_MEM_SIZE 200
|
||||
|
||||
/* M_CMD OP codes for SPI */
|
||||
@@ -270,6 +271,11 @@ static int amd_spi_master_transfer(struct spi_master *master,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t amd_spi_max_transfer_size(struct spi_device *spi)
|
||||
{
|
||||
return AMD_SPI_FIFO_SIZE;
|
||||
}
|
||||
|
||||
static int amd_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -302,6 +308,8 @@ static int amd_spi_probe(struct platform_device *pdev)
|
||||
master->flags = SPI_MASTER_HALF_DUPLEX;
|
||||
master->setup = amd_spi_master_setup;
|
||||
master->transfer_one_message = amd_spi_master_transfer;
|
||||
master->max_transfer_size = amd_spi_max_transfer_size;
|
||||
master->max_message_size = amd_spi_max_transfer_size;
|
||||
|
||||
/* Register the controller with SPI framework */
|
||||
err = devm_spi_register_master(dev, master);
|
||||
|
||||
@@ -558,6 +558,14 @@ static int aspeed_spi_dirmap_create(struct spi_mem_dirmap_desc *desc)
|
||||
u32 ctl_val;
|
||||
int ret = 0;
|
||||
|
||||
dev_dbg(aspi->dev,
|
||||
"CE%d %s dirmap [ 0x%.8llx - 0x%.8llx ] OP %#x mode:%d.%d.%d.%d naddr:%#x ndummies:%#x\n",
|
||||
chip->cs, op->data.dir == SPI_MEM_DATA_IN ? "read" : "write",
|
||||
desc->info.offset, desc->info.offset + desc->info.length,
|
||||
op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
|
||||
op->dummy.buswidth, op->data.buswidth,
|
||||
op->addr.nbytes, op->dummy.nbytes);
|
||||
|
||||
chip->clk_freq = desc->mem->spi->max_speed_hz;
|
||||
|
||||
/* Only for reads */
|
||||
@@ -574,9 +582,11 @@ static int aspeed_spi_dirmap_create(struct spi_mem_dirmap_desc *desc)
|
||||
ctl_val = readl(chip->ctl) & ~CTRL_IO_CMD_MASK;
|
||||
ctl_val |= aspeed_spi_get_io_mode(op) |
|
||||
op->cmd.opcode << CTRL_COMMAND_SHIFT |
|
||||
CTRL_IO_DUMMY_SET(op->dummy.nbytes / op->dummy.buswidth) |
|
||||
CTRL_IO_MODE_READ;
|
||||
|
||||
if (op->dummy.nbytes)
|
||||
ctl_val |= CTRL_IO_DUMMY_SET(op->dummy.nbytes / op->dummy.buswidth);
|
||||
|
||||
/* Tune 4BYTE address mode */
|
||||
if (op->addr.nbytes) {
|
||||
u32 addr_mode = readl(aspi->regs + CE_CTRL_REG);
|
||||
|
||||
@@ -1578,8 +1578,7 @@ static int cqspi_probe(struct platform_device *pdev)
|
||||
ret = cqspi_of_get_pdata(cqspi);
|
||||
if (ret) {
|
||||
dev_err(dev, "Cannot get mandatory OF data.\n");
|
||||
ret = -ENODEV;
|
||||
goto probe_master_put;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Obtain QSPI clock. */
|
||||
@@ -1587,7 +1586,7 @@ static int cqspi_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(cqspi->clk)) {
|
||||
dev_err(dev, "Cannot claim QSPI clock.\n");
|
||||
ret = PTR_ERR(cqspi->clk);
|
||||
goto probe_master_put;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Obtain and remap controller address. */
|
||||
@@ -1596,7 +1595,7 @@ static int cqspi_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(cqspi->iobase)) {
|
||||
dev_err(dev, "Cannot remap controller address.\n");
|
||||
ret = PTR_ERR(cqspi->iobase);
|
||||
goto probe_master_put;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Obtain and remap AHB address. */
|
||||
@@ -1605,7 +1604,7 @@ static int cqspi_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(cqspi->ahb_base)) {
|
||||
dev_err(dev, "Cannot remap AHB address.\n");
|
||||
ret = PTR_ERR(cqspi->ahb_base);
|
||||
goto probe_master_put;
|
||||
return ret;
|
||||
}
|
||||
cqspi->mmap_phys_base = (dma_addr_t)res_ahb->start;
|
||||
cqspi->ahb_size = resource_size(res_ahb);
|
||||
@@ -1614,15 +1613,13 @@ static int cqspi_probe(struct platform_device *pdev)
|
||||
|
||||
/* Obtain IRQ line. */
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
ret = -ENXIO;
|
||||
goto probe_master_put;
|
||||
}
|
||||
if (irq < 0)
|
||||
return -ENXIO;
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
ret = pm_runtime_resume_and_get(dev);
|
||||
if (ret < 0)
|
||||
goto probe_master_put;
|
||||
return ret;
|
||||
|
||||
ret = clk_prepare_enable(cqspi->clk);
|
||||
if (ret) {
|
||||
@@ -1716,8 +1713,6 @@ probe_reset_failed:
|
||||
probe_clk_failed:
|
||||
pm_runtime_put_sync(dev);
|
||||
pm_runtime_disable(dev);
|
||||
probe_master_put:
|
||||
spi_master_put(master);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -448,6 +448,9 @@ fd_execute_write_same(struct se_cmd *cmd)
|
||||
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
}
|
||||
|
||||
if (!cmd->t_data_nents)
|
||||
return TCM_INVALID_CDB_FIELD;
|
||||
|
||||
if (cmd->t_data_nents > 1 ||
|
||||
cmd->t_data_sg[0].length != cmd->se_dev->dev_attrib.block_size) {
|
||||
pr_err("WRITE_SAME: Illegal SGL t_data_nents: %u length: %u"
|
||||
|
||||
@@ -494,6 +494,10 @@ iblock_execute_write_same(struct se_cmd *cmd)
|
||||
" backends not supported\n");
|
||||
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
}
|
||||
|
||||
if (!cmd->t_data_nents)
|
||||
return TCM_INVALID_CDB_FIELD;
|
||||
|
||||
sg = &cmd->t_data_sg[0];
|
||||
|
||||
if (cmd->t_data_nents > 1 ||
|
||||
|
||||
@@ -312,6 +312,12 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *op
|
||||
pr_warn("WRITE SAME with ANCHOR not supported\n");
|
||||
return TCM_INVALID_CDB_FIELD;
|
||||
}
|
||||
|
||||
if (flags & 0x01) {
|
||||
pr_warn("WRITE SAME with NDOB not supported\n");
|
||||
return TCM_INVALID_CDB_FIELD;
|
||||
}
|
||||
|
||||
/*
|
||||
* Special case for WRITE_SAME w/ UNMAP=1 that ends up getting
|
||||
* translated into block discard requests within backend code.
|
||||
|
||||
@@ -189,7 +189,7 @@ struct optee_smc_call_get_os_revision_result {
|
||||
* Have config return register usage:
|
||||
* a0 OPTEE_SMC_RETURN_OK
|
||||
* a1 Physical address of start of SHM
|
||||
* a2 Size of of SHM
|
||||
* a2 Size of SHM
|
||||
* a3 Cache settings of memory, as defined by the
|
||||
* OPTEE_SMC_SHM_* values above
|
||||
* a4-7 Preserved
|
||||
|
||||
@@ -884,8 +884,8 @@ static int optee_smc_do_call_with_arg(struct tee_context *ctx,
|
||||
|
||||
rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
|
||||
rpc_arg = tee_shm_get_va(shm, offs + rpc_arg_offs);
|
||||
if (IS_ERR(arg))
|
||||
return PTR_ERR(arg);
|
||||
if (IS_ERR(rpc_arg))
|
||||
return PTR_ERR(rpc_arg);
|
||||
}
|
||||
|
||||
if (rpc_arg && tee_shm_is_dynamic(shm)) {
|
||||
|
||||
@@ -1073,7 +1073,7 @@ EXPORT_SYMBOL_GPL(tee_device_unregister);
|
||||
/**
|
||||
* tee_get_drvdata() - Return driver_data pointer
|
||||
* @teedev: Device containing the driver_data pointer
|
||||
* @returns the driver_data pointer supplied to tee_register().
|
||||
* @returns the driver_data pointer supplied to tee_device_alloc().
|
||||
*/
|
||||
void *tee_get_drvdata(struct tee_device *teedev)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user