Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
authorJakub Kicinski <kuba@kernel.org>
Wed, 4 Oct 2023 15:28:07 +0000 (08:28 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 4 Oct 2023 15:28:07 +0000 (08:28 -0700)
Daniel Borkmann says:

====================
pull-request: bpf 2023-10-02

We've added 11 non-merge commits during the last 12 day(s) which contain
a total of 12 files changed, 176 insertions(+), 41 deletions(-).

The main changes are:

1) Fix BPF verifier to reset backtrack_state masks on global function
   exit as otherwise subsequent precision tracking would reuse them,
   from Andrii Nakryiko.

2) Several sockmap fixes for available bytes accounting,
   from John Fastabend.

3) Reject sk_msg egress redirects to non-TCP sockets given this
   is only supported for TCP sockets today, from Jakub Sitnicki.

4) Fix a syzkaller splat in bpf_mprog when hitting maximum program
   limits with BPF_F_BEFORE directive, from Daniel Borkmann
   and Nikolay Aleksandrov.

5) Fix BPF memory allocator to use kmalloc_size_roundup() to adjust
   size_index for selecting a bpf_mem_cache, from Hou Tao.

6) Fix arch_prepare_bpf_trampoline return code for s390 JIT,
   from Song Liu.

7) Fix bpf_trampoline_get when CONFIG_BPF_JIT is turned off,
   from Leon Hwang.

* tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
  bpf: Use kmalloc_size_roundup() to adjust size_index
  selftest/bpf: Add various selftests for program limits
  bpf, mprog: Fix maximum program check on mprog attachment
  bpf, sockmap: Reject sk_msg egress redirects to non-TCP sockets
  bpf, sockmap: Add tests for MSG_F_PEEK
  bpf, sockmap: Do not inc copied_seq when PEEK flag set
  bpf: tcp_read_skb needs to pop skb regardless of seq
  bpf: unconditionally reset backtrack_state masks on global func exit
  bpf: Fix tr dereferencing
  selftests/bpf: Check bpf_cubic_acked() is called via struct_ops
  s390/bpf: Let arch_prepare_bpf_trampoline return program size
====================

Link: https://lore.kernel.org/r/20231002113417.2309-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
366 files changed:
Documentation/process/embargoed-hardware-issues.rst
Documentation/sound/designs/midi-2.0.rst
Makefile
arch/arm/xen/enlighten.c
arch/powerpc/Kconfig
arch/powerpc/kernel/hw_breakpoint.c
arch/powerpc/kernel/hw_breakpoint_constraints.c
arch/powerpc/kernel/traps.c
arch/powerpc/perf/hv-24x7.c
arch/powerpc/platforms/82xx/Kconfig
arch/riscv/include/asm/errata_list.h
arch/riscv/kernel/elf_kexec.c
arch/x86/Kconfig
arch/x86/boot/compressed/ident_map_64.c
arch/x86/entry/common.c
arch/x86/include/asm/boot.h
arch/x86/include/asm/efi.h
arch/x86/include/asm/linkage.h
arch/x86/include/asm/paravirt_types.h
arch/x86/include/asm/xen/hypervisor.h
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/kernel/paravirt.c
arch/x86/kernel/smpboot.c
arch/x86/lib/putuser.S
arch/x86/platform/efi/efi_32.c
arch/x86/platform/efi/efi_64.c
arch/x86/purgatory/Makefile
arch/x86/xen/efi.c
arch/x86/xen/enlighten.c
arch/x86/xen/enlighten_hvm.c
arch/x86/xen/enlighten_pv.c
arch/x86/xen/mmu_pv.c
arch/x86/xen/multicalls.h
block/blk-mq.c
drivers/acpi/thermal.c
drivers/ata/ahci.c
drivers/ata/libahci.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-sata.c
drivers/ata/pata_parport/comm.c
drivers/ata/sata_mv.c
drivers/base/core.c
drivers/bluetooth/btusb.c
drivers/comedi/Kconfig
drivers/dma/ti/k3-udma-glue.c
drivers/firewire/core-device.c
drivers/firewire/core-topology.c
drivers/firmware/cirrus/cs_dsp.c
drivers/firmware/efi/libstub/unaccepted_memory.c
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c
drivers/gpu/drm/amd/amdgpu/soc21.c
drivers/gpu/drm/amd/amdkfd/kfd_crat.c
drivers/gpu/drm/amd/amdkfd/kfd_crat.h
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
drivers/gpu/drm/amd/amdkfd/kfd_topology.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
drivers/gpu/drm/amd/display/dc/inc/core_types.h
drivers/gpu/drm/amd/display/dc/link/link_factory.c
drivers/gpu/drm/amd/include/kgd_kfd_interface.h
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
drivers/gpu/drm/drm_connector.c
drivers/gpu/drm/drm_exec.c
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/display/intel_bios.h
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/radeon/radeon_sa.c
drivers/gpu/drm/tiny/gm12u320.c
drivers/gpu/drm/vkms/vkms_composer.c
drivers/gpu/drm/vkms/vkms_crtc.c
drivers/gpu/drm/vkms/vkms_drv.h
drivers/hwmon/nct6775-core.c
drivers/i2c/Kconfig
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-aspeed.c
drivers/i2c/busses/i2c-cadence.c
drivers/md/dm-core.h
drivers/md/dm-ioctl.c
drivers/md/dm-table.c
drivers/md/dm.c
drivers/md/md.c
drivers/md/md.h
drivers/md/raid1.c
drivers/media/common/videobuf2/frame_vector.c
drivers/media/i2c/imx219.c
drivers/media/i2c/max9286.c
drivers/media/i2c/rdacm21.c
drivers/media/pci/bt8xx/bttv-risc.c
drivers/media/pci/intel/ivsc/Kconfig
drivers/media/platform/marvell/Kconfig
drivers/media/platform/nxp/imx-mipi-csis.c
drivers/media/platform/via/Kconfig
drivers/media/usb/em28xx/Kconfig
drivers/media/usb/go7007/Kconfig
drivers/media/usb/uvc/uvc_ctrl.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/mv88e6xxx/global1.c
drivers/net/dsa/mv88e6xxx/global1.h
drivers/net/dsa/mv88e6xxx/global2.c
drivers/net/dsa/mv88e6xxx/global2.h
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
drivers/net/ethernet/huawei/hinic/hinic_port.c
drivers/net/ethernet/ibm/ibmveth.c
drivers/net/ethernet/intel/ice/ice_virtchnl.c
drivers/net/ethernet/intel/igc/igc_ethtool.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
drivers/net/ethernet/marvell/sky2.h
drivers/net/ethernet/qlogic/qed/qed_ll2.h
drivers/net/ethernet/renesas/rswitch.c
drivers/net/ethernet/renesas/rswitch.h
drivers/net/ethernet/sfc/tc.c
drivers/net/ethernet/sfc/tc_conntrack.c
drivers/net/ethernet/sfc/tc_counters.c
drivers/net/ethernet/sfc/tc_encap_actions.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/ethernet/ti/am65-cpsw-nuss.c
drivers/net/ethernet/ti/icssg/icssg_prueth.c
drivers/net/team/team.c
drivers/net/usb/smsc75xx.c
drivers/net/vxlan/vxlan_core.c
drivers/net/wan/fsl_ucc_hdlc.c
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/hwmon.c
drivers/nvme/host/pci.c
drivers/nvme/target/tcp.c
drivers/ptp/ptp_ocp.c
drivers/regulator/helpers.c
drivers/scsi/lpfc/lpfc_debugfs.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_nvme.c
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/pm8001/pm8001_hwi.c
drivers/scsi/pm8001/pm8001_init.c
drivers/scsi/pm8001/pm80xx_hwi.c
drivers/scsi/ppa.c
drivers/scsi/qedf/qedf_io.c
drivers/scsi/qedf/qedf_main.c
drivers/scsi/qla2xxx/qla_dfs.c
drivers/scsi/qla2xxx/qla_inline.h
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_nvme.c
drivers/scsi/qla2xxx/qla_target.c
drivers/scsi/qla2xxx/tcm_qla2xxx.c
drivers/spi/spi-imx.c
drivers/spi/spi-intel-pci.c
drivers/spi/spi-nxp-fspi.c
drivers/spi/spi-stm32.c
drivers/spi/spi-zynqmp-gqspi.c
drivers/target/target_core_configfs.c
drivers/target/target_core_transport.c
drivers/thermal/thermal_core.c
drivers/thermal/thermal_of.c
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
drivers/ufs/core/ufshcd.c
drivers/usb/typec/ucsi/debugfs.c
drivers/vhost/vringh.c
drivers/w1/masters/ds2482.c
drivers/xen/events/events_base.c
drivers/xen/platform-pci.c
fs/btrfs/extent_io.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/super.c
fs/btrfs/verity.c
fs/efivarfs/super.c
fs/ext4/mballoc.c
fs/ext4/namei.c
fs/ext4/super.c
fs/gfs2/glock.c
fs/gfs2/glops.c
fs/gfs2/quota.h
fs/inode.c
fs/jbd2/commit.c
fs/jbd2/journal.c
fs/jbd2/transaction.c
fs/netfs/buffered_read.c
fs/nfs/direct.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/nfs4client.c
fs/nfs/nfs4proc.c
fs/nfs/write.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfssvc.c
fs/smb/client/inode.c
fs/smb/client/smb2ops.c
fs/smb/client/smb2pdu.c
fs/smb/client/transport.c
fs/smb/server/smb2pdu.c
fs/smb/server/smbacl.c
fs/stat.c
fs/xfs/libxfs/xfs_trans_inode.c
fs/xfs/xfs_iops.c
fs/xfs/xfs_super.c
include/drm/drm_exec.h
include/drm/drm_kunit_helpers.h
include/linux/buffer_head.h
include/linux/fs.h
include/linux/i2c.h
include/linux/if_team.h
include/linux/instruction_pointer.h
include/linux/libata.h
include/linux/nfs_fs_sb.h
include/linux/nfs_page.h
include/linux/nvme-fc-driver.h
include/linux/sunrpc/xdr.h
include/linux/thermal.h
include/net/bluetooth/hci_core.h
include/net/ip_fib.h
include/net/neighbour.h
include/net/netfilter/nf_tables.h
include/trace/events/xen.h
include/xen/arm/hypervisor.h
include/xen/events.h
io_uring/net.c
kernel/panic.c
kernel/power/hibernate.c
kernel/power/power.h
kernel/power/swap.c
kernel/sched/fair.c
mm/mremap.c
mm/shmem.c
net/bluetooth/hci_conn.c
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c
net/bluetooth/hci_request.h
net/bluetooth/hci_sync.c
net/bluetooth/iso.c
net/bridge/br_forward.c
net/bridge/br_input.c
net/bridge/br_netfilter_hooks.c
net/core/neighbour.c
net/ethtool/plca.c
net/handshake/handshake-test.c
net/ipv4/fib_semantics.c
net/ipv4/fib_trie.c
net/ipv6/tcp_ipv6.c
net/l2tp/l2tp_ip6.c
net/netfilter/ipset/ip_set_core.c
net/netfilter/ipvs/ip_vs_sync.c
net/netfilter/nf_tables_api.c
net/nfc/llcp_core.c
net/rds/rdma_transport.c
net/rds/tcp_connect.c
net/rds/tcp_listen.c
net/socket.c
net/sunrpc/clnt.c
scripts/Makefile.modinst
scripts/package/install-extmod-build
security/selinux/hooks.c
sound/core/init.c
sound/core/rawmidi.c
sound/core/seq/seq_midi.c
sound/core/seq/seq_ump_client.c
sound/core/seq/seq_ump_convert.c
sound/firewire/bebob/bebob_midi.c
sound/firewire/dice/dice-midi.c
sound/firewire/digi00x/digi00x-midi.c
sound/firewire/fireface/ff-midi.c
sound/firewire/fireworks/fireworks.c
sound/firewire/fireworks/fireworks_midi.c
sound/firewire/motu/motu-midi.c
sound/firewire/oxfw/oxfw-midi.c
sound/firewire/oxfw/oxfw.c
sound/firewire/tascam/tascam-midi.c
sound/hda/intel-sdw-acpi.c
sound/isa/ad1848/ad1848.c
sound/isa/cs423x/cs4231.c
sound/isa/cs423x/cs4236.c
sound/isa/es1688/es1688.c
sound/isa/opti9xx/miro.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sscape.c
sound/pci/cmipci.c
sound/pci/hda/cs35l56_hda.c
sound/pci/hda/cs35l56_hda_i2c.c
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_realtek.c
sound/pci/riptide/riptide.c
sound/soc/amd/yc/acp6x-mach.c
sound/soc/codecs/aw88395/aw88395_lib.c
sound/soc/codecs/cs35l56-i2c.c
sound/soc/codecs/cs35l56.c
sound/soc/codecs/cs42l42-sdw.c
sound/soc/codecs/cs42l42.c
sound/soc/codecs/cs42l42.h
sound/soc/codecs/cs42l43.c
sound/soc/codecs/rt5640.c
sound/soc/codecs/wm8960.c
sound/soc/codecs/wm_adsp.c
sound/soc/fsl/imx-audmix.c
sound/soc/fsl/imx-pcm-rpmsg.c
sound/soc/fsl/imx-rpmsg.c
sound/soc/intel/avs/boards/hdaudio.c
sound/soc/meson/axg-spdifin.c
sound/soc/sh/rcar/core.c
sound/soc/soc-pcm.c
sound/soc/soc-utils.c
sound/soc/sof/core.c
sound/soc/sof/intel/mtl.c
sound/soc/sof/intel/mtl.h
sound/soc/sof/ipc4-topology.c
sound/soc/sof/sof-audio.c
sound/soc/tegra/tegra_audio_graph_card.c
sound/usb/caiaq/device.c
sound/usb/mixer.c
sound/usb/mixer_scarlett_gen2.c
sound/xen/xen_snd_front_cfg.c
tools/include/linux/mm.h
tools/include/linux/seq_file.h
tools/objtool/check.c
tools/testing/memblock/internal.h
tools/testing/memblock/mmzone.c
tools/testing/memblock/tests/basic_api.c
tools/testing/memblock/tests/common.h
tools/testing/selftests/alsa/conf.c
tools/testing/selftests/alsa/mixer-test.c
tools/testing/selftests/alsa/pcm-test.c
tools/testing/selftests/alsa/test-pcmtest-driver.c
tools/testing/selftests/ftrace/ftracetest
tools/testing/selftests/user_events/abi_test.c
tools/testing/selftests/user_events/config [new file with mode: 0644]
tools/testing/selftests/user_events/dyn_test.c
tools/testing/selftests/user_events/ftrace_test.c
tools/testing/selftests/user_events/perf_test.c
tools/testing/selftests/user_events/user_events_selftests.h [new file with mode: 0644]

index cb686238f21d1de3bb3483d629237779b240120c..ac7c52f130c9b30978267fdd9d92994f01878260 100644 (file)
@@ -251,6 +251,7 @@ an involved disclosed party. The current ambassadors list:
   IBM Z                Christian Borntraeger <borntraeger@de.ibm.com>
   Intel                Tony Luck <tony.luck@intel.com>
   Qualcomm     Trilok Soni <tsoni@codeaurora.org>
+  RISC-V       Palmer Dabbelt <palmer@dabbelt.com>
   Samsung      Javier González <javier.gonz@samsung.com>
 
   Microsoft    James Morris <jamorris@linux.microsoft.com>
index 45987f256b976312644e94522f5565fbf062e255..086487ca7ab11905a8374437d31f12c29f84a402 100644 (file)
@@ -74,8 +74,8 @@ topology based on those information.  When the device is older and
 doesn't respond to the new UMP inquiries, the driver falls back and
 builds the topology based on Group Terminal Block (GTB) information
 from the USB descriptor.  Some device might be screwed up by the
-unexpected UMP command; in such a case, pass `midi2_probe=0` option to
-snd-usb-audio driver for skipping the UMP v1.1 inquiries.
+unexpected UMP command; in such a case, pass `midi2_ump_probe=0`
+option to snd-usb-audio driver for skipping the UMP v1.1 inquiries.
 
 When the MIDI 2.0 device is probed, the kernel creates a rawmidi
 device for each UMP Endpoint of the device.  Its device name is
index ceb23eed4dce2b0d826e0ac21c51b659392f80ed..57698d048e2caa0d5d9c437cb091156072093015 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 6
 PATCHLEVEL = 6
 SUBLEVEL = 0
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc2
 NAME = Hurr durr I'ma ninja sloth
 
 # *DOCUMENTATION*
index 7d59765aef220b429afdf7a8d3a2a6ec0923c0b2..c392e18f1e43178fd00a177033baba203e25e931 100644 (file)
@@ -207,7 +207,7 @@ static void xen_power_off(void)
 
 static irqreturn_t xen_arm_callback(int irq, void *arg)
 {
-       xen_hvm_evtchn_do_upcall();
+       xen_evtchn_do_upcall();
        return IRQ_HANDLED;
 }
 
index 54b9387c3691643ae486248d60e5482e011cc060..3aaadfd2c8eb24504774235228eb43850ea7de2a 100644 (file)
@@ -255,7 +255,7 @@ config PPC
        select HAVE_KPROBES
        select HAVE_KPROBES_ON_FTRACE
        select HAVE_KRETPROBES
-       select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if HAVE_OBJTOOL_MCOUNT
+       select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if HAVE_OBJTOOL_MCOUNT && (!ARCH_USING_PATCHABLE_FUNCTION_ENTRY || (!CC_IS_GCC || GCC_VERSION >= 110100))
        select HAVE_LIVEPATCH                   if HAVE_DYNAMIC_FTRACE_WITH_REGS
        select HAVE_MOD_ARCH_SPECIFIC
        select HAVE_NMI                         if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
index b8513dc3e53ac8cb654177591b1513b5a1f17c49..a1318ce18d0e61b34f49869b12ae4dcfd3cc5f95 100644 (file)
@@ -230,13 +230,15 @@ void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs)
        struct arch_hw_breakpoint *info;
        int i;
 
+       preempt_disable();
+
        for (i = 0; i < nr_wp_slots(); i++) {
                struct perf_event *bp = __this_cpu_read(bp_per_reg[i]);
 
                if (unlikely(bp && counter_arch_bp(bp)->perf_single_step))
                        goto reset;
        }
-       return;
+       goto out;
 
 reset:
        regs_set_return_msr(regs, regs->msr & ~MSR_SE);
@@ -245,6 +247,9 @@ reset:
                __set_breakpoint(i, info);
                info->perf_single_step = false;
        }
+
+out:
+       preempt_enable();
 }
 
 static bool is_larx_stcx_instr(int type)
@@ -363,6 +368,11 @@ static void handle_p10dd1_spurious_exception(struct perf_event **bp,
        }
 }
 
+/*
+ * Handle a DABR or DAWR exception.
+ *
+ * Called in atomic context.
+ */
 int hw_breakpoint_handler(struct die_args *args)
 {
        bool err = false;
@@ -490,6 +500,8 @@ NOKPROBE_SYMBOL(hw_breakpoint_handler);
 
 /*
  * Handle single-step exceptions following a DABR hit.
+ *
+ * Called in atomic context.
  */
 static int single_step_dabr_instruction(struct die_args *args)
 {
@@ -541,6 +553,8 @@ NOKPROBE_SYMBOL(single_step_dabr_instruction);
 
 /*
  * Handle debug exception notifications.
+ *
+ * Called in atomic context.
  */
 int hw_breakpoint_exceptions_notify(
                struct notifier_block *unused, unsigned long val, void *data)
index a74623025f3ab87b5a3375bab26e19c25b1ae173..9e51801c49152e32236b4ef5aa8a89ee05501445 100644 (file)
@@ -131,8 +131,13 @@ void wp_get_instr_detail(struct pt_regs *regs, ppc_inst_t *instr,
                         int *type, int *size, unsigned long *ea)
 {
        struct instruction_op op;
+       int err;
 
-       if (__get_user_instr(*instr, (void __user *)regs->nip))
+       pagefault_disable();
+       err = __get_user_instr(*instr, (void __user *)regs->nip);
+       pagefault_enable();
+
+       if (err)
                return;
 
        analyse_instr(&op, regs, *instr);
index eeff136b83d97b22343cf1b7ce8b3b0144f5943c..64ff37721fd06f4914ba8bf6b80abc19f1b2cc32 100644 (file)
@@ -1512,23 +1512,11 @@ static void do_program_check(struct pt_regs *regs)
                        return;
                }
 
-               if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE) && user_mode(regs)) {
-                       ppc_inst_t insn;
-
-                       if (get_user_instr(insn, (void __user *)regs->nip)) {
-                               _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
-                               return;
-                       }
-
-                       if (ppc_inst_primary_opcode(insn) == 31 &&
-                           get_xop(ppc_inst_val(insn)) == OP_31_XOP_HASHCHK) {
-                               _exception(SIGILL, regs, ILL_ILLOPN, regs->nip);
-                               return;
-                       }
+               /* User mode considers other cases after enabling IRQs */
+               if (!user_mode(regs)) {
+                       _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
+                       return;
                }
-
-               _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
-               return;
        }
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
        if (reason & REASON_TM) {
@@ -1561,16 +1549,44 @@ static void do_program_check(struct pt_regs *regs)
 
        /*
         * If we took the program check in the kernel skip down to sending a
-        * SIGILL. The subsequent cases all relate to emulating instructions
-        * which we should only do for userspace. We also do not want to enable
-        * interrupts for kernel faults because that might lead to further
-        * faults, and loose the context of the original exception.
+        * SIGILL. The subsequent cases all relate to user space, such as
+        * emulating instructions which we should only do for user space. We
+        * also do not want to enable interrupts for kernel faults because that
+        * might lead to further faults, and loose the context of the original
+        * exception.
         */
        if (!user_mode(regs))
                goto sigill;
 
        interrupt_cond_local_irq_enable(regs);
 
+       /*
+        * (reason & REASON_TRAP) is mostly handled before enabling IRQs,
+        * except get_user_instr() can sleep so we cannot reliably inspect the
+        * current instruction in that context. Now that we know we are
+        * handling a user space trap and can sleep, we can check if the trap
+        * was a hashchk failure.
+        */
+       if (reason & REASON_TRAP) {
+               if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE)) {
+                       ppc_inst_t insn;
+
+                       if (get_user_instr(insn, (void __user *)regs->nip)) {
+                               _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
+                               return;
+                       }
+
+                       if (ppc_inst_primary_opcode(insn) == 31 &&
+                           get_xop(ppc_inst_val(insn)) == OP_31_XOP_HASHCHK) {
+                               _exception(SIGILL, regs, ILL_ILLOPN, regs->nip);
+                               return;
+                       }
+               }
+
+               _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
+               return;
+       }
+
        /* (reason & REASON_ILLEGAL) would be the obvious thing here,
         * but there seems to be a hardware bug on the 405GP (RevD)
         * that means ESR is sometimes set incorrectly - either to
index 317175791d23c34912bf7b7d9ac8a40e30648e41..3449be7c0d51f7e9e62112523a0f182891f4bf8d 100644 (file)
@@ -1418,7 +1418,7 @@ static int h_24x7_event_init(struct perf_event *event)
        }
 
        domain = event_get_domain(event);
-       if (domain >= HV_PERF_DOMAIN_MAX) {
+       if (domain  == 0 || domain >= HV_PERF_DOMAIN_MAX) {
                pr_devel("invalid domain %d\n", domain);
                return -EINVAL;
        }
index d9f1a2a83158aa47b6763e6fe7180617096ac73f..1824536cf6f21f80d6ececef62697be5ed3396de 100644 (file)
@@ -2,6 +2,7 @@
 menuconfig PPC_82xx
        bool "82xx-based boards (PQ II)"
        depends on PPC_BOOK3S_32
+       select FSL_SOC
 
 if PPC_82xx
 
@@ -9,7 +10,6 @@ config EP8248E
        bool "Embedded Planet EP8248E (a.k.a. CWH-PPC-8248N-VE)"
        select CPM2
        select PPC_INDIRECT_PCI if PCI
-       select FSL_SOC
        select PHYLIB if NETDEVICES
        select MDIO_BITBANG if PHYLIB
        help
@@ -22,7 +22,6 @@ config MGCOGE
        bool "Keymile MGCOGE"
        select CPM2
        select PPC_INDIRECT_PCI if PCI
-       select FSL_SOC
        help
          This enables support for the Keymile MGCOGE board.
 
index e2ecd01bfac771bc91a34949167906d744891c72..b55b434f0059108342229b1e2013e351a7b81961 100644 (file)
@@ -105,7 +105,7 @@ asm volatile(ALTERNATIVE(                                           \
  * | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
  *   0000001    01001      rs1       000      00000  0001011
  * dcache.cva rs1 (clean, virtual address)
- *   0000001    00100      rs1       000      00000  0001011
+ *   0000001    00101      rs1       000      00000  0001011
  *
  * dcache.cipa rs1 (clean then invalidate, physical address)
  * | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
@@ -118,7 +118,7 @@ asm volatile(ALTERNATIVE(                                           \
  *   0000000    11001     00000      000      00000  0001011
  */
 #define THEAD_inval_A0 ".long 0x0265000b"
-#define THEAD_clean_A0 ".long 0x0245000b"
+#define THEAD_clean_A0 ".long 0x0255000b"
 #define THEAD_flush_A0 ".long 0x0275000b"
 #define THEAD_SYNC_S   ".long 0x0190000b"
 
index f4099059ed8f2507913ecfbb3713249feda33373..e60fbd8660c4a531c6deef3938c45afe2e158839 100644 (file)
@@ -98,7 +98,13 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
        kbuf.image = image;
        kbuf.buf_min = lowest_paddr;
        kbuf.buf_max = ULONG_MAX;
-       kbuf.buf_align = PAGE_SIZE;
+
+       /*
+        * Current riscv boot protocol requires 2MB alignment for
+        * RV64 and 4MB alignment for RV32
+        *
+        */
+       kbuf.buf_align = PMD_SIZE;
        kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
        kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
        kbuf.top_down = false;
index 982b777eadc7a16cc4b4b52f300b9c816f0cfd2f..66bfabae8814919c61902da3cdc77a45d9efa775 100644 (file)
@@ -1945,6 +1945,7 @@ config EFI
        select UCS2_STRING
        select EFI_RUNTIME_WRAPPERS
        select ARCH_USE_MEMREMAP_PROT
+       select EFI_RUNTIME_MAP if KEXEC_CORE
        help
          This enables the kernel to use EFI runtime services that are
          available (such as the EFI variable services).
@@ -2020,7 +2021,6 @@ config EFI_MAX_FAKE_MEM
 config EFI_RUNTIME_MAP
        bool "Export EFI runtime maps to sysfs" if EXPERT
        depends on EFI
-       default KEXEC_CORE
        help
          Export EFI runtime memory regions to /sys/firmware/efi/runtime-map.
          That memory map is required by the 2nd kernel to set up EFI virtual
index bcc956c17872bbd3939b33c59889d39cfb3641ac..08f93b0401bbd3498b0754e20780e2d585e064f1 100644 (file)
@@ -59,6 +59,14 @@ static void *alloc_pgt_page(void *context)
                return NULL;
        }
 
+       /* Consumed more tables than expected? */
+       if (pages->pgt_buf_offset == BOOT_PGT_SIZE_WARN) {
+               debug_putstr("pgt_buf running low in " __FILE__ "\n");
+               debug_putstr("Need to raise BOOT_PGT_SIZE?\n");
+               debug_putaddr(pages->pgt_buf_offset);
+               debug_putaddr(pages->pgt_buf_size);
+       }
+
        entry = pages->pgt_buf + pages->pgt_buf_offset;
        pages->pgt_buf_offset += PAGE_SIZE;
 
index 6c2826417b3376cb70d53df8006f5998a0e33d9c..93c60c0c9d4a7a25d91aef2d948d648e08006abe 100644 (file)
@@ -294,7 +294,7 @@ static void __xen_pv_evtchn_do_upcall(struct pt_regs *regs)
 
        inc_irq_stat(irq_hv_callback_count);
 
-       xen_hvm_evtchn_do_upcall();
+       xen_evtchn_do_upcall();
 
        set_irq_regs(old_regs);
 }
index 4ae14339cb8cc72da4df2442a363ca2f728573c6..b3a7cfb0d99e01a8f54fa540983ca9a4b4010f50 100644 (file)
 #ifdef CONFIG_X86_64
 # define BOOT_STACK_SIZE       0x4000
 
+/*
+ * Used by decompressor's startup_32() to allocate page tables for identity
+ * mapping of the 4G of RAM in 4-level paging mode:
+ * - 1 level4 table;
+ * - 1 level3 table;
+ * - 4 level2 table that maps everything with 2M pages;
+ *
+ * The additional level5 table needed for 5-level paging is allocated from
+ * trampoline_32bit memory.
+ */
 # define BOOT_INIT_PGT_SIZE    (6*4096)
-# ifdef CONFIG_RANDOMIZE_BASE
+
 /*
- * Assuming all cross the 512GB boundary:
- * 1 page for level4
- * (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel
- * 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP).
- * Total is 19 pages.
+ * Total number of page tables kernel_add_identity_map() can allocate,
+ * including page tables consumed by startup_32().
+ *
+ * Worst-case scenario:
+ *  - 5-level paging needs 1 level5 table;
+ *  - KASLR needs to map kernel, boot_params, cmdline and randomized kernel,
+ *    assuming all of them cross 256T boundary:
+ *    + 4*2 level4 table;
+ *    + 4*2 level3 table;
+ *    + 4*2 level2 table;
+ *  - X86_VERBOSE_BOOTUP needs to map the first 2M (video RAM):
+ *    + 1 level4 table;
+ *    + 1 level3 table;
+ *    + 1 level2 table;
+ * Total: 28 tables
+ *
+ * Add 4 spare table in case decompressor touches anything beyond what is
+ * accounted above. Warn if it happens.
  */
-#  ifdef CONFIG_X86_VERBOSE_BOOTUP
-#   define BOOT_PGT_SIZE       (19*4096)
-#  else /* !CONFIG_X86_VERBOSE_BOOTUP */
-#   define BOOT_PGT_SIZE       (17*4096)
-#  endif
-# else /* !CONFIG_RANDOMIZE_BASE */
-#  define BOOT_PGT_SIZE                BOOT_INIT_PGT_SIZE
-# endif
+# define BOOT_PGT_SIZE_WARN    (28*4096)
+# define BOOT_PGT_SIZE         (32*4096)
 
 #else /* !CONFIG_X86_64 */
 # define BOOT_STACK_SIZE       0x1000
index b0994ae3bc23f84df03331b9ffc36b3e1c9d62f9..c4555b269a1b247430f50dcf5934855823e1eba6 100644 (file)
@@ -91,19 +91,6 @@ static inline void efi_fpu_end(void)
 
 #ifdef CONFIG_X86_32
 #define EFI_X86_KERNEL_ALLOC_LIMIT             (SZ_512M - 1)
-
-#define arch_efi_call_virt_setup()                                     \
-({                                                                     \
-       efi_fpu_begin();                                                \
-       firmware_restrict_branch_speculation_start();                   \
-})
-
-#define arch_efi_call_virt_teardown()                                  \
-({                                                                     \
-       firmware_restrict_branch_speculation_end();                     \
-       efi_fpu_end();                                                  \
-})
-
 #else /* !CONFIG_X86_32 */
 #define EFI_X86_KERNEL_ALLOC_LIMIT             EFI_ALLOC_LIMIT
 
@@ -116,14 +103,6 @@ extern bool efi_disable_ibt_for_runtime;
        __efi_call(__VA_ARGS__);                                        \
 })
 
-#define arch_efi_call_virt_setup()                                     \
-({                                                                     \
-       efi_sync_low_kernel_mappings();                                 \
-       efi_fpu_begin();                                                \
-       firmware_restrict_branch_speculation_start();                   \
-       efi_enter_mm();                                                 \
-})
-
 #undef arch_efi_call_virt
 #define arch_efi_call_virt(p, f, args...) ({                           \
        u64 ret, ibt = ibt_save(efi_disable_ibt_for_runtime);           \
@@ -132,13 +111,6 @@ extern bool efi_disable_ibt_for_runtime;
        ret;                                                            \
 })
 
-#define arch_efi_call_virt_teardown()                                  \
-({                                                                     \
-       efi_leave_mm();                                                 \
-       firmware_restrict_branch_speculation_end();                     \
-       efi_fpu_end();                                                  \
-})
-
 #ifdef CONFIG_KASAN
 /*
  * CONFIG_KASAN may redefine memset to __memset.  __memset function is present
@@ -168,8 +140,8 @@ extern void efi_delete_dummy_variable(void);
 extern void efi_crash_gracefully_on_page_fault(unsigned long phys_addr);
 extern void efi_free_boot_services(void);
 
-void efi_enter_mm(void);
-void efi_leave_mm(void);
+void arch_efi_call_virt_setup(void);
+void arch_efi_call_virt_teardown(void);
 
 /* kexec external ABI */
 struct efi_setup_data {
index 97a3de7892d3ff376c3058d759141b07630c0760..5ff49fd67732e9d9ffbb4152e4a0bbd984e32f99 100644 (file)
@@ -8,6 +8,14 @@
 #undef notrace
 #define notrace __attribute__((no_instrument_function))
 
+#ifdef CONFIG_64BIT
+/*
+ * The generic version tends to create spurious ENDBR instructions under
+ * certain conditions.
+ */
+#define _THIS_IP_ ({ unsigned long __here; asm ("lea 0(%%rip), %0" : "=r" (__here)); __here; })
+#endif
+
 #ifdef CONFIG_X86_32
 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
 #endif /* CONFIG_X86_32 */
index 4acbcddddc29f21fc9f21117b653c842430d943c..772d03487520e595ba458ae9032f8a0a2dc00101 100644 (file)
@@ -9,13 +9,6 @@ struct paravirt_patch_site {
        u8 type;                /* type of this instruction */
        u8 len;                 /* length of original instruction */
 };
-
-/* Lazy mode for batching updates / context switch */
-enum paravirt_lazy_mode {
-       PARAVIRT_LAZY_NONE,
-       PARAVIRT_LAZY_MMU,
-       PARAVIRT_LAZY_CPU,
-};
 #endif
 
 #ifdef CONFIG_PARAVIRT
@@ -549,14 +542,6 @@ int paravirt_disable_iospace(void);
        __PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2),    \
                     PVOP_CALL_ARG3(arg3), PVOP_CALL_ARG4(arg4))
 
-enum paravirt_lazy_mode paravirt_get_lazy_mode(void);
-void paravirt_start_context_switch(struct task_struct *prev);
-void paravirt_end_context_switch(struct task_struct *next);
-
-void paravirt_enter_lazy_mmu(void);
-void paravirt_leave_lazy_mmu(void);
-void paravirt_flush_lazy_mmu(void);
-
 void _paravirt_nop(void);
 void paravirt_BUG(void);
 unsigned long paravirt_ret0(void);
index 5fc35f889cd1a29d86f245da3c7e1f993f3cdf4d..7048dfacc04b2413acba1054fb4412c7048b8249 100644 (file)
@@ -36,6 +36,7 @@
 extern struct shared_info *HYPERVISOR_shared_info;
 extern struct start_info *xen_start_info;
 
+#include <asm/bug.h>
 #include <asm/processor.h>
 
 #define XEN_SIGNATURE "XenVMMXenVMM"
@@ -63,4 +64,40 @@ void __init xen_pvh_init(struct boot_params *boot_params);
 void __init mem_map_via_hcall(struct boot_params *boot_params_p);
 #endif
 
+/* Lazy mode for batching updates / context switch */
+enum xen_lazy_mode {
+       XEN_LAZY_NONE,
+       XEN_LAZY_MMU,
+       XEN_LAZY_CPU,
+};
+
+DECLARE_PER_CPU(enum xen_lazy_mode, xen_lazy_mode);
+DECLARE_PER_CPU(unsigned int, xen_lazy_nesting);
+
+static inline void enter_lazy(enum xen_lazy_mode mode)
+{
+       enum xen_lazy_mode old_mode = this_cpu_read(xen_lazy_mode);
+
+       if (mode == old_mode) {
+               this_cpu_inc(xen_lazy_nesting);
+               return;
+       }
+
+       BUG_ON(old_mode != XEN_LAZY_NONE);
+
+       this_cpu_write(xen_lazy_mode, mode);
+}
+
+static inline void leave_lazy(enum xen_lazy_mode mode)
+{
+       BUG_ON(this_cpu_read(xen_lazy_mode) != mode);
+
+       if (this_cpu_read(xen_lazy_nesting) == 0)
+               this_cpu_write(xen_lazy_mode, XEN_LAZY_NONE);
+       else
+               this_cpu_dec(xen_lazy_nesting);
+}
+
+enum xen_lazy_mode xen_get_lazy_mode(void);
+
 #endif /* _ASM_X86_XEN_HYPERVISOR_H */
index d9f5d7492f8371df1004159297a4b4ad48c78e63..205cee5676298fb6b04c592e02d9a7585a9a6072 100644 (file)
@@ -1533,7 +1533,7 @@ static void __init build_socket_tables(void)
 {
        struct uv_gam_range_entry *gre = uv_gre_table;
        int nums, numn, nump;
-       int cpu, i, lnid;
+       int i, lnid, apicid;
        int minsock = _min_socket;
        int maxsock = _max_socket;
        int minpnode = _min_pnode;
@@ -1584,15 +1584,14 @@ static void __init build_socket_tables(void)
 
        /* Set socket -> node values: */
        lnid = NUMA_NO_NODE;
-       for_each_possible_cpu(cpu) {
-               int nid = cpu_to_node(cpu);
-               int apicid, sockid;
+       for (apicid = 0; apicid < ARRAY_SIZE(__apicid_to_node); apicid++) {
+               int nid = __apicid_to_node[apicid];
+               int sockid;
 
-               if (lnid == nid)
+               if ((nid == NUMA_NO_NODE) || (lnid == nid))
                        continue;
                lnid = nid;
 
-               apicid = per_cpu(x86_cpu_to_apicid, cpu);
                sockid = apicid >> uv_cpuid.socketid_shift;
 
                if (_socket_to_node[sockid - minsock] == SOCK_EMPTY)
index 975f98d5eee5dcf46d0b40d63199eb21c5c39c7a..97f1436c1a20348a567ea439aeaa41881448d625 100644 (file)
@@ -143,66 +143,7 @@ int paravirt_disable_iospace(void)
        return request_resource(&ioport_resource, &reserve_ioports);
 }
 
-static DEFINE_PER_CPU(enum paravirt_lazy_mode, paravirt_lazy_mode) = PARAVIRT_LAZY_NONE;
-
-static inline void enter_lazy(enum paravirt_lazy_mode mode)
-{
-       BUG_ON(this_cpu_read(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
-
-       this_cpu_write(paravirt_lazy_mode, mode);
-}
-
-static void leave_lazy(enum paravirt_lazy_mode mode)
-{
-       BUG_ON(this_cpu_read(paravirt_lazy_mode) != mode);
-
-       this_cpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE);
-}
-
-void paravirt_enter_lazy_mmu(void)
-{
-       enter_lazy(PARAVIRT_LAZY_MMU);
-}
-
-void paravirt_leave_lazy_mmu(void)
-{
-       leave_lazy(PARAVIRT_LAZY_MMU);
-}
-
-void paravirt_flush_lazy_mmu(void)
-{
-       preempt_disable();
-
-       if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
-               arch_leave_lazy_mmu_mode();
-               arch_enter_lazy_mmu_mode();
-       }
-
-       preempt_enable();
-}
-
 #ifdef CONFIG_PARAVIRT_XXL
-void paravirt_start_context_switch(struct task_struct *prev)
-{
-       BUG_ON(preemptible());
-
-       if (this_cpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
-               arch_leave_lazy_mmu_mode();
-               set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
-       }
-       enter_lazy(PARAVIRT_LAZY_CPU);
-}
-
-void paravirt_end_context_switch(struct task_struct *next)
-{
-       BUG_ON(preemptible());
-
-       leave_lazy(PARAVIRT_LAZY_CPU);
-
-       if (test_and_clear_ti_thread_flag(task_thread_info(next), TIF_LAZY_MMU_UPDATES))
-               arch_enter_lazy_mmu_mode();
-}
-
 static noinstr void pv_native_write_cr2(unsigned long val)
 {
        native_write_cr2(val);
@@ -229,14 +170,6 @@ static noinstr void pv_native_safe_halt(void)
 }
 #endif
 
-enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
-{
-       if (in_interrupt())
-               return PARAVIRT_LAZY_NONE;
-
-       return this_cpu_read(paravirt_lazy_mode);
-}
-
 struct pv_info pv_info = {
        .name = "bare hardware",
 #ifdef CONFIG_PARAVIRT_XXL
index 4e45ff44aa07db38e6d765605e6f12b80fe3f08d..48e0406187314f1342f6dcffa4552edf9f0291ec 100644 (file)
@@ -579,7 +579,6 @@ static bool match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
 }
 
 
-#if defined(CONFIG_SCHED_SMT) || defined(CONFIG_SCHED_CLUSTER) || defined(CONFIG_SCHED_MC)
 static inline int x86_sched_itmt_flags(void)
 {
        return sysctl_sched_itmt_enabled ? SD_ASYM_PACKING : 0;
@@ -603,7 +602,14 @@ static int x86_cluster_flags(void)
        return cpu_cluster_flags() | x86_sched_itmt_flags();
 }
 #endif
-#endif
+
+static int x86_die_flags(void)
+{
+       if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
+              return x86_sched_itmt_flags();
+
+       return 0;
+}
 
 /*
  * Set if a package/die has multiple NUMA nodes inside.
@@ -640,7 +646,7 @@ static void __init build_sched_topology(void)
         */
        if (!x86_has_numa_in_package) {
                x86_topology[i++] = (struct sched_domain_topology_level){
-                       cpu_cpu_mask, SD_INIT_NAME(DIE)
+                       cpu_cpu_mask, x86_die_flags, SD_INIT_NAME(DIE)
                };
        }
 
index 1451e0c4ae22af2ac0721596755be825d51e32fd..235bbda6fc8230fed1b8f240b569e8951121ad19 100644 (file)
@@ -56,7 +56,6 @@ SYM_FUNC_END(__put_user_1)
 EXPORT_SYMBOL(__put_user_1)
 
 SYM_FUNC_START(__put_user_nocheck_1)
-       ENDBR
        ASM_STAC
 2:     movb %al,(%_ASM_CX)
        xor %ecx,%ecx
@@ -76,7 +75,6 @@ SYM_FUNC_END(__put_user_2)
 EXPORT_SYMBOL(__put_user_2)
 
 SYM_FUNC_START(__put_user_nocheck_2)
-       ENDBR
        ASM_STAC
 4:     movw %ax,(%_ASM_CX)
        xor %ecx,%ecx
@@ -96,7 +94,6 @@ SYM_FUNC_END(__put_user_4)
 EXPORT_SYMBOL(__put_user_4)
 
 SYM_FUNC_START(__put_user_nocheck_4)
-       ENDBR
        ASM_STAC
 6:     movl %eax,(%_ASM_CX)
        xor %ecx,%ecx
@@ -119,7 +116,6 @@ SYM_FUNC_END(__put_user_8)
 EXPORT_SYMBOL(__put_user_8)
 
 SYM_FUNC_START(__put_user_nocheck_8)
-       ENDBR
        ASM_STAC
 9:     mov %_ASM_AX,(%_ASM_CX)
 #ifdef CONFIG_X86_32
index e06a199423c0fedd79cb9a4cc4173655ecf3956c..b2cc7b4552a16630164b6af8e574eee448933ca5 100644 (file)
@@ -140,3 +140,15 @@ void __init efi_runtime_update_mappings(void)
                }
        }
 }
+
+void arch_efi_call_virt_setup(void)
+{
+       efi_fpu_begin();
+       firmware_restrict_branch_speculation_start();
+}
+
+void arch_efi_call_virt_teardown(void)
+{
+       firmware_restrict_branch_speculation_end();
+       efi_fpu_end();
+}
index 77f7ac3668cb4ac0c97d01a7dce648e01be15fbb..91d31ac422d6cde7ab5434bcd02176cbcd6b07ff 100644 (file)
@@ -474,19 +474,34 @@ void __init efi_dump_pagetable(void)
  * can not change under us.
  * It should be ensured that there are no concurrent calls to this function.
  */
-void efi_enter_mm(void)
+static void efi_enter_mm(void)
 {
        efi_prev_mm = current->active_mm;
        current->active_mm = &efi_mm;
        switch_mm(efi_prev_mm, &efi_mm, NULL);
 }
 
-void efi_leave_mm(void)
+static void efi_leave_mm(void)
 {
        current->active_mm = efi_prev_mm;
        switch_mm(&efi_mm, efi_prev_mm, NULL);
 }
 
+void arch_efi_call_virt_setup(void)
+{
+       efi_sync_low_kernel_mappings();
+       efi_fpu_begin();
+       firmware_restrict_branch_speculation_start();
+       efi_enter_mm();
+}
+
+void arch_efi_call_virt_teardown(void)
+{
+       efi_leave_mm();
+       firmware_restrict_branch_speculation_end();
+       efi_fpu_end();
+}
+
 static DEFINE_SPINLOCK(efi_runtime_lock);
 
 /*
index c2a29be35c01bb306efbd01daabb618636f6d880..08aa0f25f12a0fb92b7f9002740c50a1c0f2ad9d 100644 (file)
@@ -19,6 +19,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
 # optimization flags.
 KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS))
 
+# When LTO is enabled, llvm emits many text sections, which is not supported
+# by kexec. Remove -flto=* flags.
+KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS))
+
 # When linking purgatory.ro with -r unresolved symbols are not checked,
 # also link a purgatory.chk binary without -r to check for unresolved symbols.
 PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
index 863d0d6b3edc47e06346c378356b412ba2358707..7250d0e0e1a98cf8490e4b83e0ac13d44979772a 100644 (file)
@@ -138,7 +138,7 @@ void __init xen_efi_init(struct boot_params *boot_params)
        if (efi_systab_xen == NULL)
                return;
 
-       strncpy((char *)&boot_params->efi_info.efi_loader_signature, "Xen",
+       strscpy((char *)&boot_params->efi_info.efi_loader_signature, "Xen",
                        sizeof(boot_params->efi_info.efi_loader_signature));
        boot_params->efi_info.efi_systab = (__u32)__pa(efi_systab_xen);
        boot_params->efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 32);
index b8db2148c07d525a543ecdd1ed4be5da236fc81c..0337392a3121412f8afe2946f48ff03646f780fa 100644 (file)
@@ -32,7 +32,7 @@ EXPORT_SYMBOL_GPL(hypercall_page);
  * &HYPERVISOR_shared_info->vcpu_info[cpu]. See xen_hvm_init_shared_info
  * and xen_vcpu_setup for details. By default it points to share_info->vcpu_info
  * but during boot it is switched to point to xen_vcpu_info.
- * The pointer is used in __xen_evtchn_do_upcall to acknowledge pending events.
+ * The pointer is used in xen_evtchn_do_upcall to acknowledge pending events.
  */
 DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
 DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
index 9a192f51f1b0216dd4e0f8cb101d49f58326fbeb..3f8c34707c50014d9364f0430728446e35059d8f 100644 (file)
@@ -136,7 +136,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_xen_hvm_callback)
 
        inc_irq_stat(irq_hv_callback_count);
 
-       xen_hvm_evtchn_do_upcall();
+       xen_evtchn_do_upcall();
 
        set_irq_regs(old_regs);
 }
index 49352fad7d1de671094c98630426be11cd12e8d3..bbbfdd495ebd3ac590fd152e0504c6bedae611de 100644 (file)
@@ -101,6 +101,17 @@ struct tls_descs {
        struct desc_struct desc[3];
 };
 
+DEFINE_PER_CPU(enum xen_lazy_mode, xen_lazy_mode) = XEN_LAZY_NONE;
+DEFINE_PER_CPU(unsigned int, xen_lazy_nesting);
+
+enum xen_lazy_mode xen_get_lazy_mode(void)
+{
+       if (in_interrupt())
+               return XEN_LAZY_NONE;
+
+       return this_cpu_read(xen_lazy_mode);
+}
+
 /*
  * Updating the 3 TLS descriptors in the GDT on every task switch is
  * surprisingly expensive so we avoid updating them if they haven't
@@ -362,10 +373,25 @@ static noinstr unsigned long xen_get_debugreg(int reg)
        return HYPERVISOR_get_debugreg(reg);
 }
 
+static void xen_start_context_switch(struct task_struct *prev)
+{
+       BUG_ON(preemptible());
+
+       if (this_cpu_read(xen_lazy_mode) == XEN_LAZY_MMU) {
+               arch_leave_lazy_mmu_mode();
+               set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
+       }
+       enter_lazy(XEN_LAZY_CPU);
+}
+
 static void xen_end_context_switch(struct task_struct *next)
 {
+       BUG_ON(preemptible());
+
        xen_mc_flush();
-       paravirt_end_context_switch(next);
+       leave_lazy(XEN_LAZY_CPU);
+       if (test_and_clear_ti_thread_flag(task_thread_info(next), TIF_LAZY_MMU_UPDATES))
+               arch_enter_lazy_mmu_mode();
 }
 
 static unsigned long xen_store_tr(void)
@@ -472,7 +498,7 @@ static void xen_set_ldt(const void *addr, unsigned entries)
 
        MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
 
-       xen_mc_issue(PARAVIRT_LAZY_CPU);
+       xen_mc_issue(XEN_LAZY_CPU);
 }
 
 static void xen_load_gdt(const struct desc_ptr *dtr)
@@ -568,7 +594,7 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
         * exception between the new %fs descriptor being loaded and
         * %fs being effectively cleared at __switch_to().
         */
-       if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)
+       if (xen_get_lazy_mode() == XEN_LAZY_CPU)
                loadsegment(fs, 0);
 
        xen_mc_batch();
@@ -577,7 +603,7 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
        load_TLS_descriptor(t, cpu, 1);
        load_TLS_descriptor(t, cpu, 2);
 
-       xen_mc_issue(PARAVIRT_LAZY_CPU);
+       xen_mc_issue(XEN_LAZY_CPU);
 }
 
 static void xen_load_gs_index(unsigned int idx)
@@ -909,7 +935,7 @@ static void xen_load_sp0(unsigned long sp0)
 
        mcs = xen_mc_entry(0);
        MULTI_stack_switch(mcs.mc, __KERNEL_DS, sp0);
-       xen_mc_issue(PARAVIRT_LAZY_CPU);
+       xen_mc_issue(XEN_LAZY_CPU);
        this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0);
 }
 
@@ -973,7 +999,7 @@ static void xen_write_cr0(unsigned long cr0)
 
        MULTI_fpu_taskswitch(mcs.mc, (cr0 & X86_CR0_TS) != 0);
 
-       xen_mc_issue(PARAVIRT_LAZY_CPU);
+       xen_mc_issue(XEN_LAZY_CPU);
 }
 
 static void xen_write_cr4(unsigned long cr4)
@@ -1156,7 +1182,7 @@ static const typeof(pv_ops) xen_cpu_ops __initconst = {
 #endif
                .io_delay = xen_io_delay,
 
-               .start_context_switch = paravirt_start_context_switch,
+               .start_context_switch = xen_start_context_switch,
                .end_context_switch = xen_end_context_switch,
        },
 };
index 1652c39e3dfbd309278f887233c026736a96b9a2..b6830554ff6905633fc543fb39e1b5b4a024bb07 100644 (file)
@@ -236,7 +236,7 @@ static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
        u.val = pmd_val_ma(val);
        xen_extend_mmu_update(&u);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 
        preempt_enable();
 }
@@ -270,7 +270,7 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval)
 {
        struct mmu_update u;
 
-       if (paravirt_get_lazy_mode() != PARAVIRT_LAZY_MMU)
+       if (xen_get_lazy_mode() != XEN_LAZY_MMU)
                return false;
 
        xen_mc_batch();
@@ -279,7 +279,7 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval)
        u.val = pte_val_ma(pteval);
        xen_extend_mmu_update(&u);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 
        return true;
 }
@@ -325,7 +325,7 @@ void xen_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
        u.val = pte_val_ma(pte);
        xen_extend_mmu_update(&u);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 }
 
 /* Assume pteval_t is equivalent to all the other *val_t types. */
@@ -419,7 +419,7 @@ static void xen_set_pud_hyper(pud_t *ptr, pud_t val)
        u.val = pud_val_ma(val);
        xen_extend_mmu_update(&u);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 
        preempt_enable();
 }
@@ -499,7 +499,7 @@ static void __init xen_set_p4d_hyper(p4d_t *ptr, p4d_t val)
 
        __xen_set_p4d_hyper(ptr, val);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 
        preempt_enable();
 }
@@ -531,7 +531,7 @@ static void xen_set_p4d(p4d_t *ptr, p4d_t val)
        if (user_ptr)
                __xen_set_p4d_hyper((p4d_t *)user_ptr, val);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 }
 
 #if CONFIG_PGTABLE_LEVELS >= 5
@@ -1245,7 +1245,7 @@ static noinline void xen_flush_tlb(void)
        op->cmd = MMUEXT_TLB_FLUSH_LOCAL;
        MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 
        preempt_enable();
 }
@@ -1265,7 +1265,7 @@ static void xen_flush_tlb_one_user(unsigned long addr)
        op->arg1.linear_addr = addr & PAGE_MASK;
        MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 
        preempt_enable();
 }
@@ -1302,7 +1302,7 @@ static void xen_flush_tlb_multi(const struct cpumask *cpus,
 
        MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 }
 
 static unsigned long xen_read_cr3(void)
@@ -1361,7 +1361,7 @@ static void xen_write_cr3(unsigned long cr3)
        else
                __xen_write_cr3(false, 0);
 
-       xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
+       xen_mc_issue(XEN_LAZY_CPU);  /* interrupts restored */
 }
 
 /*
@@ -1396,7 +1396,7 @@ static void __init xen_write_cr3_init(unsigned long cr3)
 
        __xen_write_cr3(true, cr3);
 
-       xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
+       xen_mc_issue(XEN_LAZY_CPU);  /* interrupts restored */
 }
 
 static int xen_pgd_alloc(struct mm_struct *mm)
@@ -1557,7 +1557,7 @@ static inline void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn,
                if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS && !pinned)
                        __pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
 
-               xen_mc_issue(PARAVIRT_LAZY_MMU);
+               xen_mc_issue(XEN_LAZY_MMU);
        }
 }
 
@@ -1587,7 +1587,7 @@ static inline void xen_release_ptpage(unsigned long pfn, unsigned level)
 
                __set_pfn_prot(pfn, PAGE_KERNEL);
 
-               xen_mc_issue(PARAVIRT_LAZY_MMU);
+               xen_mc_issue(XEN_LAZY_MMU);
 
                ClearPagePinned(page);
        }
@@ -1804,7 +1804,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
         */
        xen_mc_batch();
        __xen_write_cr3(true, __pa(init_top_pgt));
-       xen_mc_issue(PARAVIRT_LAZY_CPU);
+       xen_mc_issue(XEN_LAZY_CPU);
 
        /* We can't that easily rip out L3 and L2, as the Xen pagetables are
         * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ...  for
@@ -2083,6 +2083,23 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
 #endif
 }
 
+static void xen_enter_lazy_mmu(void)
+{
+       enter_lazy(XEN_LAZY_MMU);
+}
+
+static void xen_flush_lazy_mmu(void)
+{
+       preempt_disable();
+
+       if (xen_get_lazy_mode() == XEN_LAZY_MMU) {
+               arch_leave_lazy_mmu_mode();
+               arch_enter_lazy_mmu_mode();
+       }
+
+       preempt_enable();
+}
+
 static void __init xen_post_allocator_init(void)
 {
        pv_ops.mmu.set_pte = xen_set_pte;
@@ -2107,7 +2124,7 @@ static void xen_leave_lazy_mmu(void)
 {
        preempt_disable();
        xen_mc_flush();
-       paravirt_leave_lazy_mmu();
+       leave_lazy(XEN_LAZY_MMU);
        preempt_enable();
 }
 
@@ -2166,9 +2183,9 @@ static const typeof(pv_ops) xen_mmu_ops __initconst = {
                .exit_mmap = xen_exit_mmap,
 
                .lazy_mode = {
-                       .enter = paravirt_enter_lazy_mmu,
+                       .enter = xen_enter_lazy_mmu,
                        .leave = xen_leave_lazy_mmu,
-                       .flush = paravirt_flush_lazy_mmu,
+                       .flush = xen_flush_lazy_mmu,
                },
 
                .set_fixmap = xen_set_fixmap,
@@ -2385,7 +2402,7 @@ static noinline void xen_flush_tlb_all(void)
        op->cmd = MMUEXT_TLB_FLUSH_ALL;
        MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
 
-       xen_mc_issue(PARAVIRT_LAZY_MMU);
+       xen_mc_issue(XEN_LAZY_MMU);
 
        preempt_enable();
 }
index 1c51b2c87f30a12dfb8d022c54de1f88046234ef..c3867b585e0d8d56419c5a6641f5c2eeb3a30a16 100644 (file)
@@ -26,7 +26,7 @@ static inline void xen_mc_batch(void)
 
        /* need to disable interrupts until this entry is complete */
        local_irq_save(flags);
-       trace_xen_mc_batch(paravirt_get_lazy_mode());
+       trace_xen_mc_batch(xen_get_lazy_mode());
        __this_cpu_write(xen_mc_irq_flags, flags);
 }
 
@@ -44,7 +44,7 @@ static inline void xen_mc_issue(unsigned mode)
 {
        trace_xen_mc_issue(mode);
 
-       if ((paravirt_get_lazy_mode() & mode) == 0)
+       if ((xen_get_lazy_mode() & mode) == 0)
                xen_mc_flush();
 
        /* restore flags saved in xen_mc_batch */
index ec922c6bccbe20737d21e03a4d4964c8dab1d66f..1fafd54dce3cb9e9f51fb3a4cb0cb6e907a1c066 100644 (file)
@@ -4405,11 +4405,8 @@ static int blk_mq_realloc_tag_set_tags(struct blk_mq_tag_set *set,
        struct blk_mq_tags **new_tags;
        int i;
 
-       if (set->nr_hw_queues >= new_nr_hw_queues) {
-               for (i = new_nr_hw_queues; i < set->nr_hw_queues; i++)
-                       __blk_mq_free_map_and_rqs(set, i);
+       if (set->nr_hw_queues >= new_nr_hw_queues)
                goto done;
-       }
 
        new_tags = kcalloc_node(new_nr_hw_queues, sizeof(struct blk_mq_tags *),
                                GFP_KERNEL, set->numa_node);
@@ -4719,7 +4716,8 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set,
 {
        struct request_queue *q;
        LIST_HEAD(head);
-       int prev_nr_hw_queues;
+       int prev_nr_hw_queues = set->nr_hw_queues;
+       int i;
 
        lockdep_assert_held(&set->tag_list_lock);
 
@@ -4746,7 +4744,6 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set,
                blk_mq_sysfs_unregister_hctxs(q);
        }
 
-       prev_nr_hw_queues = set->nr_hw_queues;
        if (blk_mq_realloc_tag_set_tags(set, nr_hw_queues) < 0)
                goto reregister;
 
@@ -4781,6 +4778,10 @@ switch_back:
 
        list_for_each_entry(q, &set->tag_list, tag_set_list)
                blk_mq_unfreeze_queue(q);
+
+       /* Free the excess tags when nr_hw_queues shrink. */
+       for (i = set->nr_hw_queues; i < prev_nr_hw_queues; i++)
+               __blk_mq_free_map_and_rqs(set, i);
 }
 
 void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues)
index f14e68266ccd473db98bef2bcfe118bfae47afc5..312730f8272eeca4edc6d6695469b25497e57e15 100644 (file)
@@ -492,7 +492,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
 }
 
 static int thermal_get_trend(struct thermal_zone_device *thermal,
-                            struct thermal_trip *trip,
+                            const struct thermal_trip *trip,
                             enum thermal_trend *trend)
 {
        struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
index abb5911c9d09159264436ef0dcc344d1edc72c7e..08745e7db8201fcfd95bb63767b529e2ce337a60 100644 (file)
@@ -1883,6 +1883,15 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        else
                dev_info(&pdev->dev, "SSS flag set, parallel bus scan disabled\n");
 
+       if (!(hpriv->cap & HOST_CAP_PART))
+               host->flags |= ATA_HOST_NO_PART;
+
+       if (!(hpriv->cap & HOST_CAP_SSC))
+               host->flags |= ATA_HOST_NO_SSC;
+
+       if (!(hpriv->cap2 & HOST_CAP2_SDS))
+               host->flags |= ATA_HOST_NO_DEVSLP;
+
        if (pi.flags & ATA_FLAG_EM)
                ahci_reset_em(host);
 
index e2bacedf28ef5be940959628969c64e569f6320d..f1263364fa97fa5f37f878f5a16c376290fb9e18 100644 (file)
@@ -1256,6 +1256,26 @@ static ssize_t ahci_activity_show(struct ata_device *dev, char *buf)
        return sprintf(buf, "%d\n", emp->blink_policy);
 }
 
+static void ahci_port_clear_pending_irq(struct ata_port *ap)
+{
+       struct ahci_host_priv *hpriv = ap->host->private_data;
+       void __iomem *port_mmio = ahci_port_base(ap);
+       u32 tmp;
+
+       /* clear SError */
+       tmp = readl(port_mmio + PORT_SCR_ERR);
+       dev_dbg(ap->host->dev, "PORT_SCR_ERR 0x%x\n", tmp);
+       writel(tmp, port_mmio + PORT_SCR_ERR);
+
+       /* clear port IRQ */
+       tmp = readl(port_mmio + PORT_IRQ_STAT);
+       dev_dbg(ap->host->dev, "PORT_IRQ_STAT 0x%x\n", tmp);
+       if (tmp)
+               writel(tmp, port_mmio + PORT_IRQ_STAT);
+
+       writel(1 << ap->port_no, hpriv->mmio + HOST_IRQ_STAT);
+}
+
 static void ahci_port_init(struct device *dev, struct ata_port *ap,
                           int port_no, void __iomem *mmio,
                           void __iomem *port_mmio)
@@ -1270,18 +1290,7 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,
        if (rc)
                dev_warn(dev, "%s (%d)\n", emsg, rc);
 
-       /* clear SError */
-       tmp = readl(port_mmio + PORT_SCR_ERR);
-       dev_dbg(dev, "PORT_SCR_ERR 0x%x\n", tmp);
-       writel(tmp, port_mmio + PORT_SCR_ERR);
-
-       /* clear port IRQ */
-       tmp = readl(port_mmio + PORT_IRQ_STAT);
-       dev_dbg(dev, "PORT_IRQ_STAT 0x%x\n", tmp);
-       if (tmp)
-               writel(tmp, port_mmio + PORT_IRQ_STAT);
-
-       writel(1 << port_no, mmio + HOST_IRQ_STAT);
+       ahci_port_clear_pending_irq(ap);
 
        /* mark esata ports */
        tmp = readl(port_mmio + PORT_CMD);
@@ -1603,6 +1612,8 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
        tf.status = ATA_BUSY;
        ata_tf_to_fis(&tf, 0, 0, d2h_fis);
 
+       ahci_port_clear_pending_irq(ap);
+
        rc = sata_link_hardreset(link, timing, deadline, online,
                                 ahci_check_ready);
 
index 74314311295fe43d56241fae063bee6cd530267a..0072e0f9ad391195368ae2e9c77e5e7fa4cc0195 100644 (file)
@@ -4783,11 +4783,8 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
         * been aborted by the device due to a limit timeout using the policy
         * 0xD. For these commands, invoke EH to get the command sense data.
         */
-       if (qc->result_tf.status & ATA_SENSE &&
-           ((ata_is_ncq(qc->tf.protocol) &&
-             dev->flags & ATA_DFLAG_CDL_ENABLED) ||
-            (!ata_is_ncq(qc->tf.protocol) &&
-             ata_id_sense_reporting_enabled(dev->id)))) {
+       if (qc->flags & ATA_QCFLAG_HAS_CDL &&
+           qc->result_tf.status & ATA_SENSE) {
                /*
                 * Tell SCSI EH to not overwrite scmd->result even if this
                 * command is finished with result SAM_STAT_GOOD.
index 159ba6ba19ebb7872b87c2bfe03bae8e17023321..4cf4f57e57b8bdf06b5353e01ea4236c45f705e4 100644 (file)
@@ -2796,23 +2796,13 @@ int ata_eh_reset(struct ata_link *link, int classify,
                }
        }
 
-       /*
-        * Some controllers can't be frozen very well and may set spurious
-        * error conditions during reset.  Clear accumulated error
-        * information and re-thaw the port if frozen.  As reset is the
-        * final recovery action and we cross check link onlineness against
-        * device classification later, no hotplug event is lost by this.
-        */
+       /* clear cached SError */
        spin_lock_irqsave(link->ap->lock, flags);
-       memset(&link->eh_info, 0, sizeof(link->eh_info));
+       link->eh_info.serror = 0;
        if (slave)
-               memset(&slave->eh_info, 0, sizeof(link->eh_info));
-       ap->pflags &= ~ATA_PFLAG_EH_PENDING;
+               slave->eh_info.serror = 0;
        spin_unlock_irqrestore(link->ap->lock, flags);
 
-       if (ata_port_is_frozen(ap))
-               ata_eh_thaw_port(ap);
-
        /*
         * Make sure onlineness and classification result correspond.
         * Hotplug could have happened during reset and some
index 5d31c08be0136cc0ff6baeac1d9f6041be48b5fb..a701e1538482f09eb5960a606edad01f34920401 100644 (file)
@@ -396,10 +396,23 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
        case ATA_LPM_MED_POWER_WITH_DIPM:
        case ATA_LPM_MIN_POWER_WITH_PARTIAL:
        case ATA_LPM_MIN_POWER:
-               if (ata_link_nr_enabled(link) > 0)
-                       /* no restrictions on LPM transitions */
+               if (ata_link_nr_enabled(link) > 0) {
+                       /* assume no restrictions on LPM transitions */
                        scontrol &= ~(0x7 << 8);
-               else {
+
+                       /*
+                        * If the controller does not support partial, slumber,
+                        * or devsleep, then disallow these transitions.
+                        */
+                       if (link->ap->host->flags & ATA_HOST_NO_PART)
+                               scontrol |= (0x1 << 8);
+
+                       if (link->ap->host->flags & ATA_HOST_NO_SSC)
+                               scontrol |= (0x2 << 8);
+
+                       if (link->ap->host->flags & ATA_HOST_NO_DEVSLP)
+                               scontrol |= (0x4 << 8);
+               } else {
                        /* empty port, power off */
                        scontrol &= ~0xf;
                        scontrol |= (0x1 << 2);
index 4839becbbd5646f11c187611d0554a726bad515c..94b8d352102e85c0e70a1cedf8c55a15abb2b9cd 100644 (file)
@@ -37,7 +37,7 @@ static int comm_read_regr(struct pi_adapter *pi, int cont, int regr)
 {
        int l, h, r;
 
-        r = regr + cont_map[cont];
+       r = regr + cont_map[cont];
 
        switch (pi->mode) {
        case 0:
@@ -90,7 +90,6 @@ static void comm_connect(struct pi_adapter *pi)
 }
 
 static void comm_disconnect(struct pi_adapter *pi)
-
 {
        w2(0); w2(0); w2(0); w2(4);
        w0(pi->saved_r0);
@@ -172,12 +171,12 @@ static void comm_write_block(struct pi_adapter *pi, char *buf, int count)
                        w4l(swab16(((u16 *)buf)[2 * k]) |
                            swab16(((u16 *)buf)[2 * k + 1]) << 16);
                break;
-        }
+       }
 }
 
 static void comm_log_adapter(struct pi_adapter *pi)
-
-{       char *mode_string[5] = { "4-bit", "8-bit", "EPP-8", "EPP-16", "EPP-32" };
+{
+       char *mode_string[5] = { "4-bit", "8-bit", "EPP-8", "EPP-16", "EPP-32" };
 
        dev_info(&pi->dev,
                 "DataStor Commuter at 0x%x, mode %d (%s), delay %d\n",
index d105db5c7d81a6b15fd68bee9f9ad9c17799a55c..45e48d653c60b5556557e4e4d12666a32b7563aa 100644 (file)
@@ -1255,8 +1255,8 @@ static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes)
 
        for (b = 0; b < bytes; ) {
                for (w = 0, o = 0; b < bytes && w < 4; w++) {
-                       o += snprintf(linebuf + o, sizeof(linebuf) - o,
-                                     "%08x ", readl(start + b));
+                       o += scnprintf(linebuf + o, sizeof(linebuf) - o,
+                                      "%08x ", readl(start + b));
                        b += sizeof(u32);
                }
                dev_dbg(dev, "%s: %p: %s\n",
index b7d7f410c2561ca26da0efd5808e2273028c0759..4d8b315c48a15a9dd9db023f67e214855b86623d 100644 (file)
@@ -3537,6 +3537,8 @@ int device_add(struct device *dev)
        /* subsystems can specify simple device enumeration */
        else if (dev->bus && dev->bus->dev_name)
                error = dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id);
+       else
+               error = -EINVAL;
        if (error)
                goto name_error;
 
index 82597ab4f747bb6fd0796bf1ab2a781962677ac4..499f4809fcdf3d507dfe33399483762569c8c725 100644 (file)
@@ -4419,6 +4419,7 @@ static int btusb_probe(struct usb_interface *intf,
 
        if (id->driver_info & BTUSB_QCA_ROME) {
                data->setup_on_usb = btusb_setup_qca;
+               hdev->shutdown = btusb_shutdown_qca;
                hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
                hdev->cmd_timeout = btusb_qca_cmd_timeout;
                set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
index 7a8d402f05be1668b1d084ad08f4834c8560cd5b..9af280735cbaa1db0d59dc154bcb3be7c1cc7df1 100644 (file)
@@ -67,7 +67,6 @@ config COMEDI_TEST
 
 config COMEDI_PARPORT
        tristate "Parallel port support"
-       depends on HAS_IOPORT
        help
          Enable support for the standard parallel port.
          A cheap and easy way to get a few more digital I/O lines. Steal
@@ -80,7 +79,6 @@ config COMEDI_PARPORT
 config COMEDI_SSV_DNP
        tristate "SSV Embedded Systems DIL/Net-PC support"
        depends on X86_32 || COMPILE_TEST
-       depends on HAS_IOPORT
        help
          Enable support for SSV Embedded Systems DIL/Net-PC
 
@@ -91,7 +89,6 @@ endif # COMEDI_MISC_DRIVERS
 
 menuconfig COMEDI_ISA_DRIVERS
        bool "Comedi ISA and PC/104 drivers"
-       depends on ISA
        help
          Enable comedi ISA and PC/104 drivers to be built
 
@@ -103,8 +100,7 @@ if COMEDI_ISA_DRIVERS
 
 config COMEDI_PCL711
        tristate "Advantech PCL-711/711b and ADlink ACL-8112 ISA card support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Advantech PCL-711 and 711b, ADlink ACL-8112
 
@@ -165,9 +161,8 @@ config COMEDI_PCL730
 
 config COMEDI_PCL812
        tristate "Advantech PCL-812/813 and ADlink ACL-8112/8113/8113/8216"
-       depends on HAS_IOPORT
        select COMEDI_ISADMA if ISA_DMA_API
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Advantech PCL-812/PG, PCL-813/B, ADLink
          ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A-821PGH/PGL/PGL-NDA,
@@ -178,9 +173,8 @@ config COMEDI_PCL812
 
 config COMEDI_PCL816
        tristate "Advantech PCL-814 and PCL-816 ISA card support"
-       depends on HAS_IOPORT
        select COMEDI_ISADMA if ISA_DMA_API
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Advantech PCL-814 and PCL-816 ISA cards
 
@@ -189,9 +183,8 @@ config COMEDI_PCL816
 
 config COMEDI_PCL818
        tristate "Advantech PCL-718 and PCL-818 ISA card support"
-       depends on HAS_IOPORT
        select COMEDI_ISADMA if ISA_DMA_API
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Advantech PCL-818 ISA cards
          PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818 and PCL-718
@@ -210,7 +203,7 @@ config COMEDI_PCM3724
 
 config COMEDI_AMPLC_DIO200_ISA
        tristate "Amplicon PC212E/PC214E/PC215E/PC218E/PC272E"
-       depends on COMEDI_AMPLC_DIO200
+       select COMEDI_AMPLC_DIO200
        help
          Enable support for Amplicon PC212E, PC214E, PC215E, PC218E and
          PC272E ISA DIO boards
@@ -262,8 +255,7 @@ config COMEDI_DAC02
 
 config COMEDI_DAS16M1
        tristate "MeasurementComputing CIO-DAS16/M1DAS-16 ISA card support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
        help
          Enable support for Measurement Computing CIO-DAS16/M1 ISA cards.
@@ -273,7 +265,7 @@ config COMEDI_DAS16M1
 
 config COMEDI_DAS08_ISA
        tristate "DAS-08 compatible ISA and PC/104 card support"
-       depends on COMEDI_DAS08
+       select COMEDI_DAS08
        help
          Enable support for Keithley Metrabyte/ComputerBoards DAS08
          and compatible ISA and PC/104 cards:
@@ -286,9 +278,8 @@ config COMEDI_DAS08_ISA
 
 config COMEDI_DAS16
        tristate "DAS-16 compatible ISA and PC/104 card support"
-       depends on HAS_IOPORT
        select COMEDI_ISADMA if ISA_DMA_API
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
        help
          Enable support for Keithley Metrabyte/ComputerBoards DAS16
@@ -305,8 +296,7 @@ config COMEDI_DAS16
 
 config COMEDI_DAS800
        tristate "DAS800 and compatible ISA card support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Keithley Metrabyte DAS800 and compatible ISA cards
          Keithley Metrabyte DAS-800, DAS-801, DAS-802
@@ -318,9 +308,8 @@ config COMEDI_DAS800
 
 config COMEDI_DAS1800
        tristate "DAS1800 and compatible ISA card support"
-       depends on HAS_IOPORT
        select COMEDI_ISADMA if ISA_DMA_API
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for DAS1800 and compatible ISA cards
          Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO,
@@ -334,8 +323,7 @@ config COMEDI_DAS1800
 
 config COMEDI_DAS6402
        tristate "DAS6402 and compatible ISA card support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for DAS6402 and compatible ISA cards
          Computerboards, Keithley Metrabyte DAS6402 and compatibles
@@ -414,8 +402,7 @@ config COMEDI_FL512
 
 config COMEDI_AIO_AIO12_8
        tristate "I/O Products PC/104 AIO12-8 Analog I/O Board support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
        help
          Enable support for I/O Products PC/104 AIO12-8 Analog I/O Board
@@ -469,9 +456,8 @@ config COMEDI_ADQ12B
 
 config COMEDI_NI_AT_A2150
        tristate "NI AT-A2150 ISA card support"
-       depends on HAS_IOPORT
        select COMEDI_ISADMA if ISA_DMA_API
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for National Instruments AT-A2150 cards
 
@@ -480,8 +466,7 @@ config COMEDI_NI_AT_A2150
 
 config COMEDI_NI_AT_AO
        tristate "NI AT-AO-6/10 EISA card support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for National Instruments AT-AO-6/10 cards
 
@@ -512,7 +497,7 @@ config COMEDI_NI_ATMIO16D
 
 config COMEDI_NI_LABPC_ISA
        tristate "NI Lab-PC and compatibles ISA support"
-       depends on COMEDI_NI_LABPC
+       select COMEDI_NI_LABPC
        help
          Enable support for National Instruments Lab-PC and compatibles
          Lab-PC-1200, Lab-PC-1200AI, Lab-PC+.
@@ -576,7 +561,7 @@ endif # COMEDI_ISA_DRIVERS
 
 menuconfig COMEDI_PCI_DRIVERS
        tristate "Comedi PCI drivers"
-       depends on PCI && HAS_IOPORT
+       depends on PCI
        help
          Enable support for comedi PCI drivers.
 
@@ -725,8 +710,7 @@ config COMEDI_ADL_PCI8164
 
 config COMEDI_ADL_PCI9111
        tristate "ADLink PCI-9111HR support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for ADlink PCI9111 cards
 
@@ -736,7 +720,7 @@ config COMEDI_ADL_PCI9111
 config COMEDI_ADL_PCI9118
        tristate "ADLink PCI-9118DG, PCI-9118HG, PCI-9118HR support"
        depends on HAS_DMA
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for ADlink PCI-9118DG, PCI-9118HG, PCI-9118HR cards
 
@@ -745,8 +729,7 @@ config COMEDI_ADL_PCI9118
 
 config COMEDI_ADV_PCI1710
        tristate "Advantech PCI-171x and PCI-1731 support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711,
          PCI-1713 and PCI-1731
@@ -790,8 +773,7 @@ config COMEDI_ADV_PCI1760
 
 config COMEDI_ADV_PCI_DIO
        tristate "Advantech PCI DIO card support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
        help
          Enable support for Advantech PCI DIO cards
@@ -804,7 +786,7 @@ config COMEDI_ADV_PCI_DIO
 
 config COMEDI_AMPLC_DIO200_PCI
        tristate "Amplicon PCI215/PCI272/PCIe215/PCIe236/PCIe296 DIO support"
-       depends on COMEDI_AMPLC_DIO200
+       select COMEDI_AMPLC_DIO200
        help
          Enable support for Amplicon PCI215, PCI272, PCIe215, PCIe236
          and PCIe296 DIO boards.
@@ -832,8 +814,7 @@ config COMEDI_AMPLC_PC263_PCI
 
 config COMEDI_AMPLC_PCI224
        tristate "Amplicon PCI224 and PCI234 support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Amplicon PCI224 and PCI234 AO boards
 
@@ -842,8 +823,7 @@ config COMEDI_AMPLC_PCI224
 
 config COMEDI_AMPLC_PCI230
        tristate "Amplicon PCI230 and PCI260 support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
        help
          Enable support for Amplicon PCI230 and PCI260 Multifunction I/O
@@ -862,7 +842,7 @@ config COMEDI_CONTEC_PCI_DIO
 
 config COMEDI_DAS08_PCI
        tristate "DAS-08 PCI support"
-       depends on COMEDI_DAS08
+       select COMEDI_DAS08
        help
          Enable support for PCI DAS-08 cards.
 
@@ -949,8 +929,7 @@ config COMEDI_CB_PCIDAS64
 
 config COMEDI_CB_PCIDAS
        tristate "MeasurementComputing PCI-DAS support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
        help
          Enable support for ComputerBoards/MeasurementComputing PCI-DAS with
@@ -974,8 +953,7 @@ config COMEDI_CB_PCIDDA
 
 config COMEDI_CB_PCIMDAS
        tristate "MeasurementComputing PCIM-DAS1602/16, PCIe-DAS1602/16 support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
        help
          Enable support for ComputerBoards/MeasurementComputing PCI Migration
@@ -995,8 +973,7 @@ config COMEDI_CB_PCIMDDA
 
 config COMEDI_ME4000
        tristate "Meilhaus ME-4000 support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Meilhaus PCI data acquisition cards
          ME-4650, ME-4670i, ME-4680, ME-4680i and ME-4680is
@@ -1054,7 +1031,7 @@ config COMEDI_NI_670X
 
 config COMEDI_NI_LABPC_PCI
        tristate "NI Lab-PC PCI-1200 support"
-       depends on COMEDI_NI_LABPC
+       select COMEDI_NI_LABPC
        help
          Enable support for National Instruments Lab-PC PCI-1200.
 
@@ -1076,7 +1053,6 @@ config COMEDI_NI_PCIDIO
 config COMEDI_NI_PCIMIO
        tristate "NI PCI-MIO-E series and M series support"
        depends on HAS_DMA
-       depends on HAS_IOPORT
        select COMEDI_NI_TIOCMD
        select COMEDI_8255
        help
@@ -1098,8 +1074,7 @@ config COMEDI_NI_PCIMIO
 
 config COMEDI_RTD520
        tristate "Real Time Devices PCI4520/DM7520 support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for Real Time Devices PCI4520/DM7520
 
@@ -1139,8 +1114,7 @@ if COMEDI_PCMCIA_DRIVERS
 
 config COMEDI_CB_DAS16_CS
        tristate "CB DAS16 series PCMCIA support"
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        help
          Enable support for the ComputerBoards/MeasurementComputing PCMCIA
          cards DAS16/16, PCM-DAS16D/12 and PCM-DAS16s/16
@@ -1150,7 +1124,7 @@ config COMEDI_CB_DAS16_CS
 
 config COMEDI_DAS08_CS
        tristate "CB DAS08 PCMCIA support"
-       depends on COMEDI_DAS08
+       select COMEDI_DAS08
        help
          Enable support for the ComputerBoards/MeasurementComputing DAS-08
          PCMCIA card
@@ -1160,7 +1134,6 @@ config COMEDI_DAS08_CS
 
 config COMEDI_NI_DAQ_700_CS
        tristate "NI DAQCard-700 PCMCIA support"
-       depends on HAS_IOPORT
        help
          Enable support for the National Instruments PCMCIA DAQCard-700 DIO
 
@@ -1169,7 +1142,6 @@ config COMEDI_NI_DAQ_700_CS
 
 config COMEDI_NI_DAQ_DIO24_CS
        tristate "NI DAQ-Card DIO-24 PCMCIA support"
-       depends on HAS_IOPORT
        select COMEDI_8255
        help
          Enable support for the National Instruments PCMCIA DAQ-Card DIO-24
@@ -1179,7 +1151,7 @@ config COMEDI_NI_DAQ_DIO24_CS
 
 config COMEDI_NI_LABPC_CS
        tristate "NI DAQCard-1200 PCMCIA support"
-       depends on COMEDI_NI_LABPC
+       select COMEDI_NI_LABPC
        help
          Enable support for the National Instruments PCMCIA DAQCard-1200
 
@@ -1188,7 +1160,6 @@ config COMEDI_NI_LABPC_CS
 
 config COMEDI_NI_MIO_CS
        tristate "NI DAQCard E series PCMCIA support"
-       depends on HAS_IOPORT
        select COMEDI_NI_TIO
        select COMEDI_8255
        help
@@ -1201,7 +1172,6 @@ config COMEDI_NI_MIO_CS
 
 config COMEDI_QUATECH_DAQP_CS
        tristate "Quatech DAQP PCMCIA data capture card support"
-       depends on HAS_IOPORT
        help
          Enable support for the Quatech DAQP PCMCIA data capture cards
          DAQP-208 and DAQP-308
@@ -1278,14 +1248,12 @@ endif # COMEDI_USB_DRIVERS
 
 config COMEDI_8254
        tristate
-       depends on HAS_IOPORT
 
 config COMEDI_8255
        tristate
 
 config COMEDI_8255_SA
        tristate "Standalone 8255 support"
-       depends on HAS_IOPORT
        select COMEDI_8255
        help
          Enable support for 8255 digital I/O as a standalone driver.
@@ -1317,7 +1285,7 @@ config COMEDI_KCOMEDILIB
          called kcomedilib.
 
 config COMEDI_AMPLC_DIO200
-       depends on COMEDI_8254
+       select COMEDI_8254
        tristate
 
 config COMEDI_AMPLC_PC236
@@ -1326,7 +1294,7 @@ config COMEDI_AMPLC_PC236
 
 config COMEDI_DAS08
        tristate
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
 
 config COMEDI_ISADMA
@@ -1334,8 +1302,7 @@ config COMEDI_ISADMA
 
 config COMEDI_NI_LABPC
        tristate
-       depends on HAS_IOPORT
-       depends on COMEDI_8254
+       select COMEDI_8254
        select COMEDI_8255
 
 config COMEDI_NI_LABPC_ISADMA
index 789193ed038650b5d73f64fd8db8cab84c031936..c278d5facf7d8bc6696e32d7f7ebc38c58b67afc 100644 (file)
@@ -558,6 +558,9 @@ int k3_udma_glue_tx_get_irq(struct k3_udma_glue_tx_channel *tx_chn)
                tx_chn->virq = k3_ringacc_get_ring_irq_num(tx_chn->ringtxcq);
        }
 
+       if (!tx_chn->virq)
+               return -ENXIO;
+
        return tx_chn->virq;
 }
 EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_irq);
index a3104e35412c150b65fb5e9c213893ad34e37e5c..aa597cda0d88741334c68bf1f9f23fcf8e43c292 100644 (file)
@@ -1211,7 +1211,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
                 * without actually having a link.
                 */
  create:
-               device = kzalloc(sizeof(*device), GFP_KERNEL);
+               device = kzalloc(sizeof(*device), GFP_ATOMIC);
                if (device == NULL)
                        break;
 
index 88466b663482f1a867c51fd103772fc06296cc27..f40c81534381219b1d968a4351391eb27ca02758 100644 (file)
@@ -101,7 +101,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color)
 {
        struct fw_node *node;
 
-       node = kzalloc(struct_size(node, ports, port_count), GFP_KERNEL);
+       node = kzalloc(struct_size(node, ports, port_count), GFP_ATOMIC);
        if (node == NULL)
                return NULL;
 
index 49b70c70dc6960b79cc69e5f382a9fdd3e8b9c2e..79d4254d1f9bc537be6ad3e958928b89d40efba3 100644 (file)
@@ -1863,15 +1863,15 @@ static int cs_dsp_adsp2_setup_algs(struct cs_dsp *dsp)
                return PTR_ERR(adsp2_alg);
 
        for (i = 0; i < n_algs; i++) {
-               cs_dsp_info(dsp,
-                           "%d: ID %x v%d.%d.%d XM@%x YM@%x ZM@%x\n",
-                           i, be32_to_cpu(adsp2_alg[i].alg.id),
-                           (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff0000) >> 16,
-                           (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff00) >> 8,
-                           be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff,
-                           be32_to_cpu(adsp2_alg[i].xm),
-                           be32_to_cpu(adsp2_alg[i].ym),
-                           be32_to_cpu(adsp2_alg[i].zm));
+               cs_dsp_dbg(dsp,
+                          "%d: ID %x v%d.%d.%d XM@%x YM@%x ZM@%x\n",
+                          i, be32_to_cpu(adsp2_alg[i].alg.id),
+                          (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff0000) >> 16,
+                          (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff00) >> 8,
+                          be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff,
+                          be32_to_cpu(adsp2_alg[i].xm),
+                          be32_to_cpu(adsp2_alg[i].ym),
+                          be32_to_cpu(adsp2_alg[i].zm));
 
                alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_XM,
                                                  adsp2_alg[i].alg.id,
@@ -1996,14 +1996,14 @@ static int cs_dsp_halo_setup_algs(struct cs_dsp *dsp)
                return PTR_ERR(halo_alg);
 
        for (i = 0; i < n_algs; i++) {
-               cs_dsp_info(dsp,
-                           "%d: ID %x v%d.%d.%d XM@%x YM@%x\n",
-                           i, be32_to_cpu(halo_alg[i].alg.id),
-                           (be32_to_cpu(halo_alg[i].alg.ver) & 0xff0000) >> 16,
-                           (be32_to_cpu(halo_alg[i].alg.ver) & 0xff00) >> 8,
-                           be32_to_cpu(halo_alg[i].alg.ver) & 0xff,
-                           be32_to_cpu(halo_alg[i].xm_base),
-                           be32_to_cpu(halo_alg[i].ym_base));
+               cs_dsp_dbg(dsp,
+                          "%d: ID %x v%d.%d.%d XM@%x YM@%x\n",
+                          i, be32_to_cpu(halo_alg[i].alg.id),
+                          (be32_to_cpu(halo_alg[i].alg.ver) & 0xff0000) >> 16,
+                          (be32_to_cpu(halo_alg[i].alg.ver) & 0xff00) >> 8,
+                          be32_to_cpu(halo_alg[i].alg.ver) & 0xff,
+                          be32_to_cpu(halo_alg[i].xm_base),
+                          be32_to_cpu(halo_alg[i].ym_base));
 
                ret = cs_dsp_halo_create_regions(dsp, halo_alg[i].alg.id,
                                                 halo_alg[i].alg.ver,
index ca61f4733ea5869356489a8f2709a23cbf591601..9a655f30ba47db013c03f2f73da88d6405507c7f 100644 (file)
@@ -62,7 +62,7 @@ efi_status_t allocate_unaccepted_bitmap(__u32 nr_desc,
        bitmap_size = DIV_ROUND_UP(unaccepted_end - unaccepted_start,
                                   EFI_UNACCEPTED_UNIT_SIZE * BITS_PER_BYTE);
 
-       status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
+       status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
                             sizeof(*unaccepted_table) + bitmap_size,
                             (void **)&unaccepted_table);
        if (status != EFI_SUCCESS) {
index dc2d53081e806ffcdb05bc32e46cb76cdaed056c..a79d53bdbe136a8a99afe83530d5666d2edb405f 100644 (file)
@@ -1293,7 +1293,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
 int amdgpu_device_pci_reset(struct amdgpu_device *adev);
 bool amdgpu_device_need_post(struct amdgpu_device *adev);
-bool amdgpu_sg_display_supported(struct amdgpu_device *adev);
 bool amdgpu_device_pcie_dynamic_switching_supported(void);
 bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
 bool amdgpu_device_aspm_support_quirk(void);
index cdf6087706aa832a3cd6c67378877b50be9f1910..25d5fda5b243e3c598c141952f9537fe3c9652d7 100644 (file)
@@ -478,7 +478,7 @@ void amdgpu_amdkfd_get_cu_info(struct amdgpu_device *adev, struct kfd_cu_info *c
        cu_info->cu_active_number = acu_info.number;
        cu_info->cu_ao_mask = acu_info.ao_cu_mask;
        memcpy(&cu_info->cu_bitmap[0], &acu_info.bitmap[0],
-              sizeof(acu_info.bitmap));
+              sizeof(cu_info->cu_bitmap));
        cu_info->num_shader_engines = adev->gfx.config.max_shader_engines;
        cu_info->num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;
        cu_info->num_cu_per_sh = adev->gfx.config.max_cu_per_sh;
index f1f2c24de081eb1f300b2664a53f221591f50e06..69810b3f1c63613f6686f181cdeccf5d9513c2d9 100644 (file)
@@ -980,8 +980,7 @@ void kgd_gfx_v10_build_grace_period_packet_info(struct amdgpu_device *adev,
                                                uint32_t wait_times,
                                                uint32_t grace_period,
                                                uint32_t *reg_offset,
-                                               uint32_t *reg_data,
-                                               uint32_t inst)
+                                               uint32_t *reg_data)
 {
        *reg_data = wait_times;
 
index ecaead24e8c96bbe288fffcac96b067f33fb1589..67bcaa3d4226410279a6bce1b62b7e0cd206259f 100644 (file)
@@ -55,5 +55,4 @@ void kgd_gfx_v10_build_grace_period_packet_info(struct amdgpu_device *adev,
                                               uint32_t wait_times,
                                               uint32_t grace_period,
                                               uint32_t *reg_offset,
-                                              uint32_t *reg_data,
-                                              uint32_t inst);
+                                              uint32_t *reg_data);
index fa5ee96f884545c6fe6aec9573441399fbb3ef9a..3c45a188b701ab0c406481146ff1942576acc413 100644 (file)
@@ -1103,8 +1103,7 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev,
                uint32_t wait_times,
                uint32_t grace_period,
                uint32_t *reg_offset,
-               uint32_t *reg_data,
-               uint32_t inst)
+               uint32_t *reg_data)
 {
        *reg_data = wait_times;
 
@@ -1120,8 +1119,7 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev,
                        SCH_WAVE,
                        grace_period);
 
-       *reg_offset = SOC15_REG_OFFSET(GC, GET_INST(GC, inst),
-                       mmCP_IQ_WAIT_TIME2);
+       *reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_IQ_WAIT_TIME2);
 }
 
 void kgd_gfx_v9_program_trap_handler_settings(struct amdgpu_device *adev,
index 936e501908cef3760865ed6d888127a59bbffcbc..ce424615f59b5bc753c54b8dc83bf1161fca407e 100644 (file)
@@ -100,5 +100,4 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev,
                                               uint32_t wait_times,
                                               uint32_t grace_period,
                                               uint32_t *reg_offset,
-                                              uint32_t *reg_data,
-                                              uint32_t inst);
+                                              uint32_t *reg_data);
index 3f001a50b34a6dfdf463910bfb5ff21ea4e651e8..30c4f5cca02c9f6f6f4aaffc363158ca8145c43e 100644 (file)
@@ -1244,32 +1244,6 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
        return true;
 }
 
-/*
- * On APUs with >= 64GB white flickering has been observed w/ SG enabled.
- * Disable S/G on such systems until we have a proper fix.
- * https://gitlab.freedesktop.org/drm/amd/-/issues/2354
- * https://gitlab.freedesktop.org/drm/amd/-/issues/2735
- */
-bool amdgpu_sg_display_supported(struct amdgpu_device *adev)
-{
-       switch (amdgpu_sg_display) {
-       case -1:
-               break;
-       case 0:
-               return false;
-       case 1:
-               return true;
-       default:
-               return false;
-       }
-       if ((totalram_pages() << (PAGE_SHIFT - 10)) +
-           (adev->gmc.real_vram_size / 1024) >= 64000000) {
-               DRM_WARN("Disabling S/G due to >=64GB RAM\n");
-               return false;
-       }
-       return true;
-}
-
 /*
  * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
  * speed switching. Until we have confirmation from Intel that a specific host
index 395c1768b9fc7d867416fca45b513f0573a19bd2..0ca95c4d4bfbe1634b270ac5afe04aec57636347 100644 (file)
@@ -43,6 +43,7 @@
 #define AMDGPU_GFX_LBPW_DISABLED_MODE          0x00000008L
 
 #define AMDGPU_MAX_GC_INSTANCES                8
+#define KGD_MAX_QUEUES                 128
 
 #define AMDGPU_MAX_GFX_QUEUES KGD_MAX_QUEUES
 #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
@@ -257,7 +258,7 @@ struct amdgpu_cu_info {
        uint32_t number;
        uint32_t ao_cu_mask;
        uint32_t ao_cu_bitmap[4][4];
-       uint32_t bitmap[4][4];
+       uint32_t bitmap[AMDGPU_MAX_GC_INSTANCES][4][4];
 };
 
 struct amdgpu_gfx_ras {
index 99f4df133ed3e8f21a77f2636e41c18a82634473..d30dc0b718c73ee8c703592b56d41c62f87d9c19 100644 (file)
@@ -839,7 +839,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
                memcpy(&dev_info->cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
                       sizeof(adev->gfx.cu_info.ao_cu_bitmap));
                memcpy(&dev_info->cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
-                      sizeof(adev->gfx.cu_info.bitmap));
+                      sizeof(dev_info->cu_bitmap));
                dev_info->vram_type = adev->gmc.vram_type;
                dev_info->vram_bit_width = adev->gmc.vram_width;
                dev_info->vce_harvest_config = adev->vce.harvest_config;
@@ -940,12 +940,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
                        struct atom_context *atom_context;
 
                        atom_context = adev->mode_info.atom_context;
-                       memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name));
-                       memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));
-                       vbios_info.version = atom_context->version;
-                       memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
-                                               sizeof(atom_context->vbios_ver_str));
-                       memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));
+                       if (atom_context) {
+                               memcpy(vbios_info.name, atom_context->name,
+                                      sizeof(atom_context->name));
+                               memcpy(vbios_info.vbios_pn, atom_context->vbios_pn,
+                                      sizeof(atom_context->vbios_pn));
+                               vbios_info.version = atom_context->version;
+                               memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
+                                      sizeof(atom_context->vbios_ver_str));
+                               memcpy(vbios_info.date, atom_context->date,
+                                      sizeof(atom_context->date));
+                       }
 
                        return copy_to_user(out, &vbios_info,
                                                min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0;
index 3c4600e15b862a826ec5d6f9423789afb112158b..937c54fc7174518ec80461616cf353423125bd65 100644 (file)
@@ -1052,7 +1052,8 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
        info->ce_count = obj->err_data.ce_count;
 
        if (err_data.ce_count) {
-               if (adev->smuio.funcs &&
+               if (!adev->aid_mask &&
+                   adev->smuio.funcs &&
                    adev->smuio.funcs->get_socket_id &&
                    adev->smuio.funcs->get_die_id) {
                        dev_info(adev->dev, "socket: %d, die: %d "
@@ -1072,7 +1073,8 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
                }
        }
        if (err_data.ue_count) {
-               if (adev->smuio.funcs &&
+               if (!adev->aid_mask &&
+                   adev->smuio.funcs &&
                    adev->smuio.funcs->get_socket_id &&
                    adev->smuio.funcs->get_die_id) {
                        dev_info(adev->dev, "socket: %d, die: %d "
index c6b4337eb20c3b38b0426fdacb95aee6c528c283..10df731998b22f873611092942008560ec67394d 100644 (file)
@@ -81,7 +81,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
                     unsigned int size)
 {
        struct drm_suballoc *sa = drm_suballoc_new(&sa_manager->base, size,
-                                                  GFP_KERNEL, true, 0);
+                                                  GFP_KERNEL, false, 0);
 
        if (IS_ERR(sa)) {
                *sa_bo = NULL;
index 0aee9c8288a2b8eb88054177b52e8a8ce0404215..9032d7a24d7cd7cddfafdc494f131d9ba87a16c6 100644 (file)
@@ -9449,7 +9449,7 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev,
                                gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(
                                        adev, disable_masks[i * 2 + j]);
                        bitmap = gfx_v10_0_get_cu_active_bitmap_per_sh(adev);
-                       cu_info->bitmap[i][j] = bitmap;
+                       cu_info->bitmap[0][i][j] = bitmap;
 
                        for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
                                if (bitmap & mask) {
index 5c3db694afa87a99382f68044b798d401d0dda5e..762d7a19f1be163fa2cbf83bd5271a32cbc043a1 100644 (file)
@@ -6368,7 +6368,7 @@ static int gfx_v11_0_get_cu_info(struct amdgpu_device *adev,
                         *    SE6: {SH0,SH1} --> {bitmap[2][2], bitmap[2][3]}
                         *    SE7: {SH0,SH1} --> {bitmap[3][2], bitmap[3][3]}
                         */
-                       cu_info->bitmap[i % 4][j + (i / 4) * 2] = bitmap;
+                       cu_info->bitmap[0][i % 4][j + (i / 4) * 2] = bitmap;
 
                        for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
                                if (bitmap & mask)
index da6caff78c22be23ba918c49f4334c97236c0104..34f9211b26793ff705aef4ab75e926dfba1f1dbb 100644 (file)
@@ -3577,7 +3577,7 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
                                gfx_v6_0_set_user_cu_inactive_bitmap(
                                        adev, disable_masks[i * 2 + j]);
                        bitmap = gfx_v6_0_get_cu_enabled(adev);
-                       cu_info->bitmap[i][j] = bitmap;
+                       cu_info->bitmap[0][i][j] = bitmap;
 
                        for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
                                if (bitmap & mask) {
index 90b034b173c1cc9385c4668eb478c93e88b93ed1..c2faf6b4c2fced463cc24598cf10c9775a9663ee 100644 (file)
@@ -5119,7 +5119,7 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
                                gfx_v7_0_set_user_cu_inactive_bitmap(
                                        adev, disable_masks[i * 2 + j]);
                        bitmap = gfx_v7_0_get_cu_active_bitmap(adev);
-                       cu_info->bitmap[i][j] = bitmap;
+                       cu_info->bitmap[0][i][j] = bitmap;
 
                        for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
                                if (bitmap & mask) {
index 51c1745c83697b04a7eab230f5a64847fceabed3..885ebd703260f05a92aa15928910e171112b2cc7 100644 (file)
@@ -7121,7 +7121,7 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
                                gfx_v8_0_set_user_cu_inactive_bitmap(
                                        adev, disable_masks[i * 2 + j]);
                        bitmap = gfx_v8_0_get_cu_active_bitmap(adev);
-                       cu_info->bitmap[i][j] = bitmap;
+                       cu_info->bitmap[0][i][j] = bitmap;
 
                        for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
                                if (bitmap & mask) {
index 458faf657042e3d6a2b8af49b508db2867bf3295..fd61574a737cb17cd843ea4b81c0c10b0f0b1661 100644 (file)
@@ -1499,7 +1499,7 @@ static void gfx_v9_0_init_always_on_cu_mask(struct amdgpu_device *adev)
                        amdgpu_gfx_select_se_sh(adev, i, j, 0xffffffff, 0);
 
                        for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
-                               if (cu_info->bitmap[i][j] & mask) {
+                               if (cu_info->bitmap[0][i][j] & mask) {
                                        if (counter == pg_always_on_cu_num)
                                                WREG32_SOC15(GC, 0, mmRLC_PG_ALWAYS_ON_CU_MASK, cu_bitmap);
                                        if (counter < always_on_cu_num)
@@ -7233,7 +7233,7 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
                         *    SE6,SH0 --> bitmap[2][1]
                         *    SE7,SH0 --> bitmap[3][1]
                         */
-                       cu_info->bitmap[i % 4][j + i / 4] = bitmap;
+                       cu_info->bitmap[0][i % 4][j + i / 4] = bitmap;
 
                        for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
                                if (bitmap & mask) {
index 0a26a00074a63161d677783b1ee3f3a1c44aeed2..18ce5fe45f6f863ac33e51e8eaa019025baf82a2 100644 (file)
@@ -4259,7 +4259,7 @@ static void gfx_v9_4_3_set_gds_init(struct amdgpu_device *adev)
 }
 
 static void gfx_v9_4_3_set_user_cu_inactive_bitmap(struct amdgpu_device *adev,
-                                                u32 bitmap)
+                                                u32 bitmap, int xcc_id)
 {
        u32 data;
 
@@ -4269,15 +4269,15 @@ static void gfx_v9_4_3_set_user_cu_inactive_bitmap(struct amdgpu_device *adev,
        data = bitmap << GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_CUS__SHIFT;
        data &= GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_CUS_MASK;
 
-       WREG32_SOC15(GC, GET_INST(GC, 0), regGC_USER_SHADER_ARRAY_CONFIG, data);
+       WREG32_SOC15(GC, GET_INST(GC, xcc_id), regGC_USER_SHADER_ARRAY_CONFIG, data);
 }
 
-static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev)
+static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev, int xcc_id)
 {
        u32 data, mask;
 
-       data = RREG32_SOC15(GC, GET_INST(GC, 0), regCC_GC_SHADER_ARRAY_CONFIG);
-       data |= RREG32_SOC15(GC, GET_INST(GC, 0), regGC_USER_SHADER_ARRAY_CONFIG);
+       data = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regCC_GC_SHADER_ARRAY_CONFIG);
+       data |= RREG32_SOC15(GC, GET_INST(GC, xcc_id), regGC_USER_SHADER_ARRAY_CONFIG);
 
        data &= CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_CUS_MASK;
        data >>= CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_CUS__SHIFT;
@@ -4290,7 +4290,7 @@ static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev)
 static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,
                                 struct amdgpu_cu_info *cu_info)
 {
-       int i, j, k, counter, active_cu_number = 0;
+       int i, j, k, counter, xcc_id, active_cu_number = 0;
        u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
        unsigned disable_masks[4 * 4];
 
@@ -4309,46 +4309,38 @@ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,
                                    adev->gfx.config.max_sh_per_se);
 
        mutex_lock(&adev->grbm_idx_mutex);
-       for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
-               for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
-                       mask = 1;
-                       ao_bitmap = 0;
-                       counter = 0;
-                       gfx_v9_4_3_xcc_select_se_sh(adev, i, j, 0xffffffff, 0);
-                       gfx_v9_4_3_set_user_cu_inactive_bitmap(
-                               adev, disable_masks[i * adev->gfx.config.max_sh_per_se + j]);
-                       bitmap = gfx_v9_4_3_get_cu_active_bitmap(adev);
-
-                       /*
-                        * The bitmap(and ao_cu_bitmap) in cu_info structure is
-                        * 4x4 size array, and it's usually suitable for Vega
-                        * ASICs which has 4*2 SE/SH layout.
-                        * But for Arcturus, SE/SH layout is changed to 8*1.
-                        * To mostly reduce the impact, we make it compatible
-                        * with current bitmap array as below:
-                        *    SE4,SH0 --> bitmap[0][1]
-                        *    SE5,SH0 --> bitmap[1][1]
-                        *    SE6,SH0 --> bitmap[2][1]
-                        *    SE7,SH0 --> bitmap[3][1]
-                        */
-                       cu_info->bitmap[i % 4][j + i / 4] = bitmap;
-
-                       for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
-                               if (bitmap & mask) {
-                                       if (counter < adev->gfx.config.max_cu_per_sh)
-                                               ao_bitmap |= mask;
-                                       counter++;
+       for (xcc_id = 0; xcc_id < NUM_XCC(adev->gfx.xcc_mask); xcc_id++) {
+               for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
+                       for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
+                               mask = 1;
+                               ao_bitmap = 0;
+                               counter = 0;
+                               gfx_v9_4_3_xcc_select_se_sh(adev, i, j, 0xffffffff, xcc_id);
+                               gfx_v9_4_3_set_user_cu_inactive_bitmap(
+                                       adev,
+                                       disable_masks[i * adev->gfx.config.max_sh_per_se + j],
+                                       xcc_id);
+                               bitmap = gfx_v9_4_3_get_cu_active_bitmap(adev, xcc_id);
+
+                               cu_info->bitmap[xcc_id][i][j] = bitmap;
+
+                               for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
+                                       if (bitmap & mask) {
+                                               if (counter < adev->gfx.config.max_cu_per_sh)
+                                                       ao_bitmap |= mask;
+                                               counter++;
+                                       }
+                                       mask <<= 1;
                                }
-                               mask <<= 1;
+                               active_cu_number += counter;
+                               if (i < 2 && j < 2)
+                                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                               cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                        }
-                       active_cu_number += counter;
-                       if (i < 2 && j < 2)
-                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
-                       cu_info->ao_cu_bitmap[i % 4][j + i / 4] = ao_bitmap;
                }
+               gfx_v9_4_3_xcc_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff,
+                                           xcc_id);
        }
-       gfx_v9_4_3_xcc_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff,
-                                   0);
        mutex_unlock(&adev->grbm_idx_mutex);
 
        cu_info->number = active_cu_number;
index d5ed9e0e1a5f157fd90bcb0bd429041cb3d3eeb2..e5b5b0f4940f4cb517e0bd6b3de4067e73426218 100644 (file)
@@ -345,6 +345,9 @@ static void nbio_v4_3_init_registers(struct amdgpu_device *adev)
                data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK;
                WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data);
        }
+       if (amdgpu_sriov_vf(adev))
+               adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,
+                       regBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
 }
 
 static u32 nbio_v4_3_get_rom_offset(struct amdgpu_device *adev)
index 40d23738ee4ec0528fb7a13e3978654e055233ea..8b2ff2b281b0ade2f37d309476f20eb8a10c732a 100644 (file)
@@ -766,7 +766,7 @@ static int soc21_common_hw_init(void *handle)
         * for the purpose of expose those registers
         * to process space
         */
-       if (adev->nbio.funcs->remap_hdp_registers)
+       if (adev->nbio.funcs->remap_hdp_registers && !amdgpu_sriov_vf(adev))
                adev->nbio.funcs->remap_hdp_registers(adev);
        /* enable the doorbell aperture */
        adev->nbio.funcs->enable_doorbell_aperture(adev, true);
index 86fb7ac7982a1d633d83eeec8e6fde1065a02b35..f76b7aee5c0a12b9a65ccba84e573b0078c0d2fd 100644 (file)
@@ -2087,7 +2087,8 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
 
        amdgpu_amdkfd_get_cu_info(kdev->adev, &cu_info);
        cu->num_simd_per_cu = cu_info.simd_per_cu;
-       cu->num_simd_cores = cu_info.simd_per_cu * cu_info.cu_active_number;
+       cu->num_simd_cores = cu_info.simd_per_cu *
+                       (cu_info.cu_active_number / kdev->kfd->num_nodes);
        cu->max_waves_simd = cu_info.max_waves_per_simd;
 
        cu->wave_front_size = cu_info.wave_front_size;
index 387a8ef493855adbfe8718858d1ff876cc487613..74c2d7a0d6285715339482b975f946779def8e58 100644 (file)
@@ -79,6 +79,10 @@ struct crat_header {
 #define CRAT_SUBTYPE_IOLINK_AFFINITY           5
 #define CRAT_SUBTYPE_MAX                       6
 
+/*
+ * Do not change the value of CRAT_SIBLINGMAP_SIZE from 32
+ * as it breaks the ABI.
+ */
 #define CRAT_SIBLINGMAP_SIZE   32
 
 /*
index b166f30f083e0aad6498bd96f603dcfad3977296..8a6cb41444a4767a1f5270d49af93ec8722269b6 100644 (file)
@@ -1677,8 +1677,7 @@ static int start_cpsch(struct device_queue_manager *dqm)
                        dqm->dev->kfd2kgd->build_grace_period_packet_info(
                                        dqm->dev->adev, dqm->wait_times,
                                        grace_period, &reg_offset,
-                                       &dqm->wait_times,
-                                       ffs(dqm->dev->xcc_mask) - 1);
+                                       &dqm->wait_times);
        }
 
        dqm_unlock(dqm);
index c2e0b79dcc6dabe598fa023a2afba8cbcb9f0b87..7b38537c7c99bdb401ea4666d907c23253ef089e 100644 (file)
@@ -162,6 +162,7 @@ void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd,
                return NULL;
 
        *doorbell_off = amdgpu_doorbell_index_on_bar(kfd->adev, kfd->doorbells, inx);
+       inx *= 2;
 
        pr_debug("Get kernel queue doorbell\n"
                        "     doorbell offset   == 0x%08X\n"
@@ -176,6 +177,7 @@ void kfd_release_kernel_doorbell(struct kfd_dev *kfd, u32 __iomem *db_addr)
        unsigned int inx;
 
        inx = (unsigned int)(db_addr - kfd->doorbell_kernel_ptr);
+       inx /= 2;
 
        mutex_lock(&kfd->doorbell_mutex);
        __clear_bit(inx, kfd->doorbell_bitmap);
index d01bb57733b368c4ed692c873027352b3aa865a3..447829c22295c6cf6c7570a592c0ef33ba0211c8 100644 (file)
@@ -97,18 +97,22 @@ void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd,
 
 void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
                const uint32_t *cu_mask, uint32_t cu_mask_count,
-               uint32_t *se_mask)
+               uint32_t *se_mask, uint32_t inst)
 {
        struct kfd_cu_info cu_info;
        uint32_t cu_per_sh[KFD_MAX_NUM_SE][KFD_MAX_NUM_SH_PER_SE] = {0};
        bool wgp_mode_req = KFD_GC_VERSION(mm->dev) >= IP_VERSION(10, 0, 0);
        uint32_t en_mask = wgp_mode_req ? 0x3 : 0x1;
-       int i, se, sh, cu, cu_bitmap_sh_mul, inc = wgp_mode_req ? 2 : 1;
+       int i, se, sh, cu, cu_bitmap_sh_mul, cu_inc = wgp_mode_req ? 2 : 1;
+       uint32_t cu_active_per_node;
+       int inc = cu_inc * NUM_XCC(mm->dev->xcc_mask);
+       int xcc_inst = inst + ffs(mm->dev->xcc_mask) - 1;
 
        amdgpu_amdkfd_get_cu_info(mm->dev->adev, &cu_info);
 
-       if (cu_mask_count > cu_info.cu_active_number)
-               cu_mask_count = cu_info.cu_active_number;
+       cu_active_per_node = cu_info.cu_active_number / mm->dev->kfd->num_nodes;
+       if (cu_mask_count > cu_active_per_node)
+               cu_mask_count = cu_active_per_node;
 
        /* Exceeding these bounds corrupts the stack and indicates a coding error.
         * Returning with no CU's enabled will hang the queue, which should be
@@ -141,7 +145,8 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
        for (se = 0; se < cu_info.num_shader_engines; se++)
                for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++)
                        cu_per_sh[se][sh] = hweight32(
-                               cu_info.cu_bitmap[se % 4][sh + (se / 4) * cu_bitmap_sh_mul]);
+                               cu_info.cu_bitmap[xcc_inst][se % 4][sh + (se / 4) *
+                               cu_bitmap_sh_mul]);
 
        /* Symmetrically map cu_mask to all SEs & SHs:
         * se_mask programs up to 2 SH in the upper and lower 16 bits.
@@ -164,20 +169,33 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
         * cu_mask[0] bit8 -> se_mask[0] bit1 (SE0,SH0,CU1)
         * ...
         *
+        * For GFX 9.4.3, the following code only looks at a
+        * subset of the cu_mask corresponding to the inst parameter.
+        * If we have n XCCs under one GPU node
+        * cu_mask[0] bit0 -> XCC0 se_mask[0] bit0 (XCC0,SE0,SH0,CU0)
+        * cu_mask[0] bit1 -> XCC1 se_mask[0] bit0 (XCC1,SE0,SH0,CU0)
+        * ..
+        * cu_mask[0] bitn -> XCCn se_mask[0] bit0 (XCCn,SE0,SH0,CU0)
+        * cu_mask[0] bit n+1 -> XCC0 se_mask[1] bit0 (XCC0,SE1,SH0,CU0)
+        *
+        * For example, if there are 6 XCCs under 1 KFD node, this code
+        * running for each inst, will look at the bits as:
+        * inst, inst + 6, inst + 12...
+        *
         * First ensure all CUs are disabled, then enable user specified CUs.
         */
        for (i = 0; i < cu_info.num_shader_engines; i++)
                se_mask[i] = 0;
 
-       i = 0;
-       for (cu = 0; cu < 16; cu += inc) {
+       i = inst;
+       for (cu = 0; cu < 16; cu += cu_inc) {
                for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) {
                        for (se = 0; se < cu_info.num_shader_engines; se++) {
                                if (cu_per_sh[se][sh] > cu) {
                                        if (cu_mask[i / 32] & (en_mask << (i % 32)))
                                                se_mask[se] |= en_mask << (cu + sh * 16);
                                        i += inc;
-                                       if (i == cu_mask_count)
+                                       if (i >= cu_mask_count)
                                                return;
                                }
                        }
index 23158db7da035d9820b8b14007826f75f69f3cc1..57bf5e513f4d16198a6dda43f27f422e4df5f44a 100644 (file)
@@ -138,7 +138,7 @@ void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd,
 
 void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
                const uint32_t *cu_mask, uint32_t cu_mask_count,
-               uint32_t *se_mask);
+               uint32_t *se_mask, uint32_t inst);
 
 int kfd_hiq_load_mqd_kiq(struct mqd_manager *mm, void *mqd,
                uint32_t pipe_id, uint32_t queue_id,
index ee1d32d957f2b1bc3757778506ed55a8264588e1..1a4a69943c714069ba5a2b314fabdd6849e74a6a 100644 (file)
@@ -52,7 +52,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
                return;
 
        mqd_symmetrically_map_cu_mask(mm,
-               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
+               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
 
        m = get_mqd(mqd);
        m->compute_static_thread_mgmt_se0 = se_mask[0];
index 83699392c8089cd12d8bafa274c72e6e0d8bcca3..8b7fed91352696cf2b5cafab0680ad0737fa95ee 100644 (file)
@@ -52,7 +52,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
                return;
 
        mqd_symmetrically_map_cu_mask(mm,
-               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
+               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
 
        m = get_mqd(mqd);
        m->compute_static_thread_mgmt_se0 = se_mask[0];
index 0bbf0edbabd47ecb9cb551173862183a7c194b76..15277f1d5cf0a9d9eb694ccaeec540e467ab774a 100644 (file)
@@ -71,7 +71,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
        }
 
        mqd_symmetrically_map_cu_mask(mm,
-               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
+               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
 
        m->compute_static_thread_mgmt_se0 = se_mask[0];
        m->compute_static_thread_mgmt_se1 = se_mask[1];
@@ -321,6 +321,43 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd,
        return 0;
 }
 
+static void checkpoint_mqd(struct mqd_manager *mm, void *mqd, void *mqd_dst, void *ctl_stack_dst)
+{
+       struct v11_compute_mqd *m;
+
+       m = get_mqd(mqd);
+
+       memcpy(mqd_dst, m, sizeof(struct v11_compute_mqd));
+}
+
+static void restore_mqd(struct mqd_manager *mm, void **mqd,
+                       struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr,
+                       struct queue_properties *qp,
+                       const void *mqd_src,
+                       const void *ctl_stack_src, const u32 ctl_stack_size)
+{
+       uint64_t addr;
+       struct v11_compute_mqd *m;
+
+       m = (struct v11_compute_mqd *) mqd_mem_obj->cpu_ptr;
+       addr = mqd_mem_obj->gpu_addr;
+
+       memcpy(m, mqd_src, sizeof(*m));
+
+       *mqd = m;
+       if (gart_addr)
+               *gart_addr = addr;
+
+       m->cp_hqd_pq_doorbell_control =
+               qp->doorbell_off <<
+                       CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT;
+       pr_debug("cp_hqd_pq_doorbell_control 0x%x\n",
+                       m->cp_hqd_pq_doorbell_control);
+
+       qp->is_active = 0;
+}
+
+
 static void init_mqd_hiq(struct mqd_manager *mm, void **mqd,
                        struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr,
                        struct queue_properties *q)
@@ -458,6 +495,8 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type,
                mqd->mqd_size = sizeof(struct v11_compute_mqd);
                mqd->get_wave_state = get_wave_state;
                mqd->mqd_stride = kfd_mqd_stride;
+               mqd->checkpoint_mqd = checkpoint_mqd;
+               mqd->restore_mqd = restore_mqd;
 #if defined(CONFIG_DEBUG_FS)
                mqd->debugfs_show_mqd = debugfs_show_mqd;
 #endif
@@ -502,6 +541,8 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type,
                mqd->update_mqd = update_mqd_sdma;
                mqd->destroy_mqd = kfd_destroy_mqd_sdma;
                mqd->is_occupied = kfd_is_occupied_sdma;
+               mqd->checkpoint_mqd = checkpoint_mqd;
+               mqd->restore_mqd = restore_mqd;
                mqd->mqd_size = sizeof(struct v11_sdma_mqd);
                mqd->mqd_stride = kfd_mqd_stride;
 #if defined(CONFIG_DEBUG_FS)
index e23d32f356077225f06b76008b8b75cc6ab22a87..42d881809dc70e230133674e4b12f6f68567837a 100644 (file)
@@ -60,7 +60,7 @@ static inline struct v9_sdma_mqd *get_sdma_mqd(void *mqd)
 }
 
 static void update_cu_mask(struct mqd_manager *mm, void *mqd,
-                       struct mqd_update_info *minfo)
+                       struct mqd_update_info *minfo, uint32_t inst)
 {
        struct v9_mqd *m;
        uint32_t se_mask[KFD_MAX_NUM_SE] = {0};
@@ -69,27 +69,36 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
                return;
 
        mqd_symmetrically_map_cu_mask(mm,
-               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
+               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, inst);
 
        m = get_mqd(mqd);
+
        m->compute_static_thread_mgmt_se0 = se_mask[0];
        m->compute_static_thread_mgmt_se1 = se_mask[1];
        m->compute_static_thread_mgmt_se2 = se_mask[2];
        m->compute_static_thread_mgmt_se3 = se_mask[3];
-       m->compute_static_thread_mgmt_se4 = se_mask[4];
-       m->compute_static_thread_mgmt_se5 = se_mask[5];
-       m->compute_static_thread_mgmt_se6 = se_mask[6];
-       m->compute_static_thread_mgmt_se7 = se_mask[7];
-
-       pr_debug("update cu mask to %#x %#x %#x %#x %#x %#x %#x %#x\n",
-               m->compute_static_thread_mgmt_se0,
-               m->compute_static_thread_mgmt_se1,
-               m->compute_static_thread_mgmt_se2,
-               m->compute_static_thread_mgmt_se3,
-               m->compute_static_thread_mgmt_se4,
-               m->compute_static_thread_mgmt_se5,
-               m->compute_static_thread_mgmt_se6,
-               m->compute_static_thread_mgmt_se7);
+       if (KFD_GC_VERSION(mm->dev) != IP_VERSION(9, 4, 3)) {
+               m->compute_static_thread_mgmt_se4 = se_mask[4];
+               m->compute_static_thread_mgmt_se5 = se_mask[5];
+               m->compute_static_thread_mgmt_se6 = se_mask[6];
+               m->compute_static_thread_mgmt_se7 = se_mask[7];
+
+               pr_debug("update cu mask to %#x %#x %#x %#x %#x %#x %#x %#x\n",
+                       m->compute_static_thread_mgmt_se0,
+                       m->compute_static_thread_mgmt_se1,
+                       m->compute_static_thread_mgmt_se2,
+                       m->compute_static_thread_mgmt_se3,
+                       m->compute_static_thread_mgmt_se4,
+                       m->compute_static_thread_mgmt_se5,
+                       m->compute_static_thread_mgmt_se6,
+                       m->compute_static_thread_mgmt_se7);
+       } else {
+               pr_debug("inst: %u, update cu mask to %#x %#x %#x %#x\n",
+                       inst, m->compute_static_thread_mgmt_se0,
+                       m->compute_static_thread_mgmt_se1,
+                       m->compute_static_thread_mgmt_se2,
+                       m->compute_static_thread_mgmt_se3);
+       }
 }
 
 static void set_priority(struct v9_mqd *m, struct queue_properties *q)
@@ -290,7 +299,8 @@ static void update_mqd(struct mqd_manager *mm, void *mqd,
        if (mm->dev->kfd->cwsr_enabled && q->ctx_save_restore_area_address)
                m->cp_hqd_ctx_save_control = 0;
 
-       update_cu_mask(mm, mqd, minfo);
+       if (KFD_GC_VERSION(mm->dev) != IP_VERSION(9, 4, 3))
+               update_cu_mask(mm, mqd, minfo, 0);
        set_priority(m, q);
 
        q->is_active = QUEUE_IS_ACTIVE(*q);
@@ -676,6 +686,8 @@ static void update_mqd_v9_4_3(struct mqd_manager *mm, void *mqd,
                m = get_mqd(mqd + size * xcc);
                update_mqd(mm, m, q, minfo);
 
+               update_cu_mask(mm, mqd, minfo, xcc);
+
                if (q->format == KFD_QUEUE_FORMAT_AQL) {
                        switch (xcc) {
                        case 0:
index 657c378229808fdfb2518203269fb81c744e53d0..3e1a574d4ea66981b9a5243211bd451def7aee94 100644 (file)
@@ -55,7 +55,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
                return;
 
        mqd_symmetrically_map_cu_mask(mm,
-               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
+               minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
 
        m = get_mqd(mqd);
        m->compute_static_thread_mgmt_se0 = se_mask[0];
index 8ce6f5200905164a433e04c290c7f63f6ca05f5a..1a03173e23133799d1d6be4a064a7fde0bb25923 100644 (file)
@@ -299,8 +299,7 @@ static int pm_set_grace_period_v9(struct packet_manager *pm,
                        pm->dqm->wait_times,
                        grace_period,
                        &reg_offset,
-                       &reg_data,
-                       0);
+                       &reg_data);
 
        if (grace_period == USE_DEFAULT_GRACE_PERIOD)
                reg_data = pm->dqm->wait_times;
index 3d9ce44d88da572faa590a3277063ecd0854d9bb..fa24e1852493dc8fb77b35efdb0e5768a34b172e 100644 (file)
@@ -1466,8 +1466,7 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type);
 
 static inline bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev)
 {
-       return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) ||
-              KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+       return KFD_GC_VERSION(dev) > IP_VERSION(9, 4, 2) ||
               (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) && dev->sdma_fw_version >= 18) ||
               KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0);
 }
index ff98fded953499017a90b57c066570c09721e7e0..c8c75ff7cea80d3ba77dd23d16e1cea9213cc8df 100644 (file)
@@ -450,8 +450,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
        sysfs_show_32bit_prop(buffer, offs, "cpu_cores_count",
                              dev->node_props.cpu_cores_count);
        sysfs_show_32bit_prop(buffer, offs, "simd_count",
-                             dev->gpu ? (dev->node_props.simd_count *
-                                         NUM_XCC(dev->gpu->xcc_mask)) : 0);
+                             dev->gpu ? dev->node_props.simd_count : 0);
        sysfs_show_32bit_prop(buffer, offs, "mem_banks_count",
                              dev->node_props.mem_banks_count);
        sysfs_show_32bit_prop(buffer, offs, "caches_count",
@@ -1597,14 +1596,17 @@ static int fill_in_l1_pcache(struct kfd_cache_properties **props_ext,
 static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
                                struct kfd_gpu_cache_info *pcache_info,
                                struct kfd_cu_info *cu_info,
-                               int cache_type, unsigned int cu_processor_id)
+                               int cache_type, unsigned int cu_processor_id,
+                               struct kfd_node *knode)
 {
        unsigned int cu_sibling_map_mask;
        int first_active_cu;
-       int i, j, k;
+       int i, j, k, xcc, start, end;
        struct kfd_cache_properties *pcache = NULL;
 
-       cu_sibling_map_mask = cu_info->cu_bitmap[0][0];
+       start = ffs(knode->xcc_mask) - 1;
+       end = start + NUM_XCC(knode->xcc_mask);
+       cu_sibling_map_mask = cu_info->cu_bitmap[start][0][0];
        cu_sibling_map_mask &=
                ((1 << pcache_info[cache_type].num_cu_shared) - 1);
        first_active_cu = ffs(cu_sibling_map_mask);
@@ -1639,16 +1641,18 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
                cu_sibling_map_mask = cu_sibling_map_mask >> (first_active_cu - 1);
                k = 0;
 
-               for (i = 0; i < cu_info->num_shader_engines; i++) {
-                       for (j = 0; j < cu_info->num_shader_arrays_per_engine; j++) {
-                               pcache->sibling_map[k] = (uint8_t)(cu_sibling_map_mask & 0xFF);
-                               pcache->sibling_map[k+1] = (uint8_t)((cu_sibling_map_mask >> 8) & 0xFF);
-                               pcache->sibling_map[k+2] = (uint8_t)((cu_sibling_map_mask >> 16) & 0xFF);
-                               pcache->sibling_map[k+3] = (uint8_t)((cu_sibling_map_mask >> 24) & 0xFF);
-                               k += 4;
-
-                               cu_sibling_map_mask = cu_info->cu_bitmap[i % 4][j + i / 4];
-                               cu_sibling_map_mask &= ((1 << pcache_info[cache_type].num_cu_shared) - 1);
+               for (xcc = start; xcc < end; xcc++) {
+                       for (i = 0; i < cu_info->num_shader_engines; i++) {
+                               for (j = 0; j < cu_info->num_shader_arrays_per_engine; j++) {
+                                       pcache->sibling_map[k] = (uint8_t)(cu_sibling_map_mask & 0xFF);
+                                       pcache->sibling_map[k+1] = (uint8_t)((cu_sibling_map_mask >> 8) & 0xFF);
+                                       pcache->sibling_map[k+2] = (uint8_t)((cu_sibling_map_mask >> 16) & 0xFF);
+                                       pcache->sibling_map[k+3] = (uint8_t)((cu_sibling_map_mask >> 24) & 0xFF);
+                                       k += 4;
+
+                                       cu_sibling_map_mask = cu_info->cu_bitmap[xcc][i % 4][j + i / 4];
+                                       cu_sibling_map_mask &= ((1 << pcache_info[cache_type].num_cu_shared) - 1);
+                               }
                        }
                }
                pcache->sibling_map_size = k;
@@ -1666,7 +1670,7 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
 static void kfd_fill_cache_non_crat_info(struct kfd_topology_device *dev, struct kfd_node *kdev)
 {
        struct kfd_gpu_cache_info *pcache_info = NULL;
-       int i, j, k;
+       int i, j, k, xcc, start, end;
        int ct = 0;
        unsigned int cu_processor_id;
        int ret;
@@ -1700,37 +1704,42 @@ static void kfd_fill_cache_non_crat_info(struct kfd_topology_device *dev, struct
         *                      then it will consider only one CU from
         *                      the shared unit
         */
+       start = ffs(kdev->xcc_mask) - 1;
+       end = start + NUM_XCC(kdev->xcc_mask);
+
        for (ct = 0; ct < num_of_cache_types; ct++) {
                cu_processor_id = gpu_processor_id;
                if (pcache_info[ct].cache_level == 1) {
-                       for (i = 0; i < pcu_info->num_shader_engines; i++) {
-                               for (j = 0; j < pcu_info->num_shader_arrays_per_engine; j++) {
-                                       for (k = 0; k < pcu_info->num_cu_per_sh; k += pcache_info[ct].num_cu_shared) {
+                       for (xcc = start; xcc < end; xcc++) {
+                               for (i = 0; i < pcu_info->num_shader_engines; i++) {
+                                       for (j = 0; j < pcu_info->num_shader_arrays_per_engine; j++) {
+                                               for (k = 0; k < pcu_info->num_cu_per_sh; k += pcache_info[ct].num_cu_shared) {
 
-                                               ret = fill_in_l1_pcache(&props_ext, pcache_info, pcu_info,
-                                                                               pcu_info->cu_bitmap[i % 4][j + i / 4], ct,
+                                                       ret = fill_in_l1_pcache(&props_ext, pcache_info, pcu_info,
+                                                                               pcu_info->cu_bitmap[xcc][i % 4][j + i / 4], ct,
                                                                                cu_processor_id, k);
 
-                                               if (ret < 0)
-                                                       break;
+                                                       if (ret < 0)
+                                                               break;
 
-                                               if (!ret) {
-                                                       num_of_entries++;
-                                                       list_add_tail(&props_ext->list, &dev->cache_props);
-                                               }
+                                                       if (!ret) {
+                                                               num_of_entries++;
+                                                               list_add_tail(&props_ext->list, &dev->cache_props);
+                                                       }
 
-                                               /* Move to next CU block */
-                                               num_cu_shared = ((k + pcache_info[ct].num_cu_shared) <=
-                                                       pcu_info->num_cu_per_sh) ?
-                                                       pcache_info[ct].num_cu_shared :
-                                                       (pcu_info->num_cu_per_sh - k);
-                                               cu_processor_id += num_cu_shared;
+                                                       /* Move to next CU block */
+                                                       num_cu_shared = ((k + pcache_info[ct].num_cu_shared) <=
+                                                               pcu_info->num_cu_per_sh) ?
+                                                               pcache_info[ct].num_cu_shared :
+                                                               (pcu_info->num_cu_per_sh - k);
+                                                       cu_processor_id += num_cu_shared;
+                                               }
                                        }
                                }
                        }
                } else {
                        ret = fill_in_l2_l3_pcache(&props_ext, pcache_info,
-                                                               pcu_info, ct, cu_processor_id);
+                                       pcu_info, ct, cu_processor_id, kdev);
 
                        if (ret < 0)
                                break;
index dea32a9e55060e8deb983e888290b19cdf58e2fd..27386ce9a021dad9a15fb7d9ac38deb32f36e8f3 100644 (file)
@@ -89,7 +89,7 @@ struct kfd_mem_properties {
        struct attribute        attr;
 };
 
-#define CACHE_SIBLINGMAP_SIZE 64
+#define CACHE_SIBLINGMAP_SIZE 128
 
 struct kfd_cache_properties {
        struct list_head        list;
index 88ba8b66de1f70d2ecc031d70e17cee564438dc9..c6fd34bab3585ad8c027f4b1bcc3af145bb379a9 100644 (file)
@@ -1274,11 +1274,15 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_
 
        pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
 
-       page_table_start.high_part = (u32)(adev->gmc.gart_start >> 44) & 0xF;
-       page_table_start.low_part = (u32)(adev->gmc.gart_start >> 12);
-       page_table_end.high_part = (u32)(adev->gmc.gart_end >> 44) & 0xF;
-       page_table_end.low_part = (u32)(adev->gmc.gart_end >> 12);
-       page_table_base.high_part = upper_32_bits(pt_base) & 0xF;
+       page_table_start.high_part = upper_32_bits(adev->gmc.gart_start >>
+                                                  AMDGPU_GPU_PAGE_SHIFT);
+       page_table_start.low_part = lower_32_bits(adev->gmc.gart_start >>
+                                                 AMDGPU_GPU_PAGE_SHIFT);
+       page_table_end.high_part = upper_32_bits(adev->gmc.gart_end >>
+                                                AMDGPU_GPU_PAGE_SHIFT);
+       page_table_end.low_part = lower_32_bits(adev->gmc.gart_end >>
+                                               AMDGPU_GPU_PAGE_SHIFT);
+       page_table_base.high_part = upper_32_bits(pt_base);
        page_table_base.low_part = lower_32_bits(pt_base);
 
        pa_config->system_aperture.start_addr = (uint64_t)logical_addr_low << 18;
@@ -1640,8 +1644,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
                }
                break;
        }
-       if (init_data.flags.gpu_vm_support)
-               init_data.flags.gpu_vm_support = amdgpu_sg_display_supported(adev);
+       if (init_data.flags.gpu_vm_support &&
+           (amdgpu_sg_display == 0))
+               init_data.flags.gpu_vm_support = false;
 
        if (init_data.flags.gpu_vm_support)
                adev->mode_info.gpu_vm_support = true;
@@ -2335,14 +2340,62 @@ static int dm_late_init(void *handle)
        return detect_mst_link_for_all_connectors(adev_to_drm(adev));
 }
 
+static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr)
+{
+       int ret;
+       u8 guid[16];
+       u64 tmp64;
+
+       mutex_lock(&mgr->lock);
+       if (!mgr->mst_primary)
+               goto out_fail;
+
+       if (drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd) < 0) {
+               drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n");
+               goto out_fail;
+       }
+
+       ret = drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL,
+                                DP_MST_EN |
+                                DP_UP_REQ_EN |
+                                DP_UPSTREAM_IS_SRC);
+       if (ret < 0) {
+               drm_dbg_kms(mgr->dev, "mst write failed - undocked during suspend?\n");
+               goto out_fail;
+       }
+
+       /* Some hubs forget their guids after they resume */
+       ret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
+       if (ret != 16) {
+               drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n");
+               goto out_fail;
+       }
+
+       if (memchr_inv(guid, 0, 16) == NULL) {
+               tmp64 = get_jiffies_64();
+               memcpy(&guid[0], &tmp64, sizeof(u64));
+               memcpy(&guid[8], &tmp64, sizeof(u64));
+
+               ret = drm_dp_dpcd_write(mgr->aux, DP_GUID, guid, 16);
+
+               if (ret != 16) {
+                       drm_dbg_kms(mgr->dev, "check mstb guid failed - undocked during suspend?\n");
+                       goto out_fail;
+               }
+       }
+
+       memcpy(mgr->mst_primary->guid, guid, 16);
+
+out_fail:
+       mutex_unlock(&mgr->lock);
+}
+
 static void s3_handle_mst(struct drm_device *dev, bool suspend)
 {
        struct amdgpu_dm_connector *aconnector;
        struct drm_connector *connector;
        struct drm_connector_list_iter iter;
        struct drm_dp_mst_topology_mgr *mgr;
-       int ret;
-       bool need_hotplug = false;
 
        drm_connector_list_iter_begin(dev, &iter);
        drm_for_each_connector_iter(connector, &iter) {
@@ -2364,18 +2417,15 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend)
                        if (!dp_is_lttpr_present(aconnector->dc_link))
                                try_to_configure_aux_timeout(aconnector->dc_link->ddc, LINK_AUX_DEFAULT_TIMEOUT_PERIOD);
 
-                       ret = drm_dp_mst_topology_mgr_resume(mgr, true);
-                       if (ret < 0) {
-                               dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
-                                       aconnector->dc_link);
-                               need_hotplug = true;
-                       }
+                       /* TODO: move resume_mst_branch_status() into drm mst resume again
+                        * once topology probing work is pulled out from mst resume into mst
+                        * resume 2nd step. mst resume 2nd step should be called after old
+                        * state getting restored (i.e. drm_atomic_helper_resume()).
+                        */
+                       resume_mst_branch_status(mgr);
                }
        }
        drm_connector_list_iter_end(&iter);
-
-       if (need_hotplug)
-               drm_kms_helper_hotplug_event(dev);
 }
 
 static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev)
@@ -2769,7 +2819,8 @@ static int dm_resume(void *handle)
        struct dm_atomic_state *dm_state = to_dm_atomic_state(dm->atomic_obj.state);
        enum dc_connection_type new_connection_type = dc_connection_none;
        struct dc_state *dc_state;
-       int i, r, j;
+       int i, r, j, ret;
+       bool need_hotplug = false;
 
        if (amdgpu_in_reset(adev)) {
                dc_state = dm->cached_dc_state;
@@ -2867,7 +2918,7 @@ static int dm_resume(void *handle)
                        continue;
 
                /*
-                * this is the case when traversing through already created
+                * this is the case when traversing through already created end sink
                 * MST connectors, should be skipped
                 */
                if (aconnector && aconnector->mst_root)
@@ -2927,6 +2978,27 @@ static int dm_resume(void *handle)
 
        dm->cached_state = NULL;
 
+       /* Do mst topology probing after resuming cached state*/
+       drm_connector_list_iter_begin(ddev, &iter);
+       drm_for_each_connector_iter(connector, &iter) {
+               aconnector = to_amdgpu_dm_connector(connector);
+               if (aconnector->dc_link->type != dc_connection_mst_branch ||
+                   aconnector->mst_root)
+                       continue;
+
+               ret = drm_dp_mst_topology_mgr_resume(&aconnector->mst_mgr, true);
+
+               if (ret < 0) {
+                       dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
+                                       aconnector->dc_link);
+                       need_hotplug = true;
+               }
+       }
+       drm_connector_list_iter_end(&iter);
+
+       if (need_hotplug)
+               drm_kms_helper_hotplug_event(ddev);
+
        amdgpu_dm_irq_resume_late(adev);
 
        amdgpu_dm_smu_write_watermarks_table(adev);
@@ -8073,7 +8145,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                bundle->surface_updates[planes_count].plane_info =
                        &bundle->plane_infos[planes_count];
 
-               if (acrtc_state->stream->link->psr_settings.psr_feature_enabled) {
+               if (acrtc_state->stream->link->psr_settings.psr_feature_enabled ||
+                   acrtc_state->stream->link->replay_settings.replay_feature_enabled) {
                        fill_dc_dirty_rects(plane, old_plane_state,
                                            new_plane_state, new_crtc_state,
                                            &bundle->flip_addrs[planes_count],
index a2d34be82613c5614f1b6cecb3f987121ae0afd0..9e4cc5eeda767e36bd591dff20adf2202dd93119 100644 (file)
@@ -620,7 +620,7 @@ struct amdgpu_hdmi_vsdb_info {
        unsigned int max_refresh_rate_hz;
 
        /**
-        * @replay mode: Replay supported
+        * @replay_mode: Replay supported
         */
        bool replay_mode;
 };
index 30c0644d4418fb418ebdbde8f49e503469125732..be5a6d008b290db14ba043feb2b7ad5c428d49df 100644 (file)
@@ -169,11 +169,23 @@ static void add_link_enc_assignment(
 /* Return first available DIG link encoder. */
 static enum engine_id find_first_avail_link_enc(
                const struct dc_context *ctx,
-               const struct dc_state *state)
+               const struct dc_state *state,
+               enum engine_id eng_id_requested)
 {
        enum engine_id eng_id = ENGINE_ID_UNKNOWN;
        int i;
 
+       if (eng_id_requested != ENGINE_ID_UNKNOWN) {
+
+               for (i = 0; i < ctx->dc->res_pool->res_cap->num_dig_link_enc; i++) {
+                       eng_id = state->res_ctx.link_enc_cfg_ctx.link_enc_avail[i];
+                       if (eng_id == eng_id_requested)
+                               return eng_id;
+               }
+       }
+
+       eng_id = ENGINE_ID_UNKNOWN;
+
        for (i = 0; i < ctx->dc->res_pool->res_cap->num_dig_link_enc; i++) {
                eng_id = state->res_ctx.link_enc_cfg_ctx.link_enc_avail[i];
                if (eng_id != ENGINE_ID_UNKNOWN)
@@ -287,7 +299,7 @@ void link_enc_cfg_link_encs_assign(
                struct dc_stream_state *streams[],
                uint8_t stream_count)
 {
-       enum engine_id eng_id = ENGINE_ID_UNKNOWN;
+       enum engine_id eng_id = ENGINE_ID_UNKNOWN, eng_id_req = ENGINE_ID_UNKNOWN;
        int i;
        int j;
 
@@ -377,8 +389,14 @@ void link_enc_cfg_link_encs_assign(
                 * assigned to that endpoint.
                 */
                link_enc = get_link_enc_used_by_link(state, stream->link);
-               if (link_enc == NULL)
-                       eng_id = find_first_avail_link_enc(stream->ctx, state);
+               if (link_enc == NULL) {
+
+                       if (stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA &&
+                                       stream->link->dpia_preferred_eng_id != ENGINE_ID_UNKNOWN)
+                               eng_id_req = stream->link->dpia_preferred_eng_id;
+
+                       eng_id = find_first_avail_link_enc(stream->ctx, state, eng_id_req);
+               }
                else
                        eng_id =  link_enc->preferred_engine;
 
@@ -402,7 +420,9 @@ void link_enc_cfg_link_encs_assign(
                        DC_LOG_DEBUG("%s: CUR %s(%d) - enc_id(%d)\n",
                                        __func__,
                                        assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ? "PHY" : "DPIA",
-                                       assignment.ep_id.link_id.enum_id - 1,
+                                       assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ?
+                                                       assignment.ep_id.link_id.enum_id :
+                                                       assignment.ep_id.link_id.enum_id - 1,
                                        assignment.eng_id);
        }
        for (i = 0; i < MAX_PIPES; i++) {
@@ -413,7 +433,9 @@ void link_enc_cfg_link_encs_assign(
                        DC_LOG_DEBUG("%s: NEW %s(%d) - enc_id(%d)\n",
                                        __func__,
                                        assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ? "PHY" : "DPIA",
-                                       assignment.ep_id.link_id.enum_id - 1,
+                                       assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ?
+                                                       assignment.ep_id.link_id.enum_id :
+                                                       assignment.ep_id.link_id.enum_id - 1,
                                        assignment.eng_id);
        }
 
@@ -478,7 +500,6 @@ struct dc_link *link_enc_cfg_get_link_using_link_enc(
        if (stream)
                link = stream->link;
 
-       // dm_output_to_console("%s: No link using DIG(%d).\n", __func__, eng_id);
        return link;
 }
 
index 0d0bef8eb331d8f35ca0978e0615e187a5198431..31e3183497a7f50a1e141286b1183f3ad76909a5 100644 (file)
@@ -1496,6 +1496,7 @@ struct dc_link {
         * object creation.
         */
        enum engine_id eng_id;
+       enum engine_id dpia_preferred_eng_id;
 
        bool test_pattern_enabled;
        enum dp_test_pattern current_test_pattern;
index ad967b58d7bec6ee727b6209767df3bd87c55300..478281f2a5ba7f2e2b8c93a0cee3bd2edac6e17d 100644 (file)
@@ -964,7 +964,9 @@ void dce110_edp_backlight_control(
                return;
        }
 
-       if (link->panel_cntl) {
+       if (link->panel_cntl && !(link->dpcd_sink_ext_caps.bits.oled ||
+               link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
+               link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)) {
                bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
 
                if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
index 1c1fb2fa082296908074f93b350d64259bf9f99f..004beed9bd444c7df896f07305726f2266fd652c 100644 (file)
@@ -1032,6 +1032,28 @@ static const struct dce_i2c_mask i2c_masks = {
                I2C_COMMON_MASK_SH_LIST_DCN30(_MASK)
 };
 
+/* ========================================================== */
+
+/*
+ * DPIA index | Preferred Encoder     |    Host Router
+ *   0        |      C                |       0
+ *   1        |      First Available  |       0
+ *   2        |      D                |       1
+ *   3        |      First Available  |       1
+ */
+/* ========================================================== */
+static const enum engine_id dpia_to_preferred_enc_id_table[] = {
+               ENGINE_ID_DIGC,
+               ENGINE_ID_DIGC,
+               ENGINE_ID_DIGD,
+               ENGINE_ID_DIGD
+};
+
+static enum engine_id dcn314_get_preferred_eng_id_dpia(unsigned int dpia_index)
+{
+       return dpia_to_preferred_enc_id_table[dpia_index];
+}
+
 static struct dce_i2c_hw *dcn31_i2c_hw_create(
        struct dc_context *ctx,
        uint32_t inst)
@@ -1785,6 +1807,7 @@ static struct resource_funcs dcn314_res_pool_funcs = {
        .update_bw_bounding_box = dcn314_update_bw_bounding_box,
        .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
        .get_panel_config_defaults = dcn314_get_panel_config_defaults,
+       .get_preferred_eng_id_dpia = dcn314_get_preferred_eng_id_dpia,
 };
 
 static struct clock_source *dcn30_clock_source_create(
index 027aec70c070f8d566986a3222117ae7e39acb3d..eaad1260bfd1808c40bea358ed410051ef5440d8 100644 (file)
@@ -65,6 +65,7 @@ struct resource_context;
 struct clk_bw_params;
 
 struct resource_funcs {
+       enum engine_id (*get_preferred_eng_id_dpia)(unsigned int dpia_index);
        void (*destroy)(struct resource_pool **pool);
        void (*link_init)(struct dc_link *link);
        struct panel_cntl*(*panel_cntl_create)(
index 195ca9e52edaaba87a8bd679b55eb643abc044eb..0895742a3102418152eff96f2939d29d116652c0 100644 (file)
@@ -791,6 +791,10 @@ static bool construct_dpia(struct dc_link *link,
        /* Set dpia port index : 0 to number of dpia ports */
        link->ddc_hw_inst = init_params->connector_index;
 
+       // Assign Dpia preferred eng_id
+       if (link->dc->res_pool->funcs->get_preferred_eng_id_dpia)
+               link->dpia_preferred_eng_id = link->dc->res_pool->funcs->get_preferred_eng_id_dpia(link->ddc_hw_inst);
+
        /* TODO: Create link encoder */
 
        link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED;
index 8433f99f66679dbcee25bb7567d993fcb8673294..3b5a56585c4b7283017651aad21ed1c0565ad37f 100644 (file)
 #include <linux/types.h>
 #include <linux/bitmap.h>
 #include <linux/dma-fence.h>
+#include "amdgpu_irq.h"
+#include "amdgpu_gfx.h"
 
 struct pci_dev;
 struct amdgpu_device;
 
-#define KGD_MAX_QUEUES 128
-
 struct kfd_dev;
 struct kgd_mem;
 
@@ -68,7 +68,7 @@ struct kfd_cu_info {
        uint32_t wave_front_size;
        uint32_t max_scratch_slots_per_cu;
        uint32_t lds_size;
-       uint32_t cu_bitmap[4][4];
+       uint32_t cu_bitmap[AMDGPU_MAX_GC_INSTANCES][4][4];
 };
 
 /* For getting GPU local memory information from KGD */
@@ -326,8 +326,7 @@ struct kfd2kgd_calls {
                        uint32_t wait_times,
                        uint32_t grace_period,
                        uint32_t *reg_offset,
-                       uint32_t *reg_data,
-                       uint32_t inst);
+                       uint32_t *reg_data);
        void (*get_cu_occupancy)(struct amdgpu_device *adev, int pasid,
                        int *wave_cnt, int *max_waves_per_cu, uint32_t inst);
        void (*program_trap_handler_settings)(struct amdgpu_device *adev,
index 199a673b81201d7ad6261867bb150c5564d13958..de80e191a92c4946e3571da69268ac874e982f10 100644 (file)
@@ -336,7 +336,7 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu)
 
        /* Store one-time values in driver PPTable */
        if (!pptable->Init) {
-               while (retry--) {
+               while (--retry) {
                        ret = smu_v13_0_6_get_metrics_table(smu, NULL, true);
                        if (ret)
                                return ret;
index bf8371dc2a612111a9b2aaa40e06d3f063ba6120..c44d5bcf12847b7e130fc2ed4adf708dd55deebd 100644 (file)
@@ -2203,6 +2203,7 @@ static int drm_mode_create_colorspace_property(struct drm_connector *connector,
 /**
  * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
  * @connector: connector to create the Colorspace property on.
+ * @supported_colorspaces: bitmap of supported color spaces
  *
  * Called by a driver the first time it's needed, must be attached to desired
  * HDMI connectors.
@@ -2227,6 +2228,7 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property);
 /**
  * drm_mode_create_dp_colorspace_property - create dp colorspace property
  * @connector: connector to create the Colorspace property on.
+ * @supported_colorspaces: bitmap of supported color spaces
  *
  * Called by a driver the first time it's needed, must be attached to desired
  * DP connectors.
index ff69cf0fb42aab8e23ea128c81feef2883d95947..5d2809de4517cadca632e60834b52852d67a7dcd 100644 (file)
@@ -56,7 +56,7 @@ static void drm_exec_unlock_all(struct drm_exec *exec)
        struct drm_gem_object *obj;
        unsigned long index;
 
-       drm_exec_for_each_locked_object(exec, index, obj) {
+       drm_exec_for_each_locked_object_reverse(exec, index, obj) {
                dma_resv_unlock(obj->resv);
                drm_gem_object_put(obj);
        }
index 858c959f7babfffbfae06f10057f6f463a9e4ae1..f735b035436c02f0aa5a89916f6d3731752ba0a1 100644 (file)
@@ -3540,6 +3540,27 @@ enum aux_ch intel_bios_dp_aux_ch(const struct intel_bios_encoder_data *devdata)
        return map_aux_ch(devdata->i915, devdata->child.aux_channel);
 }
 
+bool intel_bios_dp_has_shared_aux_ch(const struct intel_bios_encoder_data *devdata)
+{
+       struct drm_i915_private *i915;
+       u8 aux_channel;
+       int count = 0;
+
+       if (!devdata || !devdata->child.aux_channel)
+               return false;
+
+       i915 = devdata->i915;
+       aux_channel = devdata->child.aux_channel;
+
+       list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
+               if (intel_bios_encoder_supports_dp(devdata) &&
+                   aux_channel == devdata->child.aux_channel)
+                       count++;
+       }
+
+       return count > 1;
+}
+
 int intel_bios_dp_boost_level(const struct intel_bios_encoder_data *devdata)
 {
        if (!devdata || devdata->i915->display.vbt.version < 196 || !devdata->child.iboost)
index 9680e3e92bb516df9d42f9b5d1469010dfa1c65e..49e24b7cf6753ad2dc409ab83fc6567743170832 100644 (file)
@@ -273,6 +273,7 @@ enum aux_ch intel_bios_dp_aux_ch(const struct intel_bios_encoder_data *devdata);
 int intel_bios_dp_boost_level(const struct intel_bios_encoder_data *devdata);
 int intel_bios_dp_max_lane_count(const struct intel_bios_encoder_data *devdata);
 int intel_bios_dp_max_link_rate(const struct intel_bios_encoder_data *devdata);
+bool intel_bios_dp_has_shared_aux_ch(const struct intel_bios_encoder_data *devdata);
 int intel_bios_hdmi_boost_level(const struct intel_bios_encoder_data *devdata);
 int intel_bios_hdmi_ddc_pin(const struct intel_bios_encoder_data *devdata);
 int intel_bios_hdmi_level_shift(const struct intel_bios_encoder_data *devdata);
index 12bd2f322e6279a7b85f2ef29a8474903f18ec9d..e0e4cb529284611483afb713454bb08f617a6d40 100644 (file)
@@ -5512,8 +5512,13 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
        /*
         * VBT and straps are liars. Also check HPD as that seems
         * to be the most reliable piece of information available.
+        *
+        * ... expect on devices that forgot to hook HPD up for eDP
+        * (eg. Acer Chromebook C710), so we'll check it only if multiple
+        * ports are attempting to use the same AUX CH, according to VBT.
         */
-       if (!intel_digital_port_connected(encoder)) {
+       if (intel_bios_dp_has_shared_aux_ch(encoder->devdata) &&
+           !intel_digital_port_connected(encoder)) {
                /*
                 * If this fails, presume the DPCD answer came
                 * from some other port using the same AUX CH.
index c87a57c9c592b41cc7a1a44b23bbc8da23817862..22dd8b4456855f9b78fd3c3d32f9978be4a4ed2d 100644 (file)
@@ -123,7 +123,7 @@ int radeon_sa_bo_new(struct radeon_sa_manager *sa_manager,
                     unsigned int size, unsigned int align)
 {
        struct drm_suballoc *sa = drm_suballoc_new(&sa_manager->base, size,
-                                                  GFP_KERNEL, true, align);
+                                                  GFP_KERNEL, false, align);
 
        if (IS_ERR(sa)) {
                *sa_bo = NULL;
index c5bb683e440c5f5d8ee1ea71cf301de20e3f28c8..0187539ff5eaaa5f5c59096ed427de7f268f29e5 100644 (file)
@@ -70,10 +70,10 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)");
 #define READ_STATUS_SIZE               13
 #define MISC_VALUE_SIZE                        4
 
-#define CMD_TIMEOUT                    msecs_to_jiffies(200)
-#define DATA_TIMEOUT                   msecs_to_jiffies(1000)
-#define IDLE_TIMEOUT                   msecs_to_jiffies(2000)
-#define FIRST_FRAME_TIMEOUT            msecs_to_jiffies(2000)
+#define CMD_TIMEOUT                    200
+#define DATA_TIMEOUT                   1000
+#define IDLE_TIMEOUT                   2000
+#define FIRST_FRAME_TIMEOUT            2000
 
 #define MISC_REQ_GET_SET_ECO_A         0xff
 #define MISC_REQ_GET_SET_ECO_B         0x35
@@ -389,7 +389,7 @@ static void gm12u320_fb_update_work(struct work_struct *work)
         * switches back to showing its logo.
         */
        queue_delayed_work(system_long_wq, &gm12u320->fb_update.work,
-                          IDLE_TIMEOUT);
+                          msecs_to_jiffies(IDLE_TIMEOUT));
 
        return;
 err:
index d5d4f642d3678077c7053dad9c5026e04b9f2055..3c99fb8b54e2df54ab26f8b6b15b4fd30d41183f 100644 (file)
@@ -408,15 +408,10 @@ void vkms_set_composer(struct vkms_output *out, bool enabled)
        if (enabled)
                drm_crtc_vblank_get(&out->crtc);
 
-       mutex_lock(&out->enabled_lock);
+       spin_lock_irq(&out->lock);
        old_enabled = out->composer_enabled;
        out->composer_enabled = enabled;
-
-       /* the composition wasn't enabled, so unlock the lock to make sure the lock
-        * will be balanced even if we have a failed commit
-        */
-       if (!out->composer_enabled)
-               mutex_unlock(&out->enabled_lock);
+       spin_unlock_irq(&out->lock);
 
        if (old_enabled)
                drm_crtc_vblank_put(&out->crtc);
index 3c5ebf106b66de958d78518ffecb7e6a343d9fba..61e500b8c9da2397b17fe07a98d469e25bc6d846 100644 (file)
@@ -16,7 +16,7 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
        struct drm_crtc *crtc = &output->crtc;
        struct vkms_crtc_state *state;
        u64 ret_overrun;
-       bool ret, fence_cookie, composer_enabled;
+       bool ret, fence_cookie;
 
        fence_cookie = dma_fence_begin_signalling();
 
@@ -25,15 +25,15 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
        if (ret_overrun != 1)
                pr_warn("%s: vblank timer overrun\n", __func__);
 
+       spin_lock(&output->lock);
        ret = drm_crtc_handle_vblank(crtc);
        if (!ret)
                DRM_ERROR("vkms failure on handling vblank");
 
        state = output->composer_state;
-       composer_enabled = output->composer_enabled;
-       mutex_unlock(&output->enabled_lock);
+       spin_unlock(&output->lock);
 
-       if (state && composer_enabled) {
+       if (state && output->composer_enabled) {
                u64 frame = drm_crtc_accurate_vblank_count(crtc);
 
                /* update frame_start only if a queued vkms_composer_worker()
@@ -295,7 +295,6 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 
        spin_lock_init(&vkms_out->lock);
        spin_lock_init(&vkms_out->composer_lock);
-       mutex_init(&vkms_out->enabled_lock);
 
        vkms_out->composer_workq = alloc_ordered_workqueue("vkms_composer", 0);
        if (!vkms_out->composer_workq)
index c7ae6c2ba1df08fe903a8ff8be3782918e70efbb..8f5710debb1eb708fb9edfaf594c10382a790e66 100644 (file)
@@ -108,10 +108,8 @@ struct vkms_output {
        struct workqueue_struct *composer_workq;
        /* protects concurrent access to composer */
        spinlock_t lock;
-       /* guarantees that if the composer is enabled, a job will be queued */
-       struct mutex enabled_lock;
 
-       /* protected by @enabled_lock */
+       /* protected by @lock */
        bool composer_enabled;
        struct vkms_crtc_state *composer_state;
 
index 02a71244fc3b765d77efedcc56cbc876afdfc864..b5b81bd83bb1573d0434eeb2a6cdf54898e4f227 100644 (file)
@@ -1910,6 +1910,10 @@ static umode_t nct6775_in_is_visible(struct kobject *kobj,
        struct device *dev = kobj_to_dev(kobj);
        struct nct6775_data *data = dev_get_drvdata(dev);
        int in = index / 5;     /* voltage index */
+       int nr = index % 5;     /* attribute index */
+
+       if (nr == 1 && data->ALARM_BITS[in] == -1)
+               return 0;
 
        if (!(data->have_in & BIT(in)))
                return 0;
index c6d1a345ea6d8aee2eadc886d94287783f5c668c..9388823bb0bb960c52f0534bfad732a60778a170 100644 (file)
@@ -72,7 +72,7 @@ config I2C_MUX
 source "drivers/i2c/muxes/Kconfig"
 
 config I2C_ATR
-       tristate "I2C Address Translator (ATR) support"
+       tristate "I2C Address Translator (ATR) support" if COMPILE_TEST
        help
          Enable support for I2C Address Translator (ATR) chips.
 
index 169607e803318292b4fc071009dda41cb75e19f3..6644eebedaf3b7f4727fd88da340bd3a72314ac3 100644 (file)
@@ -1384,10 +1384,10 @@ config I2C_ICY
 
 config I2C_MLXCPLD
        tristate "Mellanox I2C driver"
-       depends on X86_64 || ARM64 || COMPILE_TEST
+       depends on X86_64 || (ARM64 && ACPI) || COMPILE_TEST
        help
          This exposes the Mellanox platform I2C busses to the linux I2C layer
-         for X86 based systems.
+         for X86 and ARM64/ACPI based systems.
          Controller is implemented as CPLD logic.
 
          This driver can also be built as a module. If so, the module will be
index 2e5acfeb76c818a3058ffbd75d59930b35e17df8..5a416b39b8183628bb71890a847b1ed3d799e806 100644 (file)
@@ -698,13 +698,16 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
 
        if (time_left == 0) {
                /*
-                * If timed out and bus is still busy in a multi master
-                * environment, attempt recovery at here.
+                * In a multi-master setup, if a timeout occurs, attempt
+                * recovery. But if the bus is idle, we still need to reset the
+                * i2c controller to clear the remaining interrupts.
                 */
                if (bus->multi_master &&
                    (readl(bus->base + ASPEED_I2C_CMD_REG) &
                     ASPEED_I2CD_BUS_BUSY_STS))
                        aspeed_i2c_recover_bus(bus);
+               else
+                       aspeed_i2c_reset(bus);
 
                /*
                 * If timed out and the state is still pending, drop the pending
index 9849f450257002e3ce41d5bbac6432646377c4ba..de3f58b60dce5d465f75e3bc509ea449f0c927d0 100644 (file)
@@ -182,6 +182,7 @@ enum cdns_i2c_slave_state {
  * @reset:             Reset control for the device
  * @quirks:            flag for broken hold bit usage in r1p10
  * @ctrl_reg:          Cached value of the control register.
+ * @rinfo:             I2C GPIO recovery information
  * @ctrl_reg_diva_divb: value of fields DIV_A and DIV_B from CR register
  * @slave:             Registered slave instance.
  * @dev_mode:          I2C operating role(master/slave).
index 0d93661f88d306e0d0aa3a1ac085880a8b63d9d6..095b9b49aa8250a1f56c531883cce5f6e8a24727 100644 (file)
@@ -214,6 +214,7 @@ struct dm_table {
 
        /* a list of devices used by this table */
        struct list_head devices;
+       struct rw_semaphore devices_lock;
 
        /* events get handed up using this callback */
        void (*event_fn)(void *data);
index f5ed729a8e0cd300cd8acfb6864ae8c289da00ad..21ebb6c39394b6298ac748ffb32d11d00ad218af 100644 (file)
@@ -1630,6 +1630,8 @@ static void retrieve_deps(struct dm_table *table,
        struct dm_dev_internal *dd;
        struct dm_target_deps *deps;
 
+       down_read(&table->devices_lock);
+
        deps = get_result_buffer(param, param_size, &len);
 
        /*
@@ -1644,7 +1646,7 @@ static void retrieve_deps(struct dm_table *table,
        needed = struct_size(deps, dev, count);
        if (len < needed) {
                param->flags |= DM_BUFFER_FULL_FLAG;
-               return;
+               goto out;
        }
 
        /*
@@ -1656,6 +1658,9 @@ static void retrieve_deps(struct dm_table *table,
                deps->dev[count++] = huge_encode_dev(dd->dm_dev->bdev->bd_dev);
 
        param->data_size = param->data_start + needed;
+
+out:
+       up_read(&table->devices_lock);
 }
 
 static int table_deps(struct file *filp, struct dm_ioctl *param, size_t param_size)
index 7d208b2b1a192d88eaaec34d5247d8f7ef6273e8..37b48f63ae6a5e40b02234f214eaff487ca35e12 100644 (file)
@@ -135,6 +135,7 @@ int dm_table_create(struct dm_table **result, blk_mode_t mode,
                return -ENOMEM;
 
        INIT_LIST_HEAD(&t->devices);
+       init_rwsem(&t->devices_lock);
 
        if (!num_targets)
                num_targets = KEYS_PER_NODE;
@@ -359,16 +360,20 @@ int __ref dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode,
        if (dev == disk_devt(t->md->disk))
                return -EINVAL;
 
+       down_write(&t->devices_lock);
+
        dd = find_device(&t->devices, dev);
        if (!dd) {
                dd = kmalloc(sizeof(*dd), GFP_KERNEL);
-               if (!dd)
-                       return -ENOMEM;
+               if (!dd) {
+                       r = -ENOMEM;
+                       goto unlock_ret_r;
+               }
 
                r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev);
                if (r) {
                        kfree(dd);
-                       return r;
+                       goto unlock_ret_r;
                }
 
                refcount_set(&dd->count, 1);
@@ -378,12 +383,17 @@ int __ref dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode,
        } else if (dd->dm_dev->mode != (mode | dd->dm_dev->mode)) {
                r = upgrade_mode(dd, mode, t->md);
                if (r)
-                       return r;
+                       goto unlock_ret_r;
        }
        refcount_inc(&dd->count);
 out:
+       up_write(&t->devices_lock);
        *result = dd->dm_dev;
        return 0;
+
+unlock_ret_r:
+       up_write(&t->devices_lock);
+       return r;
 }
 EXPORT_SYMBOL(dm_get_device);
 
@@ -419,9 +429,12 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
 void dm_put_device(struct dm_target *ti, struct dm_dev *d)
 {
        int found = 0;
-       struct list_head *devices = &ti->table->devices;
+       struct dm_table *t = ti->table;
+       struct list_head *devices = &t->devices;
        struct dm_dev_internal *dd;
 
+       down_write(&t->devices_lock);
+
        list_for_each_entry(dd, devices, list) {
                if (dd->dm_dev == d) {
                        found = 1;
@@ -430,14 +443,17 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d)
        }
        if (!found) {
                DMERR("%s: device %s not in table devices list",
-                     dm_device_name(ti->table->md), d->name);
-               return;
+                     dm_device_name(t->md), d->name);
+               goto unlock_ret;
        }
        if (refcount_dec_and_test(&dd->count)) {
-               dm_put_table_device(ti->table->md, d);
+               dm_put_table_device(t->md, d);
                list_del(&dd->list);
                kfree(dd);
        }
+
+unlock_ret:
+       up_write(&t->devices_lock);
 }
 EXPORT_SYMBOL(dm_put_device);
 
index f0f118ab20fa26371c9bd5395d3763fa34c7ff34..64a1f306c96c11eea2ac754334646dcb7c4e8586 100644 (file)
@@ -715,24 +715,6 @@ static void dm_put_live_table_fast(struct mapped_device *md) __releases(RCU)
        rcu_read_unlock();
 }
 
-static inline struct dm_table *dm_get_live_table_bio(struct mapped_device *md,
-                                       int *srcu_idx, blk_opf_t bio_opf)
-{
-       if (bio_opf & REQ_NOWAIT)
-               return dm_get_live_table_fast(md);
-       else
-               return dm_get_live_table(md, srcu_idx);
-}
-
-static inline void dm_put_live_table_bio(struct mapped_device *md, int srcu_idx,
-                                        blk_opf_t bio_opf)
-{
-       if (bio_opf & REQ_NOWAIT)
-               dm_put_live_table_fast(md);
-       else
-               dm_put_live_table(md, srcu_idx);
-}
-
 static char *_dm_claim_ptr = "I belong to device-mapper";
 
 /*
@@ -1833,9 +1815,8 @@ static void dm_submit_bio(struct bio *bio)
        struct mapped_device *md = bio->bi_bdev->bd_disk->private_data;
        int srcu_idx;
        struct dm_table *map;
-       blk_opf_t bio_opf = bio->bi_opf;
 
-       map = dm_get_live_table_bio(md, &srcu_idx, bio_opf);
+       map = dm_get_live_table(md, &srcu_idx);
 
        /* If suspended, or map not yet available, queue this IO for later */
        if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) ||
@@ -1851,7 +1832,7 @@ static void dm_submit_bio(struct bio *bio)
 
        dm_split_and_process_bio(md, map, bio);
 out:
-       dm_put_live_table_bio(md, srcu_idx, bio_opf);
+       dm_put_live_table(md, srcu_idx);
 }
 
 static bool dm_poll_dm_io(struct dm_io *io, struct io_comp_batch *iob,
index 0fe7ab6e8ab9fef50e67d63a563ef7f692c9fe63..a104a025084dc726056c42b0b1a0dd37ea774803 100644 (file)
@@ -798,14 +798,14 @@ void mddev_unlock(struct mddev *mddev)
        } else
                mutex_unlock(&mddev->reconfig_mutex);
 
+       md_wakeup_thread(mddev->thread);
+       wake_up(&mddev->sb_wait);
+
        list_for_each_entry_safe(rdev, tmp, &delete, same_set) {
                list_del_init(&rdev->same_set);
                kobject_del(&rdev->kobj);
                export_rdev(rdev, mddev);
        }
-
-       md_wakeup_thread(mddev->thread);
-       wake_up(&mddev->sb_wait);
 }
 EXPORT_SYMBOL_GPL(mddev_unlock);
 
@@ -2452,7 +2452,8 @@ static void export_rdev(struct md_rdev *rdev, struct mddev *mddev)
        if (test_bit(AutoDetected, &rdev->flags))
                md_autodetect_dev(rdev->bdev->bd_dev);
 #endif
-       blkdev_put(rdev->bdev, mddev->external ? &claim_rdev : rdev);
+       blkdev_put(rdev->bdev,
+                  test_bit(Holder, &rdev->flags) ? rdev : &claim_rdev);
        rdev->bdev = NULL;
        kobject_put(&rdev->kobj);
 }
@@ -3632,6 +3633,7 @@ EXPORT_SYMBOL_GPL(md_rdev_init);
 static struct md_rdev *md_import_device(dev_t newdev, int super_format, int super_minor)
 {
        struct md_rdev *rdev;
+       struct md_rdev *holder;
        sector_t size;
        int err;
 
@@ -3646,8 +3648,15 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
        if (err)
                goto out_clear_rdev;
 
+       if (super_format == -2) {
+               holder = &claim_rdev;
+       } else {
+               holder = rdev;
+               set_bit(Holder, &rdev->flags);
+       }
+
        rdev->bdev = blkdev_get_by_dev(newdev, BLK_OPEN_READ | BLK_OPEN_WRITE,
-                       super_format == -2 ? &claim_rdev : rdev, NULL);
+                                      holder, NULL);
        if (IS_ERR(rdev->bdev)) {
                pr_warn("md: could not open device unknown-block(%u,%u).\n",
                        MAJOR(newdev), MINOR(newdev));
@@ -3684,7 +3693,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
        return rdev;
 
 out_blkdev_put:
-       blkdev_put(rdev->bdev, super_format == -2 ? &claim_rdev : rdev);
+       blkdev_put(rdev->bdev, holder);
 out_clear_rdev:
        md_rdev_clear(rdev);
 out_free_rdev:
@@ -8256,7 +8265,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
        spin_unlock(&all_mddevs_lock);
 
        if (to_put)
-               mddev_put(mddev);
+               mddev_put(to_put);
        return next_mddev;
 
 }
index 9bcb77bca963922193b6d04e4a9b134ee7cd5ce7..7c9c13abd7cac00e36b5b2b44784735a645afeca 100644 (file)
@@ -211,6 +211,9 @@ enum flag_bits {
                                 * check if there is collision between raid1
                                 * serial bios.
                                 */
+       Holder,                 /* rdev is used as holder while opening
+                                * underlying disk exclusively.
+                                */
 };
 
 static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
index 4b30a174216232564cd88781d603d6ac5d7e5c95..2aabac773fe72aa0db6bb6344e128b3d3dd08460 100644 (file)
@@ -1837,12 +1837,11 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
        struct r1conf *conf = mddev->private;
        int err = 0;
        int number = rdev->raid_disk;
+       struct raid1_info *p = conf->mirrors + number;
 
        if (unlikely(number >= conf->raid_disks))
                goto abort;
 
-       struct raid1_info *p = conf->mirrors + number;
-
        if (rdev != p->rdev)
                p = conf->mirrors + conf->raid_disks + number;
 
index 0f430ddc1f6704e96dd42357eaf77f03be19793f..fd87747be9b177c07c25048a62fbbded363fab5e 100644 (file)
  * different type underlying the specified range of virtual addresses.
  * When the function isn't able to map a single page, it returns error.
  *
+ * Note that get_vaddr_frames() cannot follow VM_IO mappings. It used
+ * to be able to do that, but that could (racily) return non-refcounted
+ * pfns.
+ *
  * This function takes care of grabbing mmap_lock as necessary.
  */
 int get_vaddr_frames(unsigned long start, unsigned int nr_frames, bool write,
@@ -59,8 +63,6 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, bool write,
        if (likely(ret > 0))
                return ret;
 
-       /* This used to (racily) return non-refcounted pfns. Let people know */
-       WARN_ONCE(1, "get_vaddr_frames() cannot follow VM_IO mapping");
        vec->nr_frames = 0;
        return ret ? ret : -EFAULT;
 }
index a1136fdfbed2d4b16f858dae07d5fa1db620b2b1..ec53abe2e84e53ef2e24a9760f10f94836340f67 100644 (file)
@@ -691,12 +691,12 @@ static int imx219_init_cfg(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *format;
        struct v4l2_rect *crop;
 
-       /* Initialize try_fmt */
+       /* Initialize the format. */
        format = v4l2_subdev_get_pad_format(sd, state, 0);
        imx219_update_pad_format(imx219, &supported_modes[0], format,
                                 MEDIA_BUS_FMT_SRGGB10_1X10);
 
-       /* Initialize crop rectangle. */
+       /* Initialize the crop rectangle. */
        crop = v4l2_subdev_get_pad_crop(sd, state, 0);
        crop->top = IMX219_PIXEL_ARRAY_TOP;
        crop->left = IMX219_PIXEL_ARRAY_LEFT;
@@ -750,6 +750,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
        const struct imx219_mode *mode;
        int exposure_max, exposure_def, hblank;
        struct v4l2_mbus_framefmt *format;
+       struct v4l2_rect *crop;
 
        mode = v4l2_find_nearest_size(supported_modes,
                                      ARRAY_SIZE(supported_modes),
@@ -757,10 +758,12 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
                                      fmt->format.width, fmt->format.height);
 
        imx219_update_pad_format(imx219, mode, &fmt->format, fmt->format.code);
+
        format = v4l2_subdev_get_pad_format(sd, sd_state, 0);
+       crop = v4l2_subdev_get_pad_crop(sd, sd_state, 0);
 
-       if (imx219->mode == mode && format->code == fmt->format.code)
-               return 0;
+       *format = fmt->format;
+       *crop = mode->crop;
 
        if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
                imx219->mode = mode;
@@ -788,8 +791,6 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
                                         hblank);
        }
 
-       *format = fmt->format;
-
        return 0;
 }
 
index 20e7c7cf5eeb953d60babada315c2e020acf7d37..be84ff1e2b170562226404ded0c33f3064a1cad5 100644 (file)
@@ -1110,7 +1110,6 @@ err_async:
 
 static void max9286_v4l2_unregister(struct max9286_priv *priv)
 {
-       fwnode_handle_put(priv->sd.fwnode);
        v4l2_ctrl_handler_free(&priv->ctrls);
        v4l2_async_unregister_subdev(&priv->sd);
        max9286_v4l2_notifier_unregister(priv);
index a36a709243fdbd4390ee8d53cc20fa70d1d4fbfc..3e22df36354fdbd03e828d61d652903f854ff098 100644 (file)
@@ -608,7 +608,6 @@ static void rdacm21_remove(struct i2c_client *client)
        v4l2_async_unregister_subdev(&dev->sd);
        v4l2_ctrl_handler_free(&dev->ctrls);
        i2c_unregister_device(dev->isp);
-       fwnode_handle_put(dev->sd.fwnode);
 }
 
 static const struct of_device_id rdacm21_of_ids[] = {
index 436baf6c8b089d43efac8b4eda44dd9c22620717..241a696e374a922b6f8aa058150e75c3e42a11b7 100644 (file)
@@ -68,9 +68,7 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
        sg = sglist;
        for (line = 0; line < store_lines; line++) {
                if ((line >= (store_lines - VCR_HACK_LINES)) &&
-                   (btv->opt_vcr_hack ||
-                   (V4L2_FIELD_HAS_BOTH(btv->field) ||
-                    btv->field == V4L2_FIELD_ALTERNATE)))
+                   btv->opt_vcr_hack)
                        continue;
                while (offset && offset >= sg_dma_len(sg)) {
                        offset -= sg_dma_len(sg);
index 1ef1c4e3750d7033ca753ef71f4c01be8817af11..212753450576ae7ed88ae53558a36e979c2b5a01 100644 (file)
@@ -3,7 +3,10 @@
 
 config INTEL_VSC
        tristate "Intel Visual Sensing Controller"
-       depends on INTEL_MEI && ACPI
+       depends on INTEL_MEI && ACPI && VIDEO_DEV
+       select MEDIA_CONTROLLER
+       select VIDEO_V4L2_SUBDEV_API
+       select V4L2_ASYNC
        help
          This adds support for Intel Visual Sensing Controller (IVSC).
 
index ec1a16734a280dce566149664354b41bd34cad81..d6499ffe30e8b6a3f46ec3266de4c8d598cfdf82 100644 (file)
@@ -7,7 +7,7 @@ config VIDEO_CAFE_CCIC
        depends on V4L_PLATFORM_DRIVERS
        depends on PCI && I2C && VIDEO_DEV
        depends on COMMON_CLK
-       select VIDEO_OV7670
+       select VIDEO_OV7670 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
        select VIDEOBUF2_VMALLOC
        select VIDEOBUF2_DMA_CONTIG
        select VIDEOBUF2_DMA_SG
@@ -22,7 +22,7 @@ config VIDEO_MMP_CAMERA
        depends on I2C && VIDEO_DEV
        depends on ARCH_MMP || COMPILE_TEST
        depends on COMMON_CLK
-       select VIDEO_OV7670
+       select VIDEO_OV7670 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
        select I2C_GPIO
        select VIDEOBUF2_VMALLOC
        select VIDEOBUF2_DMA_CONTIG
index 16f19a6401301e01e879af3baca3fb59672ac536..5f93712bf485408cb3a7d174b4ddb44b65250ff4 100644 (file)
@@ -1490,7 +1490,6 @@ err_cleanup:
        v4l2_async_unregister_subdev(&csis->sd);
 err_disable_clock:
        mipi_csis_clk_disable(csis);
-       fwnode_handle_put(csis->sd.fwnode);
 
        return ret;
 }
@@ -1510,7 +1509,6 @@ static void mipi_csis_remove(struct platform_device *pdev)
        mipi_csis_clk_disable(csis);
        v4l2_subdev_cleanup(&csis->sd);
        media_entity_cleanup(&csis->sd.entity);
-       fwnode_handle_put(csis->sd.fwnode);
        pm_runtime_set_suspended(&pdev->dev);
 }
 
index 8926eb0803b27a0a333da2b9a6b58246092b4d5c..6e603c0382487862cf5a76e59b0dce8ed2c29896 100644 (file)
@@ -7,7 +7,7 @@ config VIDEO_VIA_CAMERA
        depends on V4L_PLATFORM_DRIVERS
        depends on FB_VIA && VIDEO_DEV
        select VIDEOBUF2_DMA_SG
-       select VIDEO_OV7670
+       select VIDEO_OV7670 if VIDEO_CAMERA_SENSOR
        help
           Driver support for the integrated camera controller in VIA
           Chrome9 chipsets.  Currently only tested on OLPC xo-1.5 systems
index b3c472b8c5a960aa81cfced5d245436d4f99364e..cb61fd6cc6c617dc36ed8f305b02a851ee8fa76f 100644 (file)
@@ -12,8 +12,8 @@ config VIDEO_EM28XX_V4L2
        select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_TVP5150 if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_MSP3400 if MEDIA_SUBDRV_AUTOSELECT
-       select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
-       select VIDEO_OV2640 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
+       select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
+       select VIDEO_OV2640 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
        help
          This is a video4linux driver for Empia 28xx based TV cards.
 
index 4ff79940ad8d46664b252dc75b2b3ab792eb65e0..b2a15d9fb1f33cc7d302f3f99b30fc6921007098 100644 (file)
@@ -12,8 +12,8 @@ config VIDEO_GO7007
        select VIDEO_TW2804 if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_TW9903 if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_TW9906 if MEDIA_SUBDRV_AUTOSELECT
-       select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
        select VIDEO_UDA1342 if MEDIA_SUBDRV_AUTOSELECT
+       select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
        help
          This is a video4linux driver for the WIS GO7007 MPEG
          encoder chip.
index 5e9d3da862dd86ac84634ef8664c69866557d990..e59a463c27618ebbce7618b754c56bb41be2db3b 100644 (file)
@@ -1402,6 +1402,9 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
        query_menu->id = id;
        query_menu->index = index;
 
+       if (index >= BITS_PER_TYPE(mapping->menu_mask))
+               return -EINVAL;
+
        ret = mutex_lock_interruptible(&chain->ctrl_mutex);
        if (ret < 0)
                return -ERESTARTSYS;
index 52a99d8bada076620312683ddeaf0f44e62db1fc..ab434a77b059a5adda955e319900b80a19298851 100644 (file)
@@ -2958,14 +2958,16 @@ static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip)
                 * from the wrong location resulting in the switch booting
                 * to wrong mode and inoperable.
                 */
-               mv88e6xxx_g1_wait_eeprom_done(chip);
+               if (chip->info->ops->get_eeprom)
+                       mv88e6xxx_g2_eeprom_wait(chip);
 
                gpiod_set_value_cansleep(gpiod, 1);
                usleep_range(10000, 20000);
                gpiod_set_value_cansleep(gpiod, 0);
                usleep_range(10000, 20000);
 
-               mv88e6xxx_g1_wait_eeprom_done(chip);
+               if (chip->info->ops->get_eeprom)
+                       mv88e6xxx_g2_eeprom_wait(chip);
        }
 }
 
index 2fa55a6435910fd5d9a9c42dd28b93285b2181ba..174c773b38c2bd252c3107174886a497b3fab71e 100644 (file)
@@ -75,37 +75,6 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip)
        return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_STS, bit, 1);
 }
 
-void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip)
-{
-       const unsigned long timeout = jiffies + 1 * HZ;
-       u16 val;
-       int err;
-
-       /* Wait up to 1 second for the switch to finish reading the
-        * EEPROM.
-        */
-       while (time_before(jiffies, timeout)) {
-               err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &val);
-               if (err) {
-                       dev_err(chip->dev, "Error reading status");
-                       return;
-               }
-
-               /* If the switch is still resetting, it may not
-                * respond on the bus, and so MDIO read returns
-                * 0xffff. Differentiate between that, and waiting for
-                * the EEPROM to be done by bit 0 being set.
-                */
-               if (val != 0xffff &&
-                   val & BIT(MV88E6XXX_G1_STS_IRQ_EEPROM_DONE))
-                       return;
-
-               usleep_range(1000, 2000);
-       }
-
-       dev_err(chip->dev, "Timeout waiting for EEPROM done");
-}
-
 /* Offset 0x01: Switch MAC Address Register Bytes 0 & 1
  * Offset 0x02: Switch MAC Address Register Bytes 2 & 3
  * Offset 0x03: Switch MAC Address Register Bytes 4 & 5
index c99ddd117fe6e13fa00ea29e8fe91534608794d5..1095261f5b490a8bc708f3d7a513ca633ae0080c 100644 (file)
@@ -282,7 +282,6 @@ int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
 int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip);
 int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip);
 int mv88e6250_g1_reset(struct mv88e6xxx_chip *chip);
-void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip);
 
 int mv88e6185_g1_ppu_enable(struct mv88e6xxx_chip *chip);
 int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip);
index 937a01f2ba75ebe0e89e419da93a0b937352cb68..b2b5f6ba438f46f2e8b39625a08e5eaae2d63d03 100644 (file)
@@ -340,7 +340,7 @@ int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip)
  * Offset 0x15: EEPROM Addr (for 8-bit data access)
  */
 
-static int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip)
+int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip)
 {
        int bit = __bf_shf(MV88E6XXX_G2_EEPROM_CMD_BUSY);
        int err;
index 7e091965582b75254b3dd6b0fed781a77f637d75..d9434f7cae538bb887271f144f0414ae8027becc 100644 (file)
@@ -365,6 +365,7 @@ int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip);
 
 int mv88e6xxx_g2_device_mapping_write(struct mv88e6xxx_chip *chip, int target,
                                      int port);
+int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip);
 
 extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops;
 extern const struct mv88e6xxx_irq_ops mv88e6250_watchdog_ops;
index ad32ca81f7ef41365dda25dd0778e60bab2d5406..f955bde10cf90ad6375f9b97fcffc36ba174a358 100644 (file)
@@ -1833,6 +1833,9 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
        return work_done;
 
 error:
+       if (xdp_flags & ENA_XDP_REDIRECT)
+               xdp_do_flush();
+
        adapter = netdev_priv(rx_ring->netdev);
 
        if (rc == -ENOSPC) {
index 5cc0dbe12132727fb286a41d117a8091c346ec53..7551aa8068f8f794fc9beb9e6cbdf5bd8faaee18 100644 (file)
@@ -2614,6 +2614,7 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget)
        struct rx_cmp_ext *rxcmp1;
        u32 cp_cons, tmp_raw_cons;
        u32 raw_cons = cpr->cp_raw_cons;
+       bool flush_xdp = false;
        u32 rx_pkts = 0;
        u8 event = 0;
 
@@ -2648,6 +2649,8 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget)
                                rx_pkts++;
                        else if (rc == -EBUSY)  /* partial completion */
                                break;
+                       if (event & BNXT_REDIRECT_EVENT)
+                               flush_xdp = true;
                } else if (unlikely(TX_CMP_TYPE(txcmp) ==
                                    CMPL_BASE_TYPE_HWRM_DONE)) {
                        bnxt_hwrm_handler(bp, txcmp);
@@ -2667,6 +2670,8 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget)
 
        if (event & BNXT_AGG_EVENT)
                bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod);
+       if (flush_xdp)
+               xdp_do_flush();
 
        if (!bnxt_has_work(bp, cpr) && rx_pkts < budget) {
                napi_complete_done(napi, rx_pkts);
index b4895c7b3efd1216209653002fca98f1d7f1c897..cf50368441b783df43cb308745d49fa58a69674c 100644 (file)
@@ -3353,6 +3353,15 @@ static void hns3_set_default_feature(struct net_device *netdev)
                  NETIF_F_HW_TC);
 
        netdev->hw_enc_features |= netdev->vlan_features | NETIF_F_TSO_MANGLEID;
+
+       /* The device_version V3 hardware can't offload the checksum for IP in
+        * GRE packets, but can do it for NvGRE. So default to disable the
+        * checksum and GSO offload for GRE.
+        */
+       if (ae_dev->dev_version > HNAE3_DEVICE_VERSION_V2) {
+               netdev->features &= ~NETIF_F_GSO_GRE;
+               netdev->features &= ~NETIF_F_GSO_GRE_CSUM;
+       }
 }
 
 static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
index 8ca368424436205c00951112a2ed7abaf4700153..c42574e297476bdd1209e4a3090345c9a4e13b3c 100644 (file)
@@ -3564,9 +3564,14 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval)
 static void hclge_clear_event_cause(struct hclge_dev *hdev, u32 event_type,
                                    u32 regclr)
 {
+#define HCLGE_IMP_RESET_DELAY          5
+
        switch (event_type) {
        case HCLGE_VECTOR0_EVENT_PTP:
        case HCLGE_VECTOR0_EVENT_RST:
+               if (regclr == BIT(HCLGE_VECTOR0_IMPRESET_INT_B))
+                       mdelay(HCLGE_IMP_RESET_DELAY);
+
                hclge_write_dev(&hdev->hw, HCLGE_MISC_RESET_STS_REG, regclr);
                break;
        case HCLGE_VECTOR0_EVENT_MBX:
@@ -7348,6 +7353,12 @@ static int hclge_del_cls_flower(struct hnae3_handle *handle,
        ret = hclge_fd_tcam_config(hdev, HCLGE_FD_STAGE_1, true, rule->location,
                                   NULL, false);
        if (ret) {
+               /* if tcam config fail, set rule state to TO_DEL,
+                * so the rule will be deleted when periodic
+                * task being scheduled.
+                */
+               hclge_update_fd_list(hdev, HCLGE_FD_TO_DEL, rule->location, NULL);
+               set_bit(HCLGE_STATE_FD_TBL_CHANGED, &hdev->state);
                spin_unlock_bh(&hdev->fd_rule_lock);
                return ret;
        }
@@ -8824,7 +8835,7 @@ static void hclge_update_overflow_flags(struct hclge_vport *vport,
        if (mac_type == HCLGE_MAC_ADDR_UC) {
                if (is_all_added)
                        vport->overflow_promisc_flags &= ~HNAE3_OVERFLOW_UPE;
-               else
+               else if (hclge_is_umv_space_full(vport, true))
                        vport->overflow_promisc_flags |= HNAE3_OVERFLOW_UPE;
        } else {
                if (is_all_added)
index 7a2f9233d69548d1a5be39ccb449c3c2708e2950..a4d68fb216fb92ae4a23b24d323dade62676abea 100644 (file)
@@ -1855,7 +1855,8 @@ static void hclgevf_periodic_service_task(struct hclgevf_dev *hdev)
        unsigned long delta = round_jiffies_relative(HZ);
        struct hnae3_handle *handle = &hdev->nic;
 
-       if (test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state))
+       if (test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state) ||
+           test_bit(HCLGE_COMM_STATE_CMD_DISABLE, &hdev->hw.hw.comm_state))
                return;
 
        if (time_is_after_jiffies(hdev->last_serv_processed + HZ)) {
index 9406237c461e0c3664a40231d4cd6939002c7db4..f81a43d2cdfcd92c46c69e2c7e866912657ae07e 100644 (file)
@@ -456,9 +456,6 @@ int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en)
        u16 out_size = sizeof(vlan_filter);
        int err;
 
-       if (!hwdev)
-               return -EINVAL;
-
        vlan_filter.func_idx = HINIC_HWIF_FUNC_IDX(hwif);
        vlan_filter.enable = en;
 
index 832a2ae019509cbd0bde6dd87be9fd78906b4a1a..a8d79ee350f8dacd623109eebdf5e1ccaea03c76 100644 (file)
@@ -1303,24 +1303,23 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,
         * the user space for finding a flow. During this process, OVS computes
         * checksum on the first packet when CHECKSUM_PARTIAL flag is set.
         *
-        * So, re-compute TCP pseudo header checksum when configured for
-        * trunk mode.
+        * So, re-compute TCP pseudo header checksum.
         */
+
        if (iph_proto == IPPROTO_TCP) {
                struct tcphdr *tcph = (struct tcphdr *)(skb->data + iphlen);
+
                if (tcph->check == 0x0000) {
                        /* Recompute TCP pseudo header checksum  */
-                       if (adapter->is_active_trunk) {
-                               tcphdrlen = skb->len - iphlen;
-                               if (skb_proto == ETH_P_IP)
-                                       tcph->check =
-                                        ~csum_tcpudp_magic(iph->saddr,
-                                       iph->daddr, tcphdrlen, iph_proto, 0);
-                               else if (skb_proto == ETH_P_IPV6)
-                                       tcph->check =
-                                        ~csum_ipv6_magic(&iph6->saddr,
-                                       &iph6->daddr, tcphdrlen, iph_proto, 0);
-                       }
+                       tcphdrlen = skb->len - iphlen;
+                       if (skb_proto == ETH_P_IP)
+                               tcph->check =
+                                ~csum_tcpudp_magic(iph->saddr,
+                               iph->daddr, tcphdrlen, iph_proto, 0);
+                       else if (skb_proto == ETH_P_IPV6)
+                               tcph->check =
+                                ~csum_ipv6_magic(&iph6->saddr,
+                               &iph6->daddr, tcphdrlen, iph_proto, 0);
                        /* Setup SKB fields for checksum offload */
                        skb_partial_csum_set(skb, iphlen,
                                             offsetof(struct tcphdr, check));
index b03426ac932bc1910e7f644240feeb6c92588144..db97353efd067f496150bdf0a2213fa3b1755414 100644 (file)
@@ -2617,12 +2617,14 @@ static int ice_vc_query_rxdid(struct ice_vf *vf)
                goto err;
        }
 
-       /* Read flexiflag registers to determine whether the
-        * corresponding RXDID is configured and supported or not.
-        * Since Legacy 16byte descriptor format is not supported,
-        * start from Legacy 32byte descriptor.
+       /* RXDIDs supported by DDP package can be read from the register
+        * to get the supported RXDID bitmap. But the legacy 32byte RXDID
+        * is not listed in DDP package, add it in the bitmap manually.
+        * Legacy 16byte descriptor is not supported.
         */
-       for (i = ICE_RXDID_LEGACY_1; i < ICE_FLEX_DESC_RXDID_MAX_NUM; i++) {
+       rxdid->supported_rxdids |= BIT(ICE_RXDID_LEGACY_1);
+
+       for (i = ICE_RXDID_FLEX_NIC; i < ICE_FLEX_DESC_RXDID_MAX_NUM; i++) {
                regval = rd32(hw, GLFLXP_RXDID_FLAGS(i, 0));
                if ((regval >> GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_S)
                        & GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_M)
index 93bce729be76a69c562ee5523bd521466356168b..7ab6dd58e40013614a9174686200841393530e30 100644 (file)
@@ -868,6 +868,18 @@ static void igc_ethtool_get_stats(struct net_device *netdev,
        spin_unlock(&adapter->stats64_lock);
 }
 
+static int igc_ethtool_get_previous_rx_coalesce(struct igc_adapter *adapter)
+{
+       return (adapter->rx_itr_setting <= 3) ?
+               adapter->rx_itr_setting : adapter->rx_itr_setting >> 2;
+}
+
+static int igc_ethtool_get_previous_tx_coalesce(struct igc_adapter *adapter)
+{
+       return (adapter->tx_itr_setting <= 3) ?
+               adapter->tx_itr_setting : adapter->tx_itr_setting >> 2;
+}
+
 static int igc_ethtool_get_coalesce(struct net_device *netdev,
                                    struct ethtool_coalesce *ec,
                                    struct kernel_ethtool_coalesce *kernel_coal,
@@ -875,17 +887,8 @@ static int igc_ethtool_get_coalesce(struct net_device *netdev,
 {
        struct igc_adapter *adapter = netdev_priv(netdev);
 
-       if (adapter->rx_itr_setting <= 3)
-               ec->rx_coalesce_usecs = adapter->rx_itr_setting;
-       else
-               ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2;
-
-       if (!(adapter->flags & IGC_FLAG_QUEUE_PAIRS)) {
-               if (adapter->tx_itr_setting <= 3)
-                       ec->tx_coalesce_usecs = adapter->tx_itr_setting;
-               else
-                       ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2;
-       }
+       ec->rx_coalesce_usecs = igc_ethtool_get_previous_rx_coalesce(adapter);
+       ec->tx_coalesce_usecs = igc_ethtool_get_previous_tx_coalesce(adapter);
 
        return 0;
 }
@@ -910,8 +913,12 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev,
            ec->tx_coalesce_usecs == 2)
                return -EINVAL;
 
-       if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) && ec->tx_coalesce_usecs)
+       if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) &&
+           ec->tx_coalesce_usecs != igc_ethtool_get_previous_tx_coalesce(adapter)) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Queue Pair mode enabled, both Rx and Tx coalescing controlled by rx-usecs");
                return -EINVAL;
+       }
 
        /* If ITR is disabled, disable DMAC */
        if (ec->rx_coalesce_usecs == 0) {
index e77d43848955796c69b45a084efa5b8e17d60dd5..53b2a4ef52985271ab6d0ee67c779af878876ba0 100644 (file)
@@ -29,7 +29,8 @@
 static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
                                     struct bpf_prog *prog,
                                     struct nix_cqe_rx_s *cqe,
-                                    struct otx2_cq_queue *cq);
+                                    struct otx2_cq_queue *cq,
+                                    bool *need_xdp_flush);
 
 static int otx2_nix_cq_op_status(struct otx2_nic *pfvf,
                                 struct otx2_cq_queue *cq)
@@ -337,7 +338,7 @@ static bool otx2_check_rcv_errors(struct otx2_nic *pfvf,
 static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
                                 struct napi_struct *napi,
                                 struct otx2_cq_queue *cq,
-                                struct nix_cqe_rx_s *cqe)
+                                struct nix_cqe_rx_s *cqe, bool *need_xdp_flush)
 {
        struct nix_rx_parse_s *parse = &cqe->parse;
        struct nix_rx_sg_s *sg = &cqe->sg;
@@ -353,7 +354,7 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
        }
 
        if (pfvf->xdp_prog)
-               if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq))
+               if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq, need_xdp_flush))
                        return;
 
        skb = napi_get_frags(napi);
@@ -388,6 +389,7 @@ static int otx2_rx_napi_handler(struct otx2_nic *pfvf,
                                struct napi_struct *napi,
                                struct otx2_cq_queue *cq, int budget)
 {
+       bool need_xdp_flush = false;
        struct nix_cqe_rx_s *cqe;
        int processed_cqe = 0;
 
@@ -409,13 +411,15 @@ process_cqe:
                cq->cq_head++;
                cq->cq_head &= (cq->cqe_cnt - 1);
 
-               otx2_rcv_pkt_handler(pfvf, napi, cq, cqe);
+               otx2_rcv_pkt_handler(pfvf, napi, cq, cqe, &need_xdp_flush);
 
                cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID;
                cqe->sg.seg_addr = 0x00;
                processed_cqe++;
                cq->pend_cqe--;
        }
+       if (need_xdp_flush)
+               xdp_do_flush();
 
        /* Free CQEs to HW */
        otx2_write64(pfvf, NIX_LF_CQ_OP_DOOR,
@@ -1354,7 +1358,8 @@ bool otx2_xdp_sq_append_pkt(struct otx2_nic *pfvf, u64 iova, int len, u16 qidx)
 static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
                                     struct bpf_prog *prog,
                                     struct nix_cqe_rx_s *cqe,
-                                    struct otx2_cq_queue *cq)
+                                    struct otx2_cq_queue *cq,
+                                    bool *need_xdp_flush)
 {
        unsigned char *hard_start, *data;
        int qidx = cq->cq_idx;
@@ -1391,8 +1396,10 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
 
                otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
                                    DMA_FROM_DEVICE);
-               if (!err)
+               if (!err) {
+                       *need_xdp_flush = true;
                        return true;
+               }
                put_page(page);
                break;
        default:
index ddec1627f1a7bdcbd573400c51141de4f499a3e6..8d0bacf4e49ccceb2331f14ac2f21cba485940e9 100644 (file)
@@ -2195,7 +2195,7 @@ struct rx_ring_info {
        struct sk_buff  *skb;
        dma_addr_t      data_addr;
        DEFINE_DMA_UNMAP_LEN(data_size);
-       dma_addr_t      frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT];
+       dma_addr_t      frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT ?: 1];
 };
 
 enum flow_control {
index 0bfc375161ed658b0166fef560016d6a1072603d..a174c6fc626acb0f0a6f255108bf0e24fd52418f 100644 (file)
@@ -110,9 +110,9 @@ struct qed_ll2_info {
        enum core_tx_dest tx_dest;
        u8 tx_stats_en;
        bool main_func_queue;
+       struct qed_ll2_cbs cbs;
        struct qed_ll2_rx_queue rx_queue;
        struct qed_ll2_tx_queue tx_queue;
-       struct qed_ll2_cbs cbs;
 };
 
 extern const struct qed_ll2_ops qed_ll2_ops_pass;
index ea9186178091d5165ffcf14f5231a84d990a8e61..fc01ad3f340d69b744eecfb3021ae5dee7b036fe 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2022 Renesas Electronics Corporation
  */
 
+#include <linux/clk.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/etherdevice.h>
@@ -1049,7 +1050,7 @@ static void rswitch_rmac_setting(struct rswitch_etha *etha, const u8 *mac)
 static void rswitch_etha_enable_mii(struct rswitch_etha *etha)
 {
        rswitch_modify(etha->addr, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
-                      MPIC_PSMCS(0x05) | MPIC_PSMHT(0x06));
+                      MPIC_PSMCS(etha->psmcs) | MPIC_PSMHT(0x06));
        rswitch_modify(etha->addr, MPSM, 0, MPSM_MFF_C45);
 }
 
@@ -1693,6 +1694,12 @@ static void rswitch_etha_init(struct rswitch_private *priv, int index)
        etha->index = index;
        etha->addr = priv->addr + RSWITCH_ETHA_OFFSET + index * RSWITCH_ETHA_SIZE;
        etha->coma_addr = priv->addr;
+
+       /* MPIC.PSMCS = (clk [MHz] / (MDC frequency [MHz] * 2) - 1.
+        * Calculating PSMCS value as MDC frequency = 2.5MHz. So, multiply
+        * both the numerator and the denominator by 10.
+        */
+       etha->psmcs = clk_get_rate(priv->clk) / 100000 / (25 * 2) - 1;
 }
 
 static int rswitch_device_alloc(struct rswitch_private *priv, int index)
@@ -1900,6 +1907,10 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
                return -ENOMEM;
        spin_lock_init(&priv->lock);
 
+       priv->clk = devm_clk_get(&pdev->dev, NULL);
+       if (IS_ERR(priv->clk))
+               return PTR_ERR(priv->clk);
+
        attr = soc_device_match(rswitch_soc_no_speed_change);
        if (attr)
                priv->etha_no_runtime_change = true;
index f0c16a37ea55858002a51a4984e77a34dd94e512..04f49a7a58435600c6a5f2aa801755e7f4906142 100644 (file)
@@ -915,6 +915,7 @@ struct rswitch_etha {
        bool external_phy;
        struct mii_bus *mii;
        phy_interface_t phy_interface;
+       u32 psmcs;
        u8 mac_addr[MAX_ADDR_LEN];
        int link;
        int speed;
@@ -1012,6 +1013,7 @@ struct rswitch_private {
        struct rswitch_mfwd mfwd;
 
        spinlock_t lock;        /* lock interrupt registers' control */
+       struct clk *clk;
 
        bool etha_no_runtime_change;
        bool gwca_halt;
index 047322b04d4f52725c01a3db3e3e3788f9fb5e02..834f000ba1c49e6b192a2d34068e1d299e5ff6a8 100644 (file)
@@ -136,6 +136,8 @@ static struct efx_tc_mac_pedit_action *efx_tc_flower_get_mac(struct efx_nic *efx
        if (old) {
                /* don't need our new entry */
                kfree(ped);
+               if (IS_ERR(old)) /* oh dear, it's actually an error */
+                       return ERR_CAST(old);
                if (!refcount_inc_not_zero(&old->ref))
                        return ERR_PTR(-EAGAIN);
                /* existing entry found, ref taken */
@@ -602,6 +604,8 @@ static int efx_tc_flower_record_encap_match(struct efx_nic *efx,
                kfree(encap);
                if (pseudo) /* don't need our new pseudo either */
                        efx_tc_flower_release_encap_match(efx, pseudo);
+               if (IS_ERR(old)) /* oh dear, it's actually an error */
+                       return PTR_ERR(old);
                /* check old and new em_types are compatible */
                switch (old->type) {
                case EFX_TC_EM_DIRECT:
@@ -700,6 +704,8 @@ static struct efx_tc_recirc_id *efx_tc_get_recirc_id(struct efx_nic *efx,
        if (old) {
                /* don't need our new entry */
                kfree(rid);
+               if (IS_ERR(old)) /* oh dear, it's actually an error */
+                       return ERR_CAST(old);
                if (!refcount_inc_not_zero(&old->ref))
                        return ERR_PTR(-EAGAIN);
                /* existing entry found */
@@ -1482,7 +1488,10 @@ static int efx_tc_flower_replace_foreign(struct efx_nic *efx,
        old = rhashtable_lookup_get_insert_fast(&efx->tc->match_action_ht,
                                                &rule->linkage,
                                                efx_tc_match_action_ht_params);
-       if (old) {
+       if (IS_ERR(old)) {
+               rc = PTR_ERR(old);
+               goto release;
+       } else if (old) {
                netif_dbg(efx, drv, efx->net_dev,
                          "Ignoring already-offloaded rule (cookie %lx)\n",
                          tc->cookie);
@@ -1697,7 +1706,10 @@ static int efx_tc_flower_replace_lhs(struct efx_nic *efx,
        old = rhashtable_lookup_get_insert_fast(&efx->tc->lhs_rule_ht,
                                                &rule->linkage,
                                                efx_tc_lhs_rule_ht_params);
-       if (old) {
+       if (IS_ERR(old)) {
+               rc = PTR_ERR(old);
+               goto release;
+       } else if (old) {
                netif_dbg(efx, drv, efx->net_dev,
                          "Already offloaded rule (cookie %lx)\n", tc->cookie);
                rc = -EEXIST;
@@ -1858,7 +1870,10 @@ static int efx_tc_flower_replace(struct efx_nic *efx,
        old = rhashtable_lookup_get_insert_fast(&efx->tc->match_action_ht,
                                                &rule->linkage,
                                                efx_tc_match_action_ht_params);
-       if (old) {
+       if (IS_ERR(old)) {
+               rc = PTR_ERR(old);
+               goto release;
+       } else if (old) {
                netif_dbg(efx, drv, efx->net_dev,
                          "Already offloaded rule (cookie %lx)\n", tc->cookie);
                NL_SET_ERR_MSG_MOD(extack, "Rule already offloaded");
index 8e06bfbcbea17cc5c3984d37a41725e61c895433..44bb57670340dae06cad31fde1deaa60a1ae6e90 100644 (file)
@@ -298,7 +298,10 @@ static int efx_tc_ct_replace(struct efx_tc_ct_zone *ct_zone,
        old = rhashtable_lookup_get_insert_fast(&efx->tc->ct_ht,
                                                &conn->linkage,
                                                efx_tc_ct_ht_params);
-       if (old) {
+       if (IS_ERR(old)) {
+               rc = PTR_ERR(old);
+               goto release;
+       } else if (old) {
                netif_dbg(efx, drv, efx->net_dev,
                          "Already offloaded conntrack (cookie %lx)\n", tc->cookie);
                rc = -EEXIST;
@@ -482,6 +485,8 @@ struct efx_tc_ct_zone *efx_tc_ct_register_zone(struct efx_nic *efx, u16 zone,
        if (old) {
                /* don't need our new entry */
                kfree(ct_zone);
+               if (IS_ERR(old)) /* oh dear, it's actually an error */
+                       return ERR_CAST(old);
                if (!refcount_inc_not_zero(&old->ref))
                        return ERR_PTR(-EAGAIN);
                /* existing entry found */
index 0fafb47ea0824b450de43520430e41816aab9d12..c4408842432363d02bcbd64d5ab4807a444ae15e 100644 (file)
@@ -236,6 +236,8 @@ struct efx_tc_counter_index *efx_tc_flower_get_counter_index(
        if (old) {
                /* don't need our new entry */
                kfree(ctr);
+               if (IS_ERR(old)) /* oh dear, it's actually an error */
+                       return ERR_CAST(old);
                if (!refcount_inc_not_zero(&old->ref))
                        return ERR_PTR(-EAGAIN);
                /* existing entry found */
index 7e8bcdb222ad18b4f175d5312613402d169dfbcd..87443f9dfd22b8b82564efc31bb0d8497d3757a1 100644 (file)
@@ -132,6 +132,8 @@ static int efx_bind_neigh(struct efx_nic *efx,
                /* don't need our new entry */
                put_net_track(neigh->net, &neigh->ns_tracker);
                kfree(neigh);
+               if (IS_ERR(old)) /* oh dear, it's actually an error */
+                       return PTR_ERR(old);
                if (!refcount_inc_not_zero(&old->ref))
                        return -EAGAIN;
                /* existing entry found, ref taken */
@@ -640,6 +642,8 @@ struct efx_tc_encap_action *efx_tc_flower_create_encap_md(
        if (old) {
                /* don't need our new entry */
                kfree(encap);
+               if (IS_ERR(old)) /* oh dear, it's actually an error */
+                       return ERR_CAST(old);
                if (!refcount_inc_not_zero(&old->ref))
                        return ERR_PTR(-EAGAIN);
                /* existing entry found, ref taken */
index 0f28795e581c23957fba5c81c83ba9d248521a97..2f0678f15fb7e71f42a5727a4e36887592b3fbf2 100644 (file)
@@ -901,7 +901,7 @@ static int __maybe_unused stmmac_pltfr_resume(struct device *dev)
        struct platform_device *pdev = to_platform_device(dev);
        int ret;
 
-       ret = stmmac_pltfr_init(pdev, priv->plat->bsp_priv);
+       ret = stmmac_pltfr_init(pdev, priv->plat);
        if (ret)
                return ret;
 
index bea6fc0f324ce9a42e8ced4bd3a12a770e20f7ea..24120605502f9e8b7d3161d066902e2b8edc8a3f 100644 (file)
@@ -1747,9 +1747,10 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common)
                }
 
                tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
-               if (tx_chn->irq <= 0) {
+               if (tx_chn->irq < 0) {
                        dev_err(dev, "Failed to get tx dma irq %d\n",
                                tx_chn->irq);
+                       ret = tx_chn->irq;
                        goto err;
                }
 
index 410612f43cbd0a5c979c50f021a4e6dff63a58a5..4914d0ef58e9b969dc82401be4922a0d13b4e9ad 100644 (file)
@@ -316,12 +316,12 @@ static int prueth_init_tx_chns(struct prueth_emac *emac)
                        goto fail;
                }
 
-               tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
-               if (tx_chn->irq <= 0) {
-                       ret = -EINVAL;
+               ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
+               if (ret < 0) {
                        netdev_err(ndev, "failed to get tx irq\n");
                        goto fail;
                }
+               tx_chn->irq = ret;
 
                snprintf(tx_chn->name, sizeof(tx_chn->name), "%s-tx%d",
                         dev_name(dev), tx_chn->id);
index e8b94580194e719184527cf8d2fc9e138afdebb2..508d9a392ab182c4809019e73fd2b658fd1d66de 100644 (file)
@@ -2115,7 +2115,12 @@ static const struct ethtool_ops team_ethtool_ops = {
 static void team_setup_by_port(struct net_device *dev,
                               struct net_device *port_dev)
 {
-       dev->header_ops = port_dev->header_ops;
+       struct team *team = netdev_priv(dev);
+
+       if (port_dev->type == ARPHRD_ETHER)
+               dev->header_ops = team->header_ops_cache;
+       else
+               dev->header_ops = port_dev->header_ops;
        dev->type = port_dev->type;
        dev->hard_header_len = port_dev->hard_header_len;
        dev->needed_headroom = port_dev->needed_headroom;
@@ -2162,8 +2167,11 @@ static int team_dev_type_check_change(struct net_device *dev,
 
 static void team_setup(struct net_device *dev)
 {
+       struct team *team = netdev_priv(dev);
+
        ether_setup(dev);
        dev->max_mtu = ETH_MAX_MTU;
+       team->header_ops_cache = dev->header_ops;
 
        dev->netdev_ops = &team_netdev_ops;
        dev->ethtool_ops = &team_ethtool_ops;
index 5d6454fedb3f17707f7cd8a3b963da08e67c76c9..78ad2da3ee29b225f41eddc90b08d43257d01e8f 100644 (file)
@@ -90,7 +90,9 @@ static int __must_check __smsc75xx_read_reg(struct usbnet *dev, u32 index,
        ret = fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN
                 | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                 0, index, &buf, 4);
-       if (unlikely(ret < 0)) {
+       if (unlikely(ret < 4)) {
+               ret = ret < 0 ? ret : -ENODATA;
+
                netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n",
                            index, ret);
                return ret;
index e463f59e95c2535cef645939b156de7ae428ceb2..5b5597073b004c911f88b472748447804594c752 100644 (file)
@@ -4331,6 +4331,10 @@ static size_t vxlan_get_size(const struct net_device *dev)
                nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_REMCSUM_TX */
                nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_REMCSUM_RX */
                nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LOCALBYPASS */
+               nla_total_size(0) + /* IFLA_VXLAN_GBP */
+               nla_total_size(0) + /* IFLA_VXLAN_GPE */
+               nla_total_size(0) + /* IFLA_VXLAN_REMCSUM_NOPARTIAL */
+               nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_VNIFILTER */
                0;
 }
 
index 47c2ad7a3e429ae03fc732024728b113fe77d87e..fd50bb313b92448d6de580271d5cf76a0f717d15 100644 (file)
@@ -34,6 +34,8 @@
 #define TDM_PPPOHT_SLIC_MAXIN
 #define RX_BD_ERRORS (R_CD_S | R_OV_S | R_CR_S | R_AB_S | R_NO_S | R_LG_S)
 
+static int uhdlc_close(struct net_device *dev);
+
 static struct ucc_tdm_info utdm_primary_info = {
        .uf_info = {
                .tsa = 0,
@@ -708,6 +710,7 @@ static int uhdlc_open(struct net_device *dev)
        hdlc_device *hdlc = dev_to_hdlc(dev);
        struct ucc_hdlc_private *priv = hdlc->priv;
        struct ucc_tdm *utdm = priv->utdm;
+       int rc = 0;
 
        if (priv->hdlc_busy != 1) {
                if (request_irq(priv->ut_info->uf_info.irq,
@@ -731,10 +734,13 @@ static int uhdlc_open(struct net_device *dev)
                napi_enable(&priv->napi);
                netdev_reset_queue(dev);
                netif_start_queue(dev);
-               hdlc_open(dev);
+
+               rc = hdlc_open(dev);
+               if (rc)
+                       uhdlc_close(dev);
        }
 
-       return 0;
+       return rc;
 }
 
 static void uhdlc_memclean(struct ucc_hdlc_private *priv)
@@ -824,6 +830,8 @@ static int uhdlc_close(struct net_device *dev)
        netdev_reset_queue(dev);
        priv->hdlc_busy = 0;
 
+       hdlc_close(dev);
+
        return 0;
 }
 
index f3a01b79148cb1e3246d759cf0bdab809270eb2a..21783aa2ee8e18f64154f479a4b6800eccecde32 100644 (file)
@@ -2245,25 +2245,8 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)
        else
                ctrl->ctrl_config = NVME_CC_CSS_NVM;
 
-       if (ctrl->cap & NVME_CAP_CRMS_CRWMS) {
-               u32 crto;
-
-               ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CRTO, &crto);
-               if (ret) {
-                       dev_err(ctrl->device, "Reading CRTO failed (%d)\n",
-                               ret);
-                       return ret;
-               }
-
-               if (ctrl->cap & NVME_CAP_CRMS_CRIMS) {
-                       ctrl->ctrl_config |= NVME_CC_CRIME;
-                       timeout = NVME_CRTO_CRIMT(crto);
-               } else {
-                       timeout = NVME_CRTO_CRWMT(crto);
-               }
-       } else {
-               timeout = NVME_CAP_TIMEOUT(ctrl->cap);
-       }
+       if (ctrl->cap & NVME_CAP_CRMS_CRWMS && ctrl->cap & NVME_CAP_CRMS_CRIMS)
+               ctrl->ctrl_config |= NVME_CC_CRIME;
 
        ctrl->ctrl_config |= (NVME_CTRL_PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT;
        ctrl->ctrl_config |= NVME_CC_AMS_RR | NVME_CC_SHN_NONE;
@@ -2277,6 +2260,39 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)
        if (ret)
                return ret;
 
+       /* CAP value may change after initial CC write */
+       ret = ctrl->ops->reg_read64(ctrl, NVME_REG_CAP, &ctrl->cap);
+       if (ret)
+               return ret;
+
+       timeout = NVME_CAP_TIMEOUT(ctrl->cap);
+       if (ctrl->cap & NVME_CAP_CRMS_CRWMS) {
+               u32 crto, ready_timeout;
+
+               ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CRTO, &crto);
+               if (ret) {
+                       dev_err(ctrl->device, "Reading CRTO failed (%d)\n",
+                               ret);
+                       return ret;
+               }
+
+               /*
+                * CRTO should always be greater or equal to CAP.TO, but some
+                * devices are known to get this wrong. Use the larger of the
+                * two values.
+                */
+               if (ctrl->ctrl_config & NVME_CC_CRIME)
+                       ready_timeout = NVME_CRTO_CRIMT(crto);
+               else
+                       ready_timeout = NVME_CRTO_CRWMT(crto);
+
+               if (ready_timeout < timeout)
+                       dev_warn_once(ctrl->device, "bad crto:%x cap:%llx\n",
+                                     crto, ctrl->cap);
+               else
+                       timeout = ready_timeout;
+       }
+
        ctrl->ctrl_config |= NVME_CC_ENABLE;
        ret = ctrl->ops->reg_write32(ctrl, NVME_REG_CC, ctrl->ctrl_config);
        if (ret)
index 1cd2bf82319a988021cbb04d311ebee3dc017bed..a15b37750d6e931b0a875058cda6868034a642d9 100644 (file)
@@ -1924,7 +1924,7 @@ char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req)
        struct nvme_fc_fcp_op *op = fcp_req_to_fcp_op(req);
        struct request *rq = op->rq;
 
-       if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq->bio)
+       if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq || !rq->bio)
                return NULL;
        return blkcg_get_fc_appid(rq->bio);
 }
index 316f3e4ca7cc60da613e5f246f9e5a861d60e14f..8df73a0b3980cde3f150b66672db7965eda9a328 100644 (file)
@@ -187,7 +187,7 @@ static umode_t nvme_hwmon_is_visible(const void *_data,
        return 0;
 }
 
-static const struct hwmon_channel_info *nvme_hwmon_info[] = {
+static const struct hwmon_channel_info *const nvme_hwmon_info[] = {
        HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
        HWMON_CHANNEL_INFO(temp,
                           HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN |
index 2f57da12d9836dd1af3beceb4d61e9e73ceb5930..347cb5daebc3cedefc09dac49a10960f00aa1ead 100644 (file)
@@ -2916,9 +2916,6 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev,
        struct nvme_dev *dev;
        int ret = -ENOMEM;
 
-       if (node == NUMA_NO_NODE)
-               set_dev_node(&pdev->dev, first_memory_node);
-
        dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node);
        if (!dev)
                return ERR_PTR(-ENOMEM);
index 868aa4de2e4c4ef7bcfc3c704ae10791f1725ff9..cd92d7ddf5ed15f677d9d954a43d064659ce2a36 100644 (file)
@@ -348,7 +348,7 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd)
        while (length) {
                u32 iov_len = min_t(u32, length, sg->length - sg_offset);
 
-               bvec_set_page(iov, sg_page(sg), sg->length,
+               bvec_set_page(iov, sg_page(sg), iov_len,
                                sg->offset + sg_offset);
 
                length -= iov_len;
index 20a974ced8d6c30d09f6770409c9d49d0f6daa94..a7a6947ab4bc59d58d7df7320321e9318ce96b06 100644 (file)
@@ -3998,7 +3998,6 @@ ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev)
        return 0;
 
 out:
-       ptp_ocp_dev_release(&bp->dev);
        put_device(&bp->dev);
        return err;
 }
index 5ad5f3b3a6b5d8fc91f1ea2e689a65fc087740be..d4926833655327d6a3494a5b6865087df80ad36d 100644 (file)
@@ -197,7 +197,7 @@ int regulator_set_voltage_sel_pickable_regmap(struct regulator_dev *rdev,
        sel += rdev->desc->linear_ranges[i].min_sel;
 
        range = rdev->desc->linear_range_selectors_bitfield[i];
-       range <<= ffs(rdev->desc->vsel_mask) - 1;
+       range <<= ffs(rdev->desc->vsel_range_mask) - 1;
 
        if (rdev->desc->vsel_reg == rdev->desc->vsel_range_reg) {
                ret = regmap_update_bits(rdev->regmap,
index 7f9b221e7c34ae25e663ef30d98075f4f1e83446..ea9b42225e629dd5840e29c8bce622aef7736444 100644 (file)
@@ -6073,7 +6073,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                                            phba->hba_debugfs_root,
                                            phba,
                                            &lpfc_debugfs_op_multixripools);
-               if (!phba->debug_multixri_pools) {
+               if (IS_ERR(phba->debug_multixri_pools)) {
                        lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
                                         "0527 Cannot create debugfs multixripools\n");
                        goto debug_failed;
@@ -6085,7 +6085,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG | 0644,
                                            phba->hba_debugfs_root,
                                            phba, &lpfc_cgn_buffer_op);
-               if (!phba->debug_cgn_buffer) {
+               if (IS_ERR(phba->debug_cgn_buffer)) {
                        lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
                                         "6527 Cannot create debugfs "
                                         "cgn_buffer\n");
@@ -6098,7 +6098,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG | 0644,
                                            phba->hba_debugfs_root,
                                            phba, &lpfc_rx_monitor_op);
-               if (!phba->debug_rx_monitor) {
+               if (IS_ERR(phba->debug_rx_monitor)) {
                        lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
                                         "6528 Cannot create debugfs "
                                         "rx_monitor\n");
@@ -6111,7 +6111,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, 0644,
                                            phba->hba_debugfs_root,
                                            phba, &lpfc_debugfs_ras_log);
-               if (!phba->debug_ras_log) {
+               if (IS_ERR(phba->debug_ras_log)) {
                        lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
                                         "6148 Cannot create debugfs"
                                         " ras_log\n");
@@ -6132,7 +6132,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                        debugfs_create_file(name, S_IFREG | 0644,
                                            phba->hba_debugfs_root,
                                            phba, &lpfc_debugfs_op_lockstat);
-               if (!phba->debug_lockstat) {
+               if (IS_ERR(phba->debug_lockstat)) {
                        lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
                                         "4610 Can't create debugfs lockstat\n");
                        goto debug_failed;
@@ -6358,7 +6358,7 @@ nvmeio_off:
                debugfs_create_file(name, 0644,
                                    vport->vport_debugfs_root,
                                    vport, &lpfc_debugfs_op_scsistat);
-       if (!vport->debug_scsistat) {
+       if (IS_ERR(vport->debug_scsistat)) {
                lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
                                 "4611 Cannot create debugfs scsistat\n");
                goto debug_failed;
@@ -6369,7 +6369,7 @@ nvmeio_off:
                debugfs_create_file(name, 0644,
                                    vport->vport_debugfs_root,
                                    vport, &lpfc_debugfs_op_ioktime);
-       if (!vport->debug_ioktime) {
+       if (IS_ERR(vport->debug_ioktime)) {
                lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
                                 "0815 Cannot create debugfs ioktime\n");
                goto debug_failed;
index 51afb60859ebf957c6f4eb1e0f2a169e093e55f3..5154eeaee0ec325c8f293ee52e291ea5d9b7aa2f 100644 (file)
@@ -199,11 +199,12 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
                /* Only 1 thread can drop the initial node reference.  If
                 * another thread has set NLP_DROPPED, this thread is done.
                 */
-               if (!(ndlp->nlp_flag & NLP_DROPPED)) {
+               if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD) &&
+                   !(ndlp->nlp_flag & NLP_DROPPED)) {
                        ndlp->nlp_flag |= NLP_DROPPED;
                        spin_unlock_irqrestore(&ndlp->lock, iflags);
                        lpfc_nlp_put(ndlp);
-                       spin_lock_irqsave(&ndlp->lock, iflags);
+                       return;
                }
 
                spin_unlock_irqrestore(&ndlp->lock, iflags);
index 39acbcb7ec66a12e246ed3f92699fa5afe430c7e..96e11a26c297eb3949fbdd8d51932c2e703b09fe 100644 (file)
@@ -228,8 +228,7 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport)
        spin_unlock_irq(&ndlp->lock);
 
        /* On a devloss timeout event, one more put is executed provided the
-        * NVME and SCSI rport unregister requests are complete.  If the vport
-        * is unloading, this extra put is executed by lpfc_drop_node.
+        * NVME and SCSI rport unregister requests are complete.
         */
        if (!(ndlp->fc4_xpt_flags & fc4_xpt_flags))
                lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
@@ -2567,11 +2566,7 @@ lpfc_nvme_rescan_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
  * nvme_transport perspective.  Loss of an rport just means IO cannot
  * be sent and recovery is completely up to the initator.
  * For now, the driver just unbinds the DID and port_role so that
- * no further IO can be issued.  Changes are planned for later.
- *
- * Notes - the ndlp reference count is not decremented here since
- * since there is no nvme_transport api for devloss.  Node ref count
- * is only adjusted in driver unload.
+ * no further IO can be issued.
  */
 void
 lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
@@ -2646,6 +2641,21 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
                                         "6167 NVME unregister failed %d "
                                         "port_state x%x\n",
                                         ret, remoteport->port_state);
+
+                       if (vport->load_flag & FC_UNLOADING) {
+                               /* Only 1 thread can drop the initial node
+                                * reference. Check if another thread has set
+                                * NLP_DROPPED.
+                                */
+                               spin_lock_irq(&ndlp->lock);
+                               if (!(ndlp->nlp_flag & NLP_DROPPED)) {
+                                       ndlp->nlp_flag |= NLP_DROPPED;
+                                       spin_unlock_irq(&ndlp->lock);
+                                       lpfc_nlp_put(ndlp);
+                                       return;
+                               }
+                               spin_unlock_irq(&ndlp->lock);
+                       }
                }
        }
        return;
index 3554f6b07727324ac5a8259be01bd4ecb8db6565..94abba57582d54ff0394029855f86b47d0861c2a 100644 (file)
@@ -2332,7 +2332,7 @@ struct megasas_instance {
        u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */
        bool use_seqnum_jbod_fp;   /* Added for PD sequence */
        bool smp_affinity_enable;
-       spinlock_t crashdump_lock;
+       struct mutex crashdump_lock;
 
        struct megasas_register_set __iomem *reg_set;
        u32 __iomem *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY];
index b9d46dcb521094fa9afc66aa09f7f9e8e73a7b4a..e1aa667dae662dc8b83d6eb928e71b7a248c8cfb 100644 (file)
@@ -3271,14 +3271,13 @@ fw_crash_buffer_store(struct device *cdev,
        struct megasas_instance *instance =
                (struct megasas_instance *) shost->hostdata;
        int val = 0;
-       unsigned long flags;
 
        if (kstrtoint(buf, 0, &val) != 0)
                return -EINVAL;
 
-       spin_lock_irqsave(&instance->crashdump_lock, flags);
+       mutex_lock(&instance->crashdump_lock);
        instance->fw_crash_buffer_offset = val;
-       spin_unlock_irqrestore(&instance->crashdump_lock, flags);
+       mutex_unlock(&instance->crashdump_lock);
        return strlen(buf);
 }
 
@@ -3293,24 +3292,23 @@ fw_crash_buffer_show(struct device *cdev,
        unsigned long dmachunk = CRASH_DMA_BUF_SIZE;
        unsigned long chunk_left_bytes;
        unsigned long src_addr;
-       unsigned long flags;
        u32 buff_offset;
 
-       spin_lock_irqsave(&instance->crashdump_lock, flags);
+       mutex_lock(&instance->crashdump_lock);
        buff_offset = instance->fw_crash_buffer_offset;
        if (!instance->crash_dump_buf ||
                !((instance->fw_crash_state == AVAILABLE) ||
                (instance->fw_crash_state == COPYING))) {
                dev_err(&instance->pdev->dev,
                        "Firmware crash dump is not available\n");
-               spin_unlock_irqrestore(&instance->crashdump_lock, flags);
+               mutex_unlock(&instance->crashdump_lock);
                return -EINVAL;
        }
 
        if (buff_offset > (instance->fw_crash_buffer_size * dmachunk)) {
                dev_err(&instance->pdev->dev,
                        "Firmware crash dump offset is out of range\n");
-               spin_unlock_irqrestore(&instance->crashdump_lock, flags);
+               mutex_unlock(&instance->crashdump_lock);
                return 0;
        }
 
@@ -3322,7 +3320,7 @@ fw_crash_buffer_show(struct device *cdev,
        src_addr = (unsigned long)instance->crash_buf[buff_offset / dmachunk] +
                (buff_offset % dmachunk);
        memcpy(buf, (void *)src_addr, size);
-       spin_unlock_irqrestore(&instance->crashdump_lock, flags);
+       mutex_unlock(&instance->crashdump_lock);
 
        return size;
 }
@@ -3347,7 +3345,6 @@ fw_crash_state_store(struct device *cdev,
        struct megasas_instance *instance =
                (struct megasas_instance *) shost->hostdata;
        int val = 0;
-       unsigned long flags;
 
        if (kstrtoint(buf, 0, &val) != 0)
                return -EINVAL;
@@ -3361,9 +3358,9 @@ fw_crash_state_store(struct device *cdev,
        instance->fw_crash_state = val;
 
        if ((val == COPIED) || (val == COPY_ERROR)) {
-               spin_lock_irqsave(&instance->crashdump_lock, flags);
+               mutex_lock(&instance->crashdump_lock);
                megasas_free_host_crash_buffer(instance);
-               spin_unlock_irqrestore(&instance->crashdump_lock, flags);
+               mutex_unlock(&instance->crashdump_lock);
                if (val == COPY_ERROR)
                        dev_info(&instance->pdev->dev, "application failed to "
                                "copy Firmware crash dump\n");
@@ -7422,7 +7419,7 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance)
        init_waitqueue_head(&instance->int_cmd_wait_q);
        init_waitqueue_head(&instance->abort_cmd_wait_q);
 
-       spin_lock_init(&instance->crashdump_lock);
+       mutex_init(&instance->crashdump_lock);
        spin_lock_init(&instance->mfi_pool_lock);
        spin_lock_init(&instance->hba_lock);
        spin_lock_init(&instance->stream_lock);
index 33053db5a7134c4ed230ed8fb901956e5a96ab30..90069c7b164256bb98ee745e8a8da8244ae05ef1 100644 (file)
@@ -4180,7 +4180,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
        payload.sas_identify.dev_type = SAS_END_DEVICE;
        payload.sas_identify.initiator_bits = SAS_PROTOCOL_ALL;
        memcpy(payload.sas_identify.sas_addr,
-               pm8001_ha->sas_addr, SAS_ADDR_SIZE);
+               &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE);
        payload.sas_identify.phy_id = phy_id;
 
        return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
index 5e5ce1e74c3b0567d411b79d7fd30d5ae222e3c9..443a3176c6c0c9911658e7d7453f976b7a66a0d9 100644 (file)
@@ -273,7 +273,6 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
        return ret;
 }
 
-static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha);
 static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha);
 
 /**
@@ -294,13 +293,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
        pm8001_dbg(pm8001_ha, INIT, "pm8001_alloc: PHY:%x\n",
                   pm8001_ha->chip->n_phy);
 
-       /* Setup Interrupt */
-       rc = pm8001_setup_irq(pm8001_ha);
-       if (rc) {
-               pm8001_dbg(pm8001_ha, FAIL,
-                          "pm8001_setup_irq failed [ret: %d]\n", rc);
-               goto err_out;
-       }
        /* Request Interrupt */
        rc = pm8001_request_irq(pm8001_ha);
        if (rc)
@@ -1031,47 +1023,38 @@ static u32 pm8001_request_msix(struct pm8001_hba_info *pm8001_ha)
 }
 #endif
 
-static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha)
-{
-       struct pci_dev *pdev;
-
-       pdev = pm8001_ha->pdev;
-
-#ifdef PM8001_USE_MSIX
-       if (pci_find_capability(pdev, PCI_CAP_ID_MSIX))
-               return pm8001_setup_msix(pm8001_ha);
-       pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
-#endif
-       return 0;
-}
-
 /**
  * pm8001_request_irq - register interrupt
  * @pm8001_ha: our ha struct.
  */
 static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha)
 {
-       struct pci_dev *pdev;
+       struct pci_dev *pdev = pm8001_ha->pdev;
+#ifdef PM8001_USE_MSIX
        int rc;
 
-       pdev = pm8001_ha->pdev;
+       if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) {
+               rc = pm8001_setup_msix(pm8001_ha);
+               if (rc) {
+                       pm8001_dbg(pm8001_ha, FAIL,
+                                  "pm8001_setup_irq failed [ret: %d]\n", rc);
+                       return rc;
+               }
 
-#ifdef PM8001_USE_MSIX
-       if (pdev->msix_cap && pci_msi_enabled())
-               return pm8001_request_msix(pm8001_ha);
-       else {
-               pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
-               goto intx;
+               if (pdev->msix_cap && pci_msi_enabled())
+                       return pm8001_request_msix(pm8001_ha);
        }
+
+       pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
 #endif
 
-intx:
        /* initialize the INT-X interrupt */
        pm8001_ha->irq_vector[0].irq_id = 0;
        pm8001_ha->irq_vector[0].drv_inst = pm8001_ha;
-       rc = request_irq(pdev->irq, pm8001_interrupt_handler_intx, IRQF_SHARED,
-               pm8001_ha->name, SHOST_TO_SAS_HA(pm8001_ha->shost));
-       return rc;
+
+       return request_irq(pdev->irq, pm8001_interrupt_handler_intx,
+                          IRQF_SHARED, pm8001_ha->name,
+                          SHOST_TO_SAS_HA(pm8001_ha->shost));
 }
 
 /**
index f6857632dc7cd70d6cb3682fb43603b40d798632..3afd9443c4254afd5507f26683996978fda80ac0 100644 (file)
@@ -3671,10 +3671,12 @@ static int mpi_set_controller_config_resp(struct pm8001_hba_info *pm8001_ha,
                        (struct set_ctrl_cfg_resp *)(piomb + 4);
        u32 status = le32_to_cpu(pPayload->status);
        u32 err_qlfr_pgcd = le32_to_cpu(pPayload->err_qlfr_pgcd);
+       u32 tag = le32_to_cpu(pPayload->tag);
 
        pm8001_dbg(pm8001_ha, MSG,
                   "SET CONTROLLER RESP: status 0x%x qlfr_pgcd 0x%x\n",
                   status, err_qlfr_pgcd);
+       pm8001_tag_free(pm8001_ha, tag);
 
        return 0;
 }
@@ -4671,7 +4673,7 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
        payload.sas_identify.dev_type = SAS_END_DEVICE;
        payload.sas_identify.initiator_bits = SAS_PROTOCOL_ALL;
        memcpy(payload.sas_identify.sas_addr,
-         &pm8001_ha->sas_addr, SAS_ADDR_SIZE);
+               &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE);
        payload.sas_identify.phy_id = phy_id;
 
        return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
index 19f0b93fa3d85a283bcfb77125def4d38845e3cd..d592ee9170c11f373971028a804f44a6ba6042b7 100644 (file)
@@ -307,9 +307,9 @@ static int ppa_out(ppa_struct *dev, char *buffer, int len)
        case PPA_EPP_8:
                epp_reset(ppb);
                w_ctr(ppb, 0x4);
-               if (dev->mode == PPA_EPP_32 && !(((long) buffer | len) & 0x01))
+               if (dev->mode == PPA_EPP_32 && !(((long) buffer | len) & 0x03))
                        outsl(ppb + 4, buffer, len >> 2);
-               else if (dev->mode == PPA_EPP_16 && !(((long) buffer | len) & 0x03))
+               else if (dev->mode == PPA_EPP_16 && !(((long) buffer | len) & 0x01))
                        outsw(ppb + 4, buffer, len >> 1);
                else
                        outsb(ppb + 4, buffer, len);
index 4750ec5789a80db9f07060599d3705ddc6bcc062..10fe3383855c00558e0ffc26268023001376f796 100644 (file)
@@ -1904,6 +1904,7 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts)
                goto drop_rdata_kref;
        }
 
+       spin_lock_irqsave(&fcport->rport_lock, flags);
        if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) ||
            test_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags) ||
            test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) {
@@ -1911,17 +1912,20 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts)
                         "io_req xid=0x%x sc_cmd=%p already in cleanup or abort processing or already completed.\n",
                         io_req->xid, io_req->sc_cmd);
                rc = 1;
+               spin_unlock_irqrestore(&fcport->rport_lock, flags);
                goto drop_rdata_kref;
        }
 
+       /* Set the command type to abort */
+       io_req->cmd_type = QEDF_ABTS;
+       spin_unlock_irqrestore(&fcport->rport_lock, flags);
+
        kref_get(&io_req->refcount);
 
        xid = io_req->xid;
        qedf->control_requests++;
        qedf->packet_aborts++;
 
-       /* Set the command type to abort */
-       io_req->cmd_type = QEDF_ABTS;
        io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts;
 
        set_bit(QEDF_CMD_IN_ABORT, &io_req->flags);
@@ -2210,7 +2214,9 @@ process_els:
                  refcount, fcport, fcport->rdata->ids.port_id);
 
        /* Cleanup cmds re-use the same TID as the original I/O */
+       spin_lock_irqsave(&fcport->rport_lock, flags);
        io_req->cmd_type = QEDF_CLEANUP;
+       spin_unlock_irqrestore(&fcport->rport_lock, flags);
        io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts;
 
        init_completion(&io_req->cleanup_done);
index 7825765c936cd651b276af2507799664b5cedeb1..91f3f1d7098eb5b4b0680fb127ebc1978ec08f53 100644 (file)
@@ -2805,6 +2805,8 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe)
        struct qedf_ioreq *io_req;
        struct qedf_rport *fcport;
        u32 comp_type;
+       u8 io_comp_type;
+       unsigned long flags;
 
        comp_type = (cqe->cqe_data >> FCOE_CQE_CQE_TYPE_SHIFT) &
            FCOE_CQE_CQE_TYPE_MASK;
@@ -2838,11 +2840,14 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe)
                return;
        }
 
+       spin_lock_irqsave(&fcport->rport_lock, flags);
+       io_comp_type = io_req->cmd_type;
+       spin_unlock_irqrestore(&fcport->rport_lock, flags);
 
        switch (comp_type) {
        case FCOE_GOOD_COMPLETION_CQE_TYPE:
                atomic_inc(&fcport->free_sqes);
-               switch (io_req->cmd_type) {
+               switch (io_comp_type) {
                case QEDF_SCSI_CMD:
                        qedf_scsi_completion(qedf, cqe, io_req);
                        break;
index f060e593685de0266d93950d3e263202b263cdde..a7a364760b8002bd9b4bb02270d5e83fe4c5b3f0 100644 (file)
@@ -116,7 +116,7 @@ qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp)
 
        sprintf(wwn, "pn-%016llx", wwn_to_u64(fp->port_name));
        fp->dfs_rport_dir = debugfs_create_dir(wwn, vha->dfs_rport_root);
-       if (!fp->dfs_rport_dir)
+       if (IS_ERR(fp->dfs_rport_dir))
                return;
        if (NVME_TARGET(vha->hw, fp))
                debugfs_create_file("dev_loss_tmo", 0600, fp->dfs_rport_dir,
@@ -708,14 +708,14 @@ create_nodes:
        if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) {
                ha->tgt.dfs_naqp = debugfs_create_file("naqp",
                    0400, ha->dfs_dir, vha, &dfs_naqp_ops);
-               if (!ha->tgt.dfs_naqp) {
+               if (IS_ERR(ha->tgt.dfs_naqp)) {
                        ql_log(ql_log_warn, vha, 0xd011,
                               "Unable to create debugFS naqp node.\n");
                        goto out;
                }
        }
        vha->dfs_rport_root = debugfs_create_dir("rports", ha->dfs_dir);
-       if (!vha->dfs_rport_root) {
+       if (IS_ERR(vha->dfs_rport_root)) {
                ql_log(ql_log_warn, vha, 0xd012,
                       "Unable to create debugFS rports node.\n");
                goto out;
index 0556969f6dc1bb5e65a92a6bd189afe733f49498..a4a56ab0ba7473f9c6258ed56e8d8bf03ca9aa7a 100644 (file)
@@ -577,7 +577,7 @@ fcport_is_bigger(fc_port_t *fcport)
 static inline struct qla_qpair *
 qla_mapq_nvme_select_qpair(struct qla_hw_data *ha, struct qla_qpair *qpair)
 {
-       int cpuid = smp_processor_id();
+       int cpuid = raw_smp_processor_id();
 
        if (qpair->cpuid != cpuid &&
            ha->qp_cpu_map[cpuid]) {
index e987881918978a66bb05fe32fa53d561554fbeff..d48007e182881b1fcc3aada1327fe77e600d3e2b 100644 (file)
@@ -3965,7 +3965,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
        if (!ha->flags.fw_started)
                return;
 
-       if (rsp->qpair->cpuid != smp_processor_id() || !rsp->qpair->rcv_intr) {
+       if (rsp->qpair->cpuid != raw_smp_processor_id() || !rsp->qpair->rcv_intr) {
                rsp->qpair->rcv_intr = 1;
 
                if (!rsp->qpair->cpu_mapped)
@@ -4468,7 +4468,7 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id)
        }
        ha = qpair->hw;
 
-       queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
+       queue_work(ha->wq, &qpair->q_work);
 
        return IRQ_HANDLED;
 }
@@ -4494,7 +4494,7 @@ qla2xxx_msix_rsp_q_hs(int irq, void *dev_id)
        wrt_reg_dword(&reg->hccr, HCCRX_CLR_RISC_INT);
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
-       queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
+       queue_work(ha->wq, &qpair->q_work);
 
        return IRQ_HANDLED;
 }
index db753d71299109dcb0b8601f50ba9093fca03e32..a8ddf356e6626038fcaf17df560259bad772fec3 100644 (file)
@@ -399,14 +399,14 @@ static int qla_nvme_xmt_ls_rsp(struct nvme_fc_local_port *lport,
        nvme->u.nvme.dl = 0;
        nvme->u.nvme.timeout_sec = 0;
        nvme->u.nvme.cmd_dma = fd_resp->rspdma;
-       nvme->u.nvme.cmd_len = fd_resp->rsplen;
+       nvme->u.nvme.cmd_len = cpu_to_le32(fd_resp->rsplen);
        nvme->u.nvme.rsp_len = 0;
        nvme->u.nvme.rsp_dma = 0;
        nvme->u.nvme.exchange_address = uctx->exchange_address;
        nvme->u.nvme.nport_handle = uctx->nport_handle;
        nvme->u.nvme.ox_id = uctx->ox_id;
        dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
-                                  le32_to_cpu(fd_resp->rsplen), DMA_TO_DEVICE);
+                                  fd_resp->rsplen, DMA_TO_DEVICE);
 
        ql_dbg(ql_dbg_unsol, vha, 0x2122,
               "Unsol lsreq portid=%06x %8phC exchange_address 0x%x ox_id 0x%x hdl 0x%x\n",
@@ -504,13 +504,13 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
        nvme->u.nvme.desc = fd;
        nvme->u.nvme.dir = 0;
        nvme->u.nvme.dl = 0;
-       nvme->u.nvme.cmd_len = fd->rqstlen;
-       nvme->u.nvme.rsp_len = fd->rsplen;
+       nvme->u.nvme.cmd_len = cpu_to_le32(fd->rqstlen);
+       nvme->u.nvme.rsp_len = cpu_to_le32(fd->rsplen);
        nvme->u.nvme.rsp_dma = fd->rspdma;
        nvme->u.nvme.timeout_sec = fd->timeout;
        nvme->u.nvme.cmd_dma = fd->rqstdma;
        dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
-           le32_to_cpu(fd->rqstlen), DMA_TO_DEVICE);
+           fd->rqstlen, DMA_TO_DEVICE);
 
        rval = qla2x00_start_sp(sp);
        if (rval != QLA_SUCCESS) {
index 2b815a9928ea3db0ecaa35172649d88b1e86bea6..2ef2dbac0db2739d82c590f4afd987e893230931 100644 (file)
@@ -4425,8 +4425,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
                queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work);
        } else if (ha->msix_count) {
                if (cmd->atio.u.isp24.fcp_cmnd.rddata)
-                       queue_work_on(smp_processor_id(), qla_tgt_wq,
-                           &cmd->work);
+                       queue_work(qla_tgt_wq, &cmd->work);
                else
                        queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq,
                            &cmd->work);
index 3b5ba4b47b3b2717708b64f6e85fec986513070a..68a0e6a2fb6e98fa60a68c81e56fa87e4a1c1bcb 100644 (file)
@@ -310,7 +310,7 @@ static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd)
        cmd->trc_flags |= TRC_CMD_DONE;
 
        INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free);
-       queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
+       queue_work(tcm_qla2xxx_free_wq, &cmd->work);
 }
 
 /*
@@ -547,7 +547,7 @@ static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
        cmd->trc_flags |= TRC_DATA_IN;
        cmd->cmd_in_wq = 1;
        INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
-       queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
+       queue_work(tcm_qla2xxx_free_wq, &cmd->work);
 }
 
 static int tcm_qla2xxx_chk_dif_tags(uint32_t tag)
index a8a74c7cb79f85baf691df3bc7994030ed4c17f5..498e35c8db2c1d733cc33a197e5cb04d06fd6c43 100644 (file)
@@ -662,7 +662,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
                if (spi_imx->count >= 512)
                        ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET;
                else
-                       ctrl |= (spi_imx->count*8 - 1)
+                       ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1)
                                << MX51_ECSPI_CTRL_BL_OFFSET;
        }
 
index a7381e774b95391b7780a2181a82ca35a73c773c..57d767a68e7b2766dcea5510809cf2f09e0bef63 100644 (file)
@@ -72,6 +72,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = {
        { PCI_VDEVICE(INTEL, 0x4da4), (unsigned long)&bxt_info },
        { PCI_VDEVICE(INTEL, 0x51a4), (unsigned long)&cnl_info },
        { PCI_VDEVICE(INTEL, 0x54a4), (unsigned long)&cnl_info },
+       { PCI_VDEVICE(INTEL, 0x5794), (unsigned long)&cnl_info },
        { PCI_VDEVICE(INTEL, 0x7a24), (unsigned long)&cnl_info },
        { PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info },
        { PCI_VDEVICE(INTEL, 0x7e23), (unsigned long)&cnl_info },
index 45a4acc956610a911674f811e2d7bf53492fd7a2..c964f41dcc428c100c1b3e4c56912e0eed379f7a 100644 (file)
@@ -1084,6 +1084,13 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
        fspi_writel(f, FSPI_AHBCR_PREF_EN | FSPI_AHBCR_RDADDROPT,
                 base + FSPI_AHBCR);
 
+       /* Reset the FLSHxCR1 registers. */
+       reg = FSPI_FLSHXCR1_TCSH(0x3) | FSPI_FLSHXCR1_TCSS(0x3);
+       fspi_writel(f, reg, base + FSPI_FLSHA1CR1);
+       fspi_writel(f, reg, base + FSPI_FLSHA2CR1);
+       fspi_writel(f, reg, base + FSPI_FLSHB1CR1);
+       fspi_writel(f, reg, base + FSPI_FLSHB2CR1);
+
        /* AHB Read - Set lut sequence ID for all CS. */
        fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA1CR2);
        fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA2CR2);
index b6d66caba4c02eb3e988ad9a5f76317a4244af32..ef665f470c5b5ed3f24efbc5012e04e764d629ae 100644 (file)
@@ -277,6 +277,7 @@ struct stm32_spi_cfg {
  * @fifo_size: size of the embedded fifo in bytes
  * @cur_midi: master inter-data idleness in ns
  * @cur_speed: speed configured in Hz
+ * @cur_half_period: time of a half bit in us
  * @cur_bpw: number of bits in a single SPI data frame
  * @cur_fthlv: fifo threshold level (data frames in a single data packet)
  * @cur_comm: SPI communication mode
@@ -304,6 +305,7 @@ struct stm32_spi {
 
        unsigned int cur_midi;
        unsigned int cur_speed;
+       unsigned int cur_half_period;
        unsigned int cur_bpw;
        unsigned int cur_fthlv;
        unsigned int cur_comm;
@@ -468,6 +470,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz,
 
        spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
+       spi->cur_half_period = DIV_ROUND_CLOSEST(USEC_PER_SEC, 2 * spi->cur_speed);
+
        return mbrdiv - 1;
 }
 
@@ -709,6 +713,10 @@ static void stm32h7_spi_disable(struct stm32_spi *spi)
                return;
        }
 
+       /* Add a delay to make sure that transmission is ended. */
+       if (spi->cur_half_period)
+               udelay(spi->cur_half_period);
+
        if (spi->cur_usedma && spi->dma_tx)
                dmaengine_terminate_async(spi->dma_tx);
        if (spi->cur_usedma && spi->dma_rx)
index 94d9a33d9af56e8c76bf7b14937d97bec190a3a9..9a46b2478f4e98bd38c794b17fa7a2bdae4e36f4 100644 (file)
@@ -1340,9 +1340,9 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
        return 0;
 
 clk_dis_all:
-       pm_runtime_put_sync(&pdev->dev);
-       pm_runtime_set_suspended(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_set_suspended(&pdev->dev);
        clk_disable_unprepare(xqspi->refclk);
 clk_dis_pclk:
        clk_disable_unprepare(xqspi->pclk);
@@ -1366,11 +1366,15 @@ static void zynqmp_qspi_remove(struct platform_device *pdev)
 {
        struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev);
 
+       pm_runtime_get_sync(&pdev->dev);
+
        zynqmp_gqspi_write(xqspi, GQSPI_EN_OFST, 0x0);
+
+       pm_runtime_disable(&pdev->dev);
+       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_set_suspended(&pdev->dev);
        clk_disable_unprepare(xqspi->refclk);
        clk_disable_unprepare(xqspi->pclk);
-       pm_runtime_set_suspended(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
 }
 
 MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match);
index 936e5ff1b209ecb9df704766d214326eee5e811d..d5860c1c1f469e5528dc69202e75697b57a794c2 100644 (file)
@@ -1392,16 +1392,16 @@ static ssize_t target_wwn_vendor_id_store(struct config_item *item,
        /* +2 to allow for a trailing (stripped) '\n' and null-terminator */
        unsigned char buf[INQUIRY_VENDOR_LEN + 2];
        char *stripped = NULL;
-       size_t len;
+       ssize_t len;
        ssize_t ret;
 
-       len = strlcpy(buf, page, sizeof(buf));
-       if (len < sizeof(buf)) {
+       len = strscpy(buf, page, sizeof(buf));
+       if (len > 0) {
                /* Strip any newline added from userspace. */
                stripped = strstrip(buf);
                len = strlen(stripped);
        }
-       if (len > INQUIRY_VENDOR_LEN) {
+       if (len < 0 || len > INQUIRY_VENDOR_LEN) {
                pr_err("Emulated T10 Vendor Identification exceeds"
                        " INQUIRY_VENDOR_LEN: " __stringify(INQUIRY_VENDOR_LEN)
                        "\n");
@@ -1448,16 +1448,16 @@ static ssize_t target_wwn_product_id_store(struct config_item *item,
        /* +2 to allow for a trailing (stripped) '\n' and null-terminator */
        unsigned char buf[INQUIRY_MODEL_LEN + 2];
        char *stripped = NULL;
-       size_t len;
+       ssize_t len;
        ssize_t ret;
 
-       len = strlcpy(buf, page, sizeof(buf));
-       if (len < sizeof(buf)) {
+       len = strscpy(buf, page, sizeof(buf));
+       if (len > 0) {
                /* Strip any newline added from userspace. */
                stripped = strstrip(buf);
                len = strlen(stripped);
        }
-       if (len > INQUIRY_MODEL_LEN) {
+       if (len < 0 || len > INQUIRY_MODEL_LEN) {
                pr_err("Emulated T10 Vendor exceeds INQUIRY_MODEL_LEN: "
                         __stringify(INQUIRY_MODEL_LEN)
                        "\n");
@@ -1504,16 +1504,16 @@ static ssize_t target_wwn_revision_store(struct config_item *item,
        /* +2 to allow for a trailing (stripped) '\n' and null-terminator */
        unsigned char buf[INQUIRY_REVISION_LEN + 2];
        char *stripped = NULL;
-       size_t len;
+       ssize_t len;
        ssize_t ret;
 
-       len = strlcpy(buf, page, sizeof(buf));
-       if (len < sizeof(buf)) {
+       len = strscpy(buf, page, sizeof(buf));
+       if (len > 0) {
                /* Strip any newline added from userspace. */
                stripped = strstrip(buf);
                len = strlen(stripped);
        }
-       if (len > INQUIRY_REVISION_LEN) {
+       if (len < 0 || len > INQUIRY_REVISION_LEN) {
                pr_err("Emulated T10 Revision exceeds INQUIRY_REVISION_LEN: "
                         __stringify(INQUIRY_REVISION_LEN)
                        "\n");
index 687adc9e086ca942ba85dd591ab3b7bf76cc9192..0686882bcbda351fbf5c46b6a66cdf4cfe35e9e0 100644 (file)
@@ -264,6 +264,7 @@ void target_free_cmd_counter(struct target_cmd_counter *cmd_cnt)
                percpu_ref_put(&cmd_cnt->refcnt);
 
        percpu_ref_exit(&cmd_cnt->refcnt);
+       kfree(cmd_cnt);
 }
 EXPORT_SYMBOL_GPL(target_free_cmd_counter);
 
index 8717a33435125ca33009e79afd89983c1a742dda..58533ea75cd92563a19acd07e37f9095031eb9a7 100644 (file)
@@ -348,12 +348,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip_id)
        struct thermal_trip trip;
 
        /* Ignore disabled trip points */
-       if (test_bit(trip_id, &tz->trips_disabled) ||
-           trip.temperature == THERMAL_TEMP_INVALID)
+       if (test_bit(trip_id, &tz->trips_disabled))
                return;
 
        __thermal_zone_get_trip(tz, trip_id, &trip);
 
+       if (trip.temperature == THERMAL_TEMP_INVALID)
+               return;
+
        if (tz->last_temperature != THERMAL_TEMP_INVALID) {
                if (tz->last_temperature < trip.temperature &&
                    tz->temperature >= trip.temperature)
index 4ca905723429c7653e8add3f389602c12b80b439..1e0655b63259fe391f8a43a3a71f01172b5f74b8 100644 (file)
@@ -37,8 +37,10 @@ static int of_find_trip_id(struct device_node *np, struct device_node *trip)
         */
        for_each_child_of_node(trips, t) {
 
-               if (t == trip)
+               if (t == trip) {
+                       of_node_put(t);
                        goto out;
+               }
                i++;
        }
 
@@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz,
 
        for_each_child_of_node(cm_np, child) {
                ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
-               if (ret)
+               if (ret) {
+                       of_node_put(child);
                        break;
+               }
        }
 
        of_node_put(cm_np);
index 6ba2613627e135bde426de1fc6148ece29ac9298..0cf0826b805a998abd0d4e2cfa6938de8a46c4f0 100644 (file)
@@ -110,7 +110,8 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem
 }
 
 static int __ti_thermal_get_trend(struct thermal_zone_device *tz,
-                                 struct thermal_trip *trip, enum thermal_trend *trend)
+                                 const struct thermal_trip *trip,
+                                 enum thermal_trend *trend)
 {
        struct ti_thermal_data *data = thermal_zone_device_priv(tz);
        struct ti_bandgap *bgp;
index 93417518c04d15c2403b5742117c909bea8be6e9..c2df07545f966bb566846341bdafabb6ead242ad 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/regulator/consumer.h>
 #include <linux/sched/clock.h>
+#include <linux/iopoll.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_driver.h>
@@ -2299,7 +2300,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
  */
 static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
 {
-       return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY;
+       u32 val;
+       int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
+                                   500, UIC_CMD_TIMEOUT * 1000, false, hba,
+                                   REG_CONTROLLER_STATUS);
+       return ret == 0 ? true : false;
 }
 
 /**
@@ -2392,7 +2397,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd,
                      bool completion)
 {
        lockdep_assert_held(&hba->uic_cmd_mutex);
-       lockdep_assert_held(hba->host->host_lock);
 
        if (!ufshcd_ready_for_uic_cmd(hba)) {
                dev_err(hba->dev,
@@ -2419,7 +2423,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd,
 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 {
        int ret;
-       unsigned long flags;
 
        if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD)
                return 0;
@@ -2428,9 +2431,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
        mutex_lock(&hba->uic_cmd_mutex);
        ufshcd_add_delay_before_dme_cmd(hba);
 
-       spin_lock_irqsave(hba->host->host_lock, flags);
        ret = __ufshcd_send_uic_cmd(hba, uic_cmd, true);
-       spin_unlock_irqrestore(hba->host->host_lock, flags);
        if (!ret)
                ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
 
@@ -4133,8 +4134,8 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)
                wmb();
                reenable_intr = true;
        }
-       ret = __ufshcd_send_uic_cmd(hba, cmd, false);
        spin_unlock_irqrestore(hba->host->host_lock, flags);
+       ret = __ufshcd_send_uic_cmd(hba, cmd, false);
        if (ret) {
                dev_err(hba->dev,
                        "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
index 0c7bf88d4a7fbec2697aabf5e6d3023290d7ffa3..f67733cecfdf5d2b19a1dc8cfb40f78b901bbd11 100644 (file)
@@ -84,6 +84,9 @@ void ucsi_debugfs_register(struct ucsi *ucsi)
 
 void ucsi_debugfs_unregister(struct ucsi *ucsi)
 {
+       if (IS_ERR_OR_NULL(ucsi) || !ucsi->debugfs)
+               return;
+
        debugfs_remove_recursive(ucsi->debugfs->dentry);
        kfree(ucsi->debugfs);
 }
index 955d938eb6633aa840f693f0aa23a1d118515fdc..7b8fd977f71ccf5ad32c026fda42ad44606cfef3 100644 (file)
@@ -123,8 +123,18 @@ static inline ssize_t vringh_iov_xfer(struct vringh *vrh,
                done += partlen;
                len -= partlen;
                ptr += partlen;
+               iov->consumed += partlen;
+               iov->iov[iov->i].iov_len -= partlen;
+               iov->iov[iov->i].iov_base += partlen;
 
-               vringh_kiov_advance(iov, partlen);
+               if (!iov->iov[iov->i].iov_len) {
+                       /* Fix up old iov element then increment. */
+                       iov->iov[iov->i].iov_len = iov->consumed;
+                       iov->iov[iov->i].iov_base -= iov->consumed;
+
+                       iov->consumed = 0;
+                       iov->i++;
+               }
        }
        return done;
 }
index c1de8a92e144bd0336c28f3e7b2f6b6b21098571..b2d76c1784bd8a27f004ce20d21cfb754311f6ad 100644 (file)
@@ -551,7 +551,7 @@ static struct i2c_driver ds2482_driver = {
        .driver = {
                .name   = "ds2482",
        },
-       .probe_new      = ds2482_probe,
+       .probe          = ds2482_probe,
        .remove         = ds2482_remove,
        .id_table       = ds2482_id,
 };
index 3bdd5b59661de53300744be47abc5cb6cb6722ee..0bb86e6c4d0aaa78a72960d369e2a56b1feb5137 100644 (file)
@@ -1704,7 +1704,7 @@ void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl)
        generic_handle_irq(irq);
 }
 
-static int __xen_evtchn_do_upcall(void)
+int xen_evtchn_do_upcall(void)
 {
        struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
        int ret = vcpu_info->evtchn_upcall_pending ? IRQ_HANDLED : IRQ_NONE;
@@ -1735,24 +1735,7 @@ static int __xen_evtchn_do_upcall(void)
 
        return ret;
 }
-
-void xen_evtchn_do_upcall(struct pt_regs *regs)
-{
-       struct pt_regs *old_regs = set_irq_regs(regs);
-
-       irq_enter();
-
-       __xen_evtchn_do_upcall();
-
-       irq_exit();
-       set_irq_regs(old_regs);
-}
-
-int xen_hvm_evtchn_do_upcall(void)
-{
-       return __xen_evtchn_do_upcall();
-}
-EXPORT_SYMBOL_GPL(xen_hvm_evtchn_do_upcall);
+EXPORT_SYMBOL_GPL(xen_evtchn_do_upcall);
 
 /* Rebind a new event channel to an existing irq. */
 void rebind_evtchn_irq(evtchn_port_t evtchn, int irq)
index fcc8191315723c6701ec5e7c5b97a73374b899a8..544d3f9010b92aca1e65a5c192b3ff79e6c19816 100644 (file)
@@ -64,7 +64,7 @@ static uint64_t get_callback_via(struct pci_dev *pdev)
 
 static irqreturn_t do_hvm_evtchn_intr(int irq, void *dev_id)
 {
-       return xen_hvm_evtchn_do_upcall();
+       return xen_evtchn_do_upcall();
 }
 
 static int xen_allocate_irq(struct pci_dev *pdev)
index ac3fca5a5e4162ddc2769f4e5932370d622ae0b4..6954ae763b86f41bea3a087260a66b1ab6170b8f 100644 (file)
@@ -484,10 +484,8 @@ static void end_bio_extent_writepage(struct btrfs_bio *bbio)
                                   bvec->bv_offset, bvec->bv_len);
 
                btrfs_finish_ordered_extent(bbio->ordered, page, start, len, !error);
-               if (error) {
-                       btrfs_page_clear_uptodate(fs_info, page, start, len);
+               if (error)
                        mapping_set_error(page->mapping, error);
-               }
                btrfs_page_clear_writeback(fs_info, page, start, len);
        }
 
@@ -1456,8 +1454,6 @@ done:
        if (ret) {
                btrfs_mark_ordered_io_finished(BTRFS_I(inode), page, page_start,
                                               PAGE_SIZE, !ret);
-               btrfs_page_clear_uptodate(btrfs_sb(inode->i_sb), page,
-                                         page_start, PAGE_SIZE);
                mapping_set_error(page->mapping, ret);
        }
        unlock_page(page);
@@ -1624,8 +1620,6 @@ static void extent_buffer_write_end_io(struct btrfs_bio *bbio)
                struct page *page = bvec->bv_page;
                u32 len = bvec->bv_len;
 
-               if (!uptodate)
-                       btrfs_page_clear_uptodate(fs_info, page, start, len);
                btrfs_page_clear_writeback(fs_info, page, start, len);
                bio_offset += len;
        }
@@ -2201,7 +2195,6 @@ void extent_write_locked_range(struct inode *inode, struct page *locked_page,
                if (ret) {
                        btrfs_mark_ordered_io_finished(BTRFS_I(inode), page,
                                                       cur, cur_len, !ret);
-                       btrfs_page_clear_uptodate(fs_info, page, cur, cur_len);
                        mapping_set_error(page->mapping, ret);
                }
                btrfs_page_unlock_writer(fs_info, page, cur, cur_len);
index ca46a529d56b1999cff4a785661db40dca049e47..361535c71c0f5a172328832e32b6d00f7b14f131 100644 (file)
@@ -1106,6 +1106,25 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode)
        btrfs_drew_write_unlock(&inode->root->snapshot_lock);
 }
 
+static void update_time_for_write(struct inode *inode)
+{
+       struct timespec64 now, ctime;
+
+       if (IS_NOCMTIME(inode))
+               return;
+
+       now = current_time(inode);
+       if (!timespec64_equal(&inode->i_mtime, &now))
+               inode->i_mtime = now;
+
+       ctime = inode_get_ctime(inode);
+       if (!timespec64_equal(&ctime, &now))
+               inode_set_ctime_to_ts(inode, now);
+
+       if (IS_I_VERSION(inode))
+               inode_inc_iversion(inode);
+}
+
 static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
                             size_t count)
 {
@@ -1137,10 +1156,7 @@ static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
         * need to start yet another transaction to update the inode as we will
         * update the inode when we finish writing whatever data we write.
         */
-       if (!IS_NOCMTIME(inode)) {
-               inode->i_mtime = inode_set_ctime_current(inode);
-               inode_inc_iversion(inode);
-       }
+       update_time_for_write(inode);
 
        start_pos = round_down(pos, fs_info->sectorsize);
        oldsize = i_size_read(inode);
@@ -1451,8 +1467,13 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
        if (iocb->ki_flags & IOCB_NOWAIT)
                ilock_flags |= BTRFS_ILOCK_TRY;
 
-       /* If the write DIO is within EOF, use a shared lock */
-       if (iocb->ki_pos + iov_iter_count(from) <= i_size_read(inode))
+       /*
+        * If the write DIO is within EOF, use a shared lock and also only if
+        * security bits will likely not be dropped by file_remove_privs() called
+        * from btrfs_write_check(). Either will need to be rechecked after the
+        * lock was acquired.
+        */
+       if (iocb->ki_pos + iov_iter_count(from) <= i_size_read(inode) && IS_NOSEC(inode))
                ilock_flags |= BTRFS_ILOCK_SHARED;
 
 relock:
@@ -1460,6 +1481,13 @@ relock:
        if (err < 0)
                return err;
 
+       /* Shared lock cannot be used with security bits set. */
+       if ((ilock_flags & BTRFS_ILOCK_SHARED) && !IS_NOSEC(inode)) {
+               btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
+               ilock_flags &= ~BTRFS_ILOCK_SHARED;
+               goto relock;
+       }
+
        err = generic_write_checks(iocb, from);
        if (err <= 0) {
                btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
index f09fbdc43f0f5b15c71d67564cfb264764ff1169..7814b9d654ce1234465bf8ad37a7890e06fd88aa 100644 (file)
@@ -1085,9 +1085,6 @@ static void submit_uncompressed_range(struct btrfs_inode *inode,
                        btrfs_mark_ordered_io_finished(inode, locked_page,
                                                       page_start, PAGE_SIZE,
                                                       !ret);
-                       btrfs_page_clear_uptodate(inode->root->fs_info,
-                                                 locked_page, page_start,
-                                                 PAGE_SIZE);
                        mapping_set_error(locked_page->mapping, ret);
                        unlock_page(locked_page);
                }
@@ -2791,7 +2788,6 @@ out_page:
                mapping_set_error(page->mapping, ret);
                btrfs_mark_ordered_io_finished(inode, page, page_start,
                                               PAGE_SIZE, !ret);
-               btrfs_page_clear_uptodate(fs_info, page, page_start, PAGE_SIZE);
                clear_page_dirty_for_io(page);
        }
        btrfs_page_clear_checked(fs_info, page, page_start, PAGE_SIZE);
@@ -5769,20 +5765,24 @@ out:
 
 static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index)
 {
-       if (dir->index_cnt == (u64)-1) {
-               int ret;
+       int ret = 0;
 
+       btrfs_inode_lock(dir, 0);
+       if (dir->index_cnt == (u64)-1) {
                ret = btrfs_inode_delayed_dir_index_count(dir);
                if (ret) {
                        ret = btrfs_set_inode_index_count(dir);
                        if (ret)
-                               return ret;
+                               goto out;
                }
        }
 
-       *index = dir->index_cnt;
+       /* index_cnt is the index number of next new entry, so decrement it. */
+       *index = dir->index_cnt - 1;
+out:
+       btrfs_inode_unlock(dir, 0);
 
-       return 0;
+       return ret;
 }
 
 /*
@@ -5817,6 +5817,19 @@ static int btrfs_opendir(struct inode *inode, struct file *file)
        return 0;
 }
 
+static loff_t btrfs_dir_llseek(struct file *file, loff_t offset, int whence)
+{
+       struct btrfs_file_private *private = file->private_data;
+       int ret;
+
+       ret = btrfs_get_dir_last_index(BTRFS_I(file_inode(file)),
+                                      &private->last_index);
+       if (ret)
+               return ret;
+
+       return generic_file_llseek(file, offset, whence);
+}
+
 struct dir_entry {
        u64 ino;
        u64 offset;
@@ -10868,7 +10881,7 @@ static const struct inode_operations btrfs_dir_inode_operations = {
 };
 
 static const struct file_operations btrfs_dir_file_operations = {
-       .llseek         = generic_file_llseek,
+       .llseek         = btrfs_dir_llseek,
        .read           = generic_read_dir,
        .iterate_shared = btrfs_real_readdir,
        .open           = btrfs_opendir,
index 09bfe68d2ea3fcc8ca68da3deaf3b9a3ea87342d..cffdd6f7f8e8bb0e46bdbd30128d4b8795574d65 100644 (file)
@@ -2150,7 +2150,7 @@ static struct file_system_type btrfs_fs_type = {
        .name           = "btrfs",
        .mount          = btrfs_mount,
        .kill_sb        = btrfs_kill_super,
-       .fs_flags       = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME,
+       .fs_flags       = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
 };
 
 static struct file_system_type btrfs_root_fs_type = {
@@ -2158,8 +2158,7 @@ static struct file_system_type btrfs_root_fs_type = {
        .name           = "btrfs",
        .mount          = btrfs_mount_root,
        .kill_sb        = btrfs_kill_super,
-       .fs_flags       = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
-                         FS_ALLOW_IDMAP | FS_MGTIME,
+       .fs_flags       = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP,
 };
 
 MODULE_ALIAS_FS("btrfs");
index c5ff16f9e9fa53aaa8779059a903f9bd636ceb02..744f4f4d4c681139648cbb04394cf6d7bce572c9 100644 (file)
@@ -715,7 +715,7 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode,
                                                pgoff_t index,
                                                unsigned long num_ra_pages)
 {
-       struct page *page;
+       struct folio *folio;
        u64 off = (u64)index << PAGE_SHIFT;
        loff_t merkle_pos = merkle_file_pos(inode);
        int ret;
@@ -726,29 +726,36 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode,
                return ERR_PTR(-EFBIG);
        index += merkle_pos >> PAGE_SHIFT;
 again:
-       page = find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED);
-       if (page) {
-               if (PageUptodate(page))
-                       return page;
+       folio = __filemap_get_folio(inode->i_mapping, index, FGP_ACCESSED, 0);
+       if (!IS_ERR(folio)) {
+               if (folio_test_uptodate(folio))
+                       goto out;
 
-               lock_page(page);
-               /*
-                * We only insert uptodate pages, so !Uptodate has to be
-                * an error
-                */
-               if (!PageUptodate(page)) {
-                       unlock_page(page);
-                       put_page(page);
+               folio_lock(folio);
+               /* If it's not uptodate after we have the lock, we got a read error. */
+               if (!folio_test_uptodate(folio)) {
+                       folio_unlock(folio);
+                       folio_put(folio);
                        return ERR_PTR(-EIO);
                }
-               unlock_page(page);
-               return page;
+               folio_unlock(folio);
+               goto out;
        }
 
-       page = __page_cache_alloc(mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS));
-       if (!page)
+       folio = filemap_alloc_folio(mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS),
+                                   0);
+       if (!folio)
                return ERR_PTR(-ENOMEM);
 
+       ret = filemap_add_folio(inode->i_mapping, folio, index, GFP_NOFS);
+       if (ret) {
+               folio_put(folio);
+               /* Did someone else insert a folio here? */
+               if (ret == -EEXIST)
+                       goto again;
+               return ERR_PTR(ret);
+       }
+
        /*
         * Merkle item keys are indexed from byte 0 in the merkle tree.
         * They have the form:
@@ -756,28 +763,19 @@ again:
         * [ inode objectid, BTRFS_MERKLE_ITEM_KEY, offset in bytes ]
         */
        ret = read_key_bytes(BTRFS_I(inode), BTRFS_VERITY_MERKLE_ITEM_KEY, off,
-                            page_address(page), PAGE_SIZE, page);
+                            folio_address(folio), PAGE_SIZE, &folio->page);
        if (ret < 0) {
-               put_page(page);
+               folio_put(folio);
                return ERR_PTR(ret);
        }
        if (ret < PAGE_SIZE)
-               memzero_page(page, ret, PAGE_SIZE - ret);
+               folio_zero_segment(folio, ret, PAGE_SIZE);
 
-       SetPageUptodate(page);
-       ret = add_to_page_cache_lru(page, inode->i_mapping, index, GFP_NOFS);
+       folio_mark_uptodate(folio);
+       folio_unlock(folio);
 
-       if (!ret) {
-               /* Inserted and ready for fsverity */
-               unlock_page(page);
-       } else {
-               put_page(page);
-               /* Did someone race us into inserting this page? */
-               if (ret == -EEXIST)
-                       goto again;
-               page = ERR_PTR(ret);
-       }
-       return page;
+out:
+       return folio_file_page(folio, index);
 }
 
 /*
index e028fafa04f38c51739bb56c796bb5d854c7c4ba..996271473609a0dbde8cd3db3eadb73e35d2510d 100644 (file)
@@ -32,10 +32,16 @@ static int efivarfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        u64 storage_space, remaining_space, max_variable_size;
        efi_status_t status;
 
-       status = efivar_query_variable_info(attr, &storage_space, &remaining_space,
-                                           &max_variable_size);
-       if (status != EFI_SUCCESS)
-               return efi_status_to_err(status);
+       /* Some UEFI firmware does not implement QueryVariableInfo() */
+       storage_space = remaining_space = 0;
+       if (efi_rt_services_supported(EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)) {
+               status = efivar_query_variable_info(attr, &storage_space,
+                                                   &remaining_space,
+                                                   &max_variable_size);
+               if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED)
+                       pr_warn_ratelimited("query_variable_info() failed: 0x%lx\n",
+                                           status);
+       }
 
        /*
         * This is not a normal filesystem, so no point in pretending it has a block
index c91db9f57524c4eef9c8c33bb195721784969e7b..1e599305d85fa2b0a4356c2ac9cd4eef905ab456 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/nospec.h>
 #include <linux/backing-dev.h>
+#include <linux/freezer.h>
 #include <trace/events/ext4.h>
 
 /*
@@ -6906,6 +6907,21 @@ __acquires(bitlock)
        return ret;
 }
 
+static ext4_grpblk_t ext4_last_grp_cluster(struct super_block *sb,
+                                          ext4_group_t grp)
+{
+       if (grp < ext4_get_groups_count(sb))
+               return EXT4_CLUSTERS_PER_GROUP(sb) - 1;
+       return (ext4_blocks_count(EXT4_SB(sb)->s_es) -
+               ext4_group_first_block_no(sb, grp) - 1) >>
+                                       EXT4_CLUSTER_BITS(sb);
+}
+
+static bool ext4_trim_interrupted(void)
+{
+       return fatal_signal_pending(current) || freezing(current);
+}
+
 static int ext4_try_to_trim_range(struct super_block *sb,
                struct ext4_buddy *e4b, ext4_grpblk_t start,
                ext4_grpblk_t max, ext4_grpblk_t minblocks)
@@ -6913,9 +6929,12 @@ __acquires(ext4_group_lock_ptr(sb, e4b->bd_group))
 __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
 {
        ext4_grpblk_t next, count, free_count;
+       bool set_trimmed = false;
        void *bitmap;
 
        bitmap = e4b->bd_bitmap;
+       if (start == 0 && max >= ext4_last_grp_cluster(sb, e4b->bd_group))
+               set_trimmed = true;
        start = max(e4b->bd_info->bb_first_free, start);
        count = 0;
        free_count = 0;
@@ -6930,16 +6949,14 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
                        int ret = ext4_trim_extent(sb, start, next - start, e4b);
 
                        if (ret && ret != -EOPNOTSUPP)
-                               break;
+                               return count;
                        count += next - start;
                }
                free_count += next - start;
                start = next + 1;
 
-               if (fatal_signal_pending(current)) {
-                       count = -ERESTARTSYS;
-                       break;
-               }
+               if (ext4_trim_interrupted())
+                       return count;
 
                if (need_resched()) {
                        ext4_unlock_group(sb, e4b->bd_group);
@@ -6951,6 +6968,9 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
                        break;
        }
 
+       if (set_trimmed)
+               EXT4_MB_GRP_SET_TRIMMED(e4b->bd_info);
+
        return count;
 }
 
@@ -6961,7 +6981,6 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
  * @start:             first group block to examine
  * @max:               last group block to examine
  * @minblocks:         minimum extent block count
- * @set_trimmed:       set the trimmed flag if at least one block is trimmed
  *
  * ext4_trim_all_free walks through group's block bitmap searching for free
  * extents. When the free extent is found, mark it as used in group buddy
@@ -6971,7 +6990,7 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
 static ext4_grpblk_t
 ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
                   ext4_grpblk_t start, ext4_grpblk_t max,
-                  ext4_grpblk_t minblocks, bool set_trimmed)
+                  ext4_grpblk_t minblocks)
 {
        struct ext4_buddy e4b;
        int ret;
@@ -6988,13 +7007,10 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
        ext4_lock_group(sb, group);
 
        if (!EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) ||
-           minblocks < EXT4_SB(sb)->s_last_trim_minblks) {
+           minblocks < EXT4_SB(sb)->s_last_trim_minblks)
                ret = ext4_try_to_trim_range(sb, &e4b, start, max, minblocks);
-               if (ret >= 0 && set_trimmed)
-                       EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info);
-       } else {
+       else
                ret = 0;
-       }
 
        ext4_unlock_group(sb, group);
        ext4_mb_unload_buddy(&e4b);
@@ -7027,7 +7043,6 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
        ext4_fsblk_t first_data_blk =
                        le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
        ext4_fsblk_t max_blks = ext4_blocks_count(EXT4_SB(sb)->s_es);
-       bool whole_group, eof = false;
        int ret = 0;
 
        start = range->start >> sb->s_blocksize_bits;
@@ -7046,10 +7061,8 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
                if (minlen > EXT4_CLUSTERS_PER_GROUP(sb))
                        goto out;
        }
-       if (end >= max_blks - 1) {
+       if (end >= max_blks - 1)
                end = max_blks - 1;
-               eof = true;
-       }
        if (end <= first_data_blk)
                goto out;
        if (start < first_data_blk)
@@ -7063,9 +7076,10 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
 
        /* end now represents the last cluster to discard in this group */
        end = EXT4_CLUSTERS_PER_GROUP(sb) - 1;
-       whole_group = true;
 
        for (group = first_group; group <= last_group; group++) {
+               if (ext4_trim_interrupted())
+                       break;
                grp = ext4_get_group_info(sb, group);
                if (!grp)
                        continue;
@@ -7082,13 +7096,11 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
                 * change it for the last group, note that last_cluster is
                 * already computed earlier by ext4_get_group_no_and_offset()
                 */
-               if (group == last_group) {
+               if (group == last_group)
                        end = last_cluster;
-                       whole_group = eof ? true : end == EXT4_CLUSTERS_PER_GROUP(sb) - 1;
-               }
                if (grp->bb_free >= minlen) {
                        cnt = ext4_trim_all_free(sb, group, first_cluster,
-                                                end, minlen, whole_group);
+                                                end, minlen);
                        if (cnt < 0) {
                                ret = cnt;
                                break;
index 41a6411c600b1cba08ed24b667913a563f2d3b90..bbda587f76b85ab0a6840c4cf19b45151ea3f26b 100644 (file)
@@ -343,17 +343,17 @@ static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode,
                                                   struct buffer_head *bh)
 {
        struct ext4_dir_entry_tail *t;
+       int blocksize = EXT4_BLOCK_SIZE(inode->i_sb);
 
 #ifdef PARANOID
        struct ext4_dir_entry *d, *top;
 
        d = (struct ext4_dir_entry *)bh->b_data;
        top = (struct ext4_dir_entry *)(bh->b_data +
-               (EXT4_BLOCK_SIZE(inode->i_sb) -
-                sizeof(struct ext4_dir_entry_tail)));
-       while (d < top && d->rec_len)
+               (blocksize - sizeof(struct ext4_dir_entry_tail)));
+       while (d < top && ext4_rec_len_from_disk(d->rec_len, blocksize))
                d = (struct ext4_dir_entry *)(((void *)d) +
-                   le16_to_cpu(d->rec_len));
+                   ext4_rec_len_from_disk(d->rec_len, blocksize));
 
        if (d != top)
                return NULL;
@@ -364,7 +364,8 @@ static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode,
 #endif
 
        if (t->det_reserved_zero1 ||
-           le16_to_cpu(t->det_rec_len) != sizeof(struct ext4_dir_entry_tail) ||
+           (ext4_rec_len_from_disk(t->det_rec_len, blocksize) !=
+            sizeof(struct ext4_dir_entry_tail)) ||
            t->det_reserved_zero2 ||
            t->det_reserved_ft != EXT4_FT_DIR_CSUM)
                return NULL;
@@ -445,13 +446,14 @@ static struct dx_countlimit *get_dx_countlimit(struct inode *inode,
        struct ext4_dir_entry *dp;
        struct dx_root_info *root;
        int count_offset;
+       int blocksize = EXT4_BLOCK_SIZE(inode->i_sb);
+       unsigned int rlen = ext4_rec_len_from_disk(dirent->rec_len, blocksize);
 
-       if (le16_to_cpu(dirent->rec_len) == EXT4_BLOCK_SIZE(inode->i_sb))
+       if (rlen == blocksize)
                count_offset = 8;
-       else if (le16_to_cpu(dirent->rec_len) == 12) {
+       else if (rlen == 12) {
                dp = (struct ext4_dir_entry *)(((void *)dirent) + 12);
-               if (le16_to_cpu(dp->rec_len) !=
-                   EXT4_BLOCK_SIZE(inode->i_sb) - 12)
+               if (ext4_rec_len_from_disk(dp->rec_len, blocksize) != blocksize - 12)
                        return NULL;
                root = (struct dx_root_info *)(((void *)dp + 12));
                if (root->reserved_zero ||
@@ -1315,6 +1317,7 @@ static int dx_make_map(struct inode *dir, struct buffer_head *bh,
        unsigned int buflen = bh->b_size;
        char *base = bh->b_data;
        struct dx_hash_info h = *hinfo;
+       int blocksize = EXT4_BLOCK_SIZE(dir->i_sb);
 
        if (ext4_has_metadata_csum(dir->i_sb))
                buflen -= sizeof(struct ext4_dir_entry_tail);
@@ -1335,11 +1338,12 @@ static int dx_make_map(struct inode *dir, struct buffer_head *bh,
                        map_tail--;
                        map_tail->hash = h.hash;
                        map_tail->offs = ((char *) de - base)>>2;
-                       map_tail->size = le16_to_cpu(de->rec_len);
+                       map_tail->size = ext4_rec_len_from_disk(de->rec_len,
+                                                               blocksize);
                        count++;
                        cond_resched();
                }
-               de = ext4_next_entry(de, dir->i_sb->s_blocksize);
+               de = ext4_next_entry(de, blocksize);
        }
        return count;
 }
index 38217422f938833f2eb9312f80da735190080dd6..dbebd8b3127e514e7dc165ced48da0b6ff3cd7da 100644 (file)
@@ -7314,7 +7314,7 @@ static struct file_system_type ext4_fs_type = {
        .init_fs_context        = ext4_init_fs_context,
        .parameters             = ext4_param_specs,
        .kill_sb                = ext4_kill_sb,
-       .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME,
+       .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
 };
 MODULE_ALIAS_FS("ext4");
 
index 9cbf8d98489a4a67b05c8e2cfae16d34aeb594d9..4a280be229a6517b3a9bdd219051b0967af0249f 100644 (file)
@@ -2010,7 +2010,9 @@ static long gfs2_scan_glock_lru(int nr)
                if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
                        if (!spin_trylock(&gl->gl_lockref.lock))
                                continue;
-                       if (!gl->gl_lockref.count) {
+                       if (gl->gl_lockref.count <= 1 &&
+                           (gl->gl_state == LM_ST_UNLOCKED ||
+                            demote_ok(gl))) {
                                list_move(&gl->gl_lru, &dispose);
                                atomic_dec(&lru_count);
                                freed++;
index d26759a98b1074d417be5ecf2c1c52e934af73fd..f41ca89d216bc243a405b70482301649098fcba0 100644 (file)
@@ -567,15 +567,16 @@ static void freeze_go_callback(struct gfs2_glock *gl, bool remote)
        struct super_block *sb = sdp->sd_vfs;
 
        if (!remote ||
-           gl->gl_state != LM_ST_SHARED ||
+           (gl->gl_state != LM_ST_SHARED &&
+            gl->gl_state != LM_ST_UNLOCKED) ||
            gl->gl_demote_state != LM_ST_UNLOCKED)
                return;
 
        /*
         * Try to get an active super block reference to prevent racing with
-        * unmount (see trylock_super()).  But note that unmount isn't the only
-        * place where a write lock on s_umount is taken, and we can fail here
-        * because of things like remount as well.
+        * unmount (see super_trylock_shared()).  But note that unmount isn't
+        * the only place where a write lock on s_umount is taken, and we can
+        * fail here because of things like remount as well.
         */
        if (down_read_trylock(&sb->s_umount)) {
                atomic_inc(&sb->s_active);
index 21ada332d55571021bda02fb55be74da43952388..1429945215a039dad28c05de4bc419ad0ebd6b79 100644 (file)
@@ -50,7 +50,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
        ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
        if (ret)
                return ret;
-       if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
+       if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON &&
+           sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET)
                return 0;
        ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid, ap);
        if (ret)
index 35fd688168c553d1a270485fada1819db60c4918..84bc3c76e5ccb5d800172dfe76be3d3d80ecc2ff 100644 (file)
@@ -2102,52 +2102,10 @@ int file_remove_privs(struct file *file)
 }
 EXPORT_SYMBOL(file_remove_privs);
 
-/**
- * current_mgtime - Return FS time (possibly fine-grained)
- * @inode: inode.
- *
- * Return the current time truncated to the time granularity supported by
- * the fs, as suitable for a ctime/mtime change. If the ctime is flagged
- * as having been QUERIED, get a fine-grained timestamp.
- */
-struct timespec64 current_mgtime(struct inode *inode)
-{
-       struct timespec64 now, ctime;
-       atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
-       long nsec = atomic_long_read(pnsec);
-
-       if (nsec & I_CTIME_QUERIED) {
-               ktime_get_real_ts64(&now);
-               return timestamp_truncate(now, inode);
-       }
-
-       ktime_get_coarse_real_ts64(&now);
-       now = timestamp_truncate(now, inode);
-
-       /*
-        * If we've recently fetched a fine-grained timestamp
-        * then the coarse-grained one may still be earlier than the
-        * existing ctime. Just keep the existing value if so.
-        */
-       ctime = inode_get_ctime(inode);
-       if (timespec64_compare(&ctime, &now) > 0)
-               now = ctime;
-
-       return now;
-}
-EXPORT_SYMBOL(current_mgtime);
-
-static struct timespec64 current_ctime(struct inode *inode)
-{
-       if (is_mgtime(inode))
-               return current_mgtime(inode);
-       return current_time(inode);
-}
-
 static int inode_needs_update_time(struct inode *inode)
 {
        int sync_it = 0;
-       struct timespec64 now = current_ctime(inode);
+       struct timespec64 now = current_time(inode);
        struct timespec64 ctime;
 
        /* First try to exhaust all avenues to not sync */
@@ -2578,43 +2536,9 @@ EXPORT_SYMBOL(current_time);
  */
 struct timespec64 inode_set_ctime_current(struct inode *inode)
 {
-       struct timespec64 now;
-       struct timespec64 ctime;
-
-       ctime.tv_nsec = READ_ONCE(inode->__i_ctime.tv_nsec);
-       if (!(ctime.tv_nsec & I_CTIME_QUERIED)) {
-               now = current_time(inode);
+       struct timespec64 now = current_time(inode);
 
-               /* Just copy it into place if it's not multigrain */
-               if (!is_mgtime(inode)) {
-                       inode_set_ctime_to_ts(inode, now);
-                       return now;
-               }
-
-               /*
-                * If we've recently updated with a fine-grained timestamp,
-                * then the coarse-grained one may still be earlier than the
-                * existing ctime. Just keep the existing value if so.
-                */
-               ctime.tv_sec = inode->__i_ctime.tv_sec;
-               if (timespec64_compare(&ctime, &now) > 0)
-                       return ctime;
-
-               /*
-                * Ctime updates are usually protected by the inode_lock, but
-                * we can still race with someone setting the QUERIED flag.
-                * Try to swap the new nsec value into place. If it's changed
-                * in the interim, then just go with a fine-grained timestamp.
-                */
-               if (cmpxchg(&inode->__i_ctime.tv_nsec, ctime.tv_nsec,
-                           now.tv_nsec) != ctime.tv_nsec)
-                       goto fine_grained;
-               inode->__i_ctime.tv_sec = now.tv_sec;
-               return now;
-       }
-fine_grained:
-       ktime_get_real_ts64(&now);
-       inode_set_ctime_to_ts(inode, timestamp_truncate(now, inode));
+       inode_set_ctime(inode, now.tv_sec, now.tv_nsec);
        return now;
 }
 EXPORT_SYMBOL(inode_set_ctime_current);
index 1073259902a60b47a6504d9ce4b7ae4d19d81bb0..8d6f934c3d9543d3c87a77f5ec3566df7a2b2a37 100644 (file)
@@ -298,14 +298,12 @@ static int journal_finish_inode_data_buffers(journal_t *journal,
 
 static __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh)
 {
-       struct page *page = bh->b_page;
        char *addr;
        __u32 checksum;
 
-       addr = kmap_atomic(page);
-       checksum = crc32_be(crc32_sum,
-               (void *)(addr + offset_in_page(bh->b_data)), bh->b_size);
-       kunmap_atomic(addr);
+       addr = kmap_local_folio(bh->b_folio, bh_offset(bh));
+       checksum = crc32_be(crc32_sum, addr, bh->b_size);
+       kunmap_local(addr);
 
        return checksum;
 }
@@ -322,7 +320,6 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
                                    struct buffer_head *bh, __u32 sequence)
 {
        journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag;
-       struct page *page = bh->b_page;
        __u8 *addr;
        __u32 csum32;
        __be32 seq;
@@ -331,11 +328,10 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
                return;
 
        seq = cpu_to_be32(sequence);
-       addr = kmap_atomic(page);
+       addr = kmap_local_folio(bh->b_folio, bh_offset(bh));
        csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
-       csum32 = jbd2_chksum(j, csum32, addr + offset_in_page(bh->b_data),
-                            bh->b_size);
-       kunmap_atomic(addr);
+       csum32 = jbd2_chksum(j, csum32, addr, bh->b_size);
+       kunmap_local(addr);
 
        if (jbd2_has_feature_csum3(j))
                tag3->t_checksum = cpu_to_be32(csum32);
index 768fa05bcbedeb7523a8ef76c8f1155ecaf2d7f3..30dec2bd2ecc26abb8d67a66b0d04f84e08dc718 100644 (file)
@@ -1601,6 +1601,8 @@ static journal_t *journal_init_common(struct block_device *bdev,
 
 err_cleanup:
        percpu_counter_destroy(&journal->j_checkpoint_jh_count);
+       if (journal->j_chksum_driver)
+               crypto_free_shash(journal->j_chksum_driver);
        kfree(journal->j_wbuf);
        jbd2_journal_destroy_revoke(journal);
        journal_fail_superblock(journal);
index 4d1fda1f71439f46f85c265f93301518b55ef99e..5f08b5fd105a311584ffd1694667eb187f0e3975 100644 (file)
@@ -935,19 +935,15 @@ static void warn_dirty_buffer(struct buffer_head *bh)
 /* Call t_frozen trigger and copy buffer data into jh->b_frozen_data. */
 static void jbd2_freeze_jh_data(struct journal_head *jh)
 {
-       struct page *page;
-       int offset;
        char *source;
        struct buffer_head *bh = jh2bh(jh);
 
        J_EXPECT_JH(jh, buffer_uptodate(bh), "Possible IO failure.\n");
-       page = bh->b_page;
-       offset = offset_in_page(bh->b_data);
-       source = kmap_atomic(page);
+       source = kmap_local_folio(bh->b_folio, bh_offset(bh));
        /* Fire data frozen trigger just before we copy the data */
-       jbd2_buffer_frozen_trigger(jh, source + offset, jh->b_triggers);
-       memcpy(jh->b_frozen_data, source + offset, bh->b_size);
-       kunmap_atomic(source);
+       jbd2_buffer_frozen_trigger(jh, source, jh->b_triggers);
+       memcpy(jh->b_frozen_data, source, bh->b_size);
+       kunmap_local(source);
 
        /*
         * Now that the frozen data is saved off, we need to store any matching
index 3404707ddbe7302201288e793287a1de5c5e24e7..2cd3ccf4c439960053e436d63792bc5bf7a914de 100644 (file)
@@ -47,12 +47,14 @@ void netfs_rreq_unlock_folios(struct netfs_io_request *rreq)
        xas_for_each(&xas, folio, last_page) {
                loff_t pg_end;
                bool pg_failed = false;
+               bool folio_started;
 
                if (xas_retry(&xas, folio))
                        continue;
 
                pg_end = folio_pos(folio) + folio_size(folio) - 1;
 
+               folio_started = false;
                for (;;) {
                        loff_t sreq_end;
 
@@ -60,8 +62,10 @@ void netfs_rreq_unlock_folios(struct netfs_io_request *rreq)
                                pg_failed = true;
                                break;
                        }
-                       if (test_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags))
+                       if (!folio_started && test_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags)) {
                                folio_start_fscache(folio);
+                               folio_started = true;
+                       }
                        pg_failed |= subreq_failed;
                        sreq_end = subreq->start + subreq->len - 1;
                        if (pg_end < sreq_end)
index 47d892a1d363d94d13b5d7af5a529ba44136d3f9..f6c74f4246917fafce2746198622edad39022179 100644 (file)
@@ -93,12 +93,10 @@ nfs_direct_handle_truncated(struct nfs_direct_req *dreq,
                dreq->max_count = dreq_len;
                if (dreq->count > dreq_len)
                        dreq->count = dreq_len;
-
-               if (test_bit(NFS_IOHDR_ERROR, &hdr->flags))
-                       dreq->error = hdr->error;
-               else /* Clear outstanding error if this is EOF */
-                       dreq->error = 0;
        }
+
+       if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && !dreq->error)
+               dreq->error = hdr->error;
 }
 
 static void
@@ -120,6 +118,18 @@ nfs_direct_count_bytes(struct nfs_direct_req *dreq,
                dreq->count = dreq_len;
 }
 
+static void nfs_direct_truncate_request(struct nfs_direct_req *dreq,
+                                       struct nfs_page *req)
+{
+       loff_t offs = req_offset(req);
+       size_t req_start = (size_t)(offs - dreq->io_start);
+
+       if (req_start < dreq->max_count)
+               dreq->max_count = req_start;
+       if (req_start < dreq->count)
+               dreq->count = req_start;
+}
+
 /**
  * nfs_swap_rw - NFS address space operation for swap I/O
  * @iocb: target I/O control block
@@ -488,7 +498,9 @@ static void nfs_direct_add_page_head(struct list_head *list,
        kref_get(&head->wb_kref);
 }
 
-static void nfs_direct_join_group(struct list_head *list, struct inode *inode)
+static void nfs_direct_join_group(struct list_head *list,
+                                 struct nfs_commit_info *cinfo,
+                                 struct inode *inode)
 {
        struct nfs_page *req, *subreq;
 
@@ -510,7 +522,7 @@ static void nfs_direct_join_group(struct list_head *list, struct inode *inode)
                                nfs_release_request(subreq);
                        }
                } while ((subreq = subreq->wb_this_page) != req);
-               nfs_join_page_group(req, inode);
+               nfs_join_page_group(req, cinfo, inode);
        }
 }
 
@@ -528,20 +540,15 @@ nfs_direct_write_scan_commit_list(struct inode *inode,
 static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
 {
        struct nfs_pageio_descriptor desc;
-       struct nfs_page *req, *tmp;
+       struct nfs_page *req;
        LIST_HEAD(reqs);
        struct nfs_commit_info cinfo;
-       LIST_HEAD(failed);
 
        nfs_init_cinfo_from_dreq(&cinfo, dreq);
        nfs_direct_write_scan_commit_list(dreq->inode, &reqs, &cinfo);
 
-       nfs_direct_join_group(&reqs, dreq->inode);
+       nfs_direct_join_group(&reqs, &cinfo, dreq->inode);
 
-       dreq->count = 0;
-       dreq->max_count = 0;
-       list_for_each_entry(req, &reqs, wb_list)
-               dreq->max_count += req->wb_bytes;
        nfs_clear_pnfs_ds_commit_verifiers(&dreq->ds_cinfo);
        get_dreq(dreq);
 
@@ -549,27 +556,40 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
                              &nfs_direct_write_completion_ops);
        desc.pg_dreq = dreq;
 
-       list_for_each_entry_safe(req, tmp, &reqs, wb_list) {
+       while (!list_empty(&reqs)) {
+               req = nfs_list_entry(reqs.next);
                /* Bump the transmission count */
                req->wb_nio++;
                if (!nfs_pageio_add_request(&desc, req)) {
-                       nfs_list_move_request(req, &failed);
-                       spin_lock(&cinfo.inode->i_lock);
-                       dreq->flags = 0;
-                       if (desc.pg_error < 0)
+                       spin_lock(&dreq->lock);
+                       if (dreq->error < 0) {
+                               desc.pg_error = dreq->error;
+                       } else if (desc.pg_error != -EAGAIN) {
+                               dreq->flags = 0;
+                               if (!desc.pg_error)
+                                       desc.pg_error = -EIO;
                                dreq->error = desc.pg_error;
-                       else
-                               dreq->error = -EIO;
-                       spin_unlock(&cinfo.inode->i_lock);
+                       } else
+                               dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
+                       spin_unlock(&dreq->lock);
+                       break;
                }
                nfs_release_request(req);
        }
        nfs_pageio_complete(&desc);
 
-       while (!list_empty(&failed)) {
-               req = nfs_list_entry(failed.next);
+       while (!list_empty(&reqs)) {
+               req = nfs_list_entry(reqs.next);
                nfs_list_remove_request(req);
                nfs_unlock_and_release_request(req);
+               if (desc.pg_error == -EAGAIN) {
+                       nfs_mark_request_commit(req, NULL, &cinfo, 0);
+               } else {
+                       spin_lock(&dreq->lock);
+                       nfs_direct_truncate_request(dreq, req);
+                       spin_unlock(&dreq->lock);
+                       nfs_release_request(req);
+               }
        }
 
        if (put_dreq(dreq))
@@ -589,8 +609,6 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
        if (status < 0) {
                /* Errors in commit are fatal */
                dreq->error = status;
-               dreq->max_count = 0;
-               dreq->count = 0;
                dreq->flags = NFS_ODIRECT_DONE;
        } else {
                status = dreq->error;
@@ -601,7 +619,12 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
        while (!list_empty(&data->pages)) {
                req = nfs_list_entry(data->pages.next);
                nfs_list_remove_request(req);
-               if (status >= 0 && !nfs_write_match_verf(verf, req)) {
+               if (status < 0) {
+                       spin_lock(&dreq->lock);
+                       nfs_direct_truncate_request(dreq, req);
+                       spin_unlock(&dreq->lock);
+                       nfs_release_request(req);
+               } else if (!nfs_write_match_verf(verf, req)) {
                        dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
                        /*
                         * Despite the reboot, the write was successful,
@@ -609,7 +632,7 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
                         */
                        req->wb_nio = 0;
                        nfs_mark_request_commit(req, NULL, &cinfo, 0);
-               } else /* Error or match */
+               } else
                        nfs_release_request(req);
                nfs_unlock_and_release_request(req);
        }
@@ -662,6 +685,7 @@ static void nfs_direct_write_clear_reqs(struct nfs_direct_req *dreq)
        while (!list_empty(&reqs)) {
                req = nfs_list_entry(reqs.next);
                nfs_list_remove_request(req);
+               nfs_direct_truncate_request(dreq, req);
                nfs_release_request(req);
                nfs_unlock_and_release_request(req);
        }
@@ -711,7 +735,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
        }
 
        nfs_direct_count_bytes(dreq, hdr);
-       if (test_bit(NFS_IOHDR_UNSTABLE_WRITES, &hdr->flags)) {
+       if (test_bit(NFS_IOHDR_UNSTABLE_WRITES, &hdr->flags) &&
+           !test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
                if (!dreq->flags)
                        dreq->flags = NFS_ODIRECT_DO_COMMIT;
                flags = dreq->flags;
@@ -755,18 +780,23 @@ static void nfs_write_sync_pgio_error(struct list_head *head, int error)
 static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr)
 {
        struct nfs_direct_req *dreq = hdr->dreq;
+       struct nfs_page *req;
+       struct nfs_commit_info cinfo;
 
        trace_nfs_direct_write_reschedule_io(dreq);
 
+       nfs_init_cinfo_from_dreq(&cinfo, dreq);
        spin_lock(&dreq->lock);
-       if (dreq->error == 0) {
+       if (dreq->error == 0)
                dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
-               /* fake unstable write to let common nfs resend pages */
-               hdr->verf.committed = NFS_UNSTABLE;
-               hdr->good_bytes = hdr->args.offset + hdr->args.count -
-                       hdr->io_start;
-       }
+       set_bit(NFS_IOHDR_REDO, &hdr->flags);
        spin_unlock(&dreq->lock);
+       while (!list_empty(&hdr->pages)) {
+               req = nfs_list_entry(hdr->pages.next);
+               nfs_list_remove_request(req);
+               nfs_unlock_request(req);
+               nfs_mark_request_commit(req, NULL, &cinfo, 0);
+       }
 }
 
 static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = {
@@ -794,9 +824,11 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
 {
        struct nfs_pageio_descriptor desc;
        struct inode *inode = dreq->inode;
+       struct nfs_commit_info cinfo;
        ssize_t result = 0;
        size_t requested_bytes = 0;
        size_t wsize = max_t(size_t, NFS_SERVER(inode)->wsize, PAGE_SIZE);
+       bool defer = false;
 
        trace_nfs_direct_write_schedule_iovec(dreq);
 
@@ -837,17 +869,37 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
                                break;
                        }
 
-                       nfs_lock_request(req);
-                       if (!nfs_pageio_add_request(&desc, req)) {
-                               result = desc.pg_error;
-                               nfs_unlock_and_release_request(req);
-                               break;
-                       }
                        pgbase = 0;
                        bytes -= req_len;
                        requested_bytes += req_len;
                        pos += req_len;
                        dreq->bytes_left -= req_len;
+
+                       if (defer) {
+                               nfs_mark_request_commit(req, NULL, &cinfo, 0);
+                               continue;
+                       }
+
+                       nfs_lock_request(req);
+                       if (nfs_pageio_add_request(&desc, req))
+                               continue;
+
+                       /* Exit on hard errors */
+                       if (desc.pg_error < 0 && desc.pg_error != -EAGAIN) {
+                               result = desc.pg_error;
+                               nfs_unlock_and_release_request(req);
+                               break;
+                       }
+
+                       /* If the error is soft, defer remaining requests */
+                       nfs_init_cinfo_from_dreq(&cinfo, dreq);
+                       spin_lock(&dreq->lock);
+                       dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
+                       spin_unlock(&dreq->lock);
+                       nfs_unlock_request(req);
+                       nfs_mark_request_commit(req, NULL, &cinfo, 0);
+                       desc.pg_error = 0;
+                       defer = true;
                }
                nfs_direct_release_pages(pagevec, npages);
                kvfree(pagevec);
index 7deb3cd76abe4b623c7d79554d7c9d7506491d1b..a1dc338649062de39c72230d3a1b11f8564033bb 100644 (file)
@@ -1235,6 +1235,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
                case -EPFNOSUPPORT:
                case -EPROTONOSUPPORT:
                case -EOPNOTSUPP:
+               case -EINVAL:
                case -ECONNREFUSED:
                case -ECONNRESET:
                case -EHOSTDOWN:
index 27fb25567ce755a54e16e487379a3cd7a4f62824..11e3a285594c231c6b887dc53edbe52ef8519b23 100644 (file)
@@ -417,6 +417,8 @@ static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old)
                .net = old->cl_net,
                .servername = old->cl_hostname,
        };
+       int max_connect = test_bit(NFS_CS_PNFS, &clp->cl_flags) ?
+               clp->cl_max_connect : old->cl_max_connect;
 
        if (clp->cl_proto != old->cl_proto)
                return;
@@ -430,7 +432,7 @@ static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old)
        xprt_args.addrlen = clp_salen;
 
        rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
-                         rpc_clnt_test_and_add_xprt, NULL);
+                         rpc_clnt_test_and_add_xprt, &max_connect);
 }
 
 /**
@@ -1010,6 +1012,8 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_server *mds_srv,
                __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);
 
        __set_bit(NFS_CS_DS, &cl_init.init_flags);
+       __set_bit(NFS_CS_PNFS, &cl_init.init_flags);
+       cl_init.max_connect = NFS_MAX_TRANSPORTS;
        /*
         * Set an authflavor equual to the MDS value. Use the MDS nfs_client
         * cl_ipaddr so as to use the same EXCHANGE_ID co_ownerid as the MDS
index 794343790ea8bbba5493f0374d5297c45f87dd4f..3508d82388263e3f5553c00add1a463426e2f142 100644 (file)
@@ -2703,8 +2703,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data,
                        return status;
        }
        if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) {
+               struct nfs_fh *fh = &o_res->fh;
+
                nfs4_sequence_free_slot(&o_res->seq_res);
-               nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, NULL);
+               if (o_arg->claim == NFS4_OPEN_CLAIM_FH)
+                       fh = NFS_FH(d_inode(data->dentry));
+               nfs4_proc_getattr(server, fh, o_res->f_attr, NULL);
        }
        return 0;
 }
index f4cca8f00c0c20f6906e4e2e08ea19fc1a692e00..8c1ee1a1a28f1133039a63ea9765c7b5d417c4f9 100644 (file)
@@ -59,7 +59,8 @@ static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops;
 static const struct nfs_commit_completion_ops nfs_commit_completion_ops;
 static const struct nfs_rw_ops nfs_rw_write_ops;
 static void nfs_inode_remove_request(struct nfs_page *req);
-static void nfs_clear_request_commit(struct nfs_page *req);
+static void nfs_clear_request_commit(struct nfs_commit_info *cinfo,
+                                    struct nfs_page *req);
 static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo,
                                      struct inode *inode);
 static struct nfs_page *
@@ -502,8 +503,8 @@ nfs_destroy_unlinked_subrequests(struct nfs_page *destroy_list,
  * the (former) group.  All subrequests are removed from any write or commit
  * lists, unlinked from the group and destroyed.
  */
-void
-nfs_join_page_group(struct nfs_page *head, struct inode *inode)
+void nfs_join_page_group(struct nfs_page *head, struct nfs_commit_info *cinfo,
+                        struct inode *inode)
 {
        struct nfs_page *subreq;
        struct nfs_page *destroy_list = NULL;
@@ -533,7 +534,7 @@ nfs_join_page_group(struct nfs_page *head, struct inode *inode)
         * Commit list removal accounting is done after locks are dropped */
        subreq = head;
        do {
-               nfs_clear_request_commit(subreq);
+               nfs_clear_request_commit(cinfo, subreq);
                subreq = subreq->wb_this_page;
        } while (subreq != head);
 
@@ -566,8 +567,10 @@ static struct nfs_page *nfs_lock_and_join_requests(struct folio *folio)
 {
        struct inode *inode = folio_file_mapping(folio)->host;
        struct nfs_page *head;
+       struct nfs_commit_info cinfo;
        int ret;
 
+       nfs_init_cinfo_from_inode(&cinfo, inode);
        /*
         * A reference is taken only on the head request which acts as a
         * reference to the whole page group - the group will not be destroyed
@@ -584,7 +587,7 @@ static struct nfs_page *nfs_lock_and_join_requests(struct folio *folio)
                return ERR_PTR(ret);
        }
 
-       nfs_join_page_group(head, inode);
+       nfs_join_page_group(head, &cinfo, inode);
 
        return head;
 }
@@ -955,18 +958,16 @@ static void nfs_folio_clear_commit(struct folio *folio)
 }
 
 /* Called holding the request lock on @req */
-static void
-nfs_clear_request_commit(struct nfs_page *req)
+static void nfs_clear_request_commit(struct nfs_commit_info *cinfo,
+                                    struct nfs_page *req)
 {
        if (test_bit(PG_CLEAN, &req->wb_flags)) {
                struct nfs_open_context *ctx = nfs_req_openctx(req);
                struct inode *inode = d_inode(ctx->dentry);
-               struct nfs_commit_info cinfo;
 
-               nfs_init_cinfo_from_inode(&cinfo, inode);
                mutex_lock(&NFS_I(inode)->commit_mutex);
-               if (!pnfs_clear_request_commit(req, &cinfo)) {
-                       nfs_request_remove_commit_list(req, &cinfo);
+               if (!pnfs_clear_request_commit(req, cinfo)) {
+                       nfs_request_remove_commit_list(req, cinfo);
                }
                mutex_unlock(&NFS_I(inode)->commit_mutex);
                nfs_folio_clear_commit(nfs_page_to_folio(req));
index 5ca748309c262b1a82eb41981d7bc76e2520f65a..4199ede0583c7d903939e60cde9b3365a2e4bef1 100644 (file)
@@ -1058,8 +1058,8 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                             rename->rn_tname, rename->rn_tnamelen);
        if (status)
                return status;
-       set_change_info(&rename->rn_sinfo, &cstate->current_fh);
-       set_change_info(&rename->rn_tinfo, &cstate->save_fh);
+       set_change_info(&rename->rn_sinfo, &cstate->save_fh);
+       set_change_info(&rename->rn_tinfo, &cstate->current_fh);
        return nfs_ok;
 }
 
index 1582af33e204a192989970b4548dd955f2d7705b..c7af1095f6b549f67e1e04b341b013bdedf6eee2 100644 (file)
@@ -1082,11 +1082,12 @@ int nfsd_pool_stats_open(struct inode *inode, struct file *file)
 
 int nfsd_pool_stats_release(struct inode *inode, struct file *file)
 {
+       struct seq_file *seq = file->private_data;
+       struct svc_serv *serv = seq->private;
        int ret = seq_release(inode, file);
-       struct net *net = inode->i_sb->s_fs_info;
 
        mutex_lock(&nfsd_mutex);
-       nfsd_put(net);
+       svc_put(serv);
        mutex_unlock(&nfsd_mutex);
        return ret;
 }
index de2dfbaae821026dbdb585e2274efdc9308dfa6f..d7c302442c1ec876cb977850c74a161331ff8577 100644 (file)
@@ -2680,7 +2680,7 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start,
        }
 
        cifsFileInfo_put(cfile);
-       return -ENOTSUPP;
+       return -EOPNOTSUPP;
 }
 
 int cifs_truncate_page(struct address_space *mapping, loff_t from)
index d9eda2e958b4d03198c0b03062bb09354ad8a209..9aeecee6b91b356711d3f545119eba504e08c28e 100644 (file)
@@ -297,7 +297,7 @@ smb2_adjust_credits(struct TCP_Server_Info *server,
                cifs_server_dbg(VFS, "request has less credits (%d) than required (%d)",
                                credits->value, new_val);
 
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        spin_lock(&server->req_lock);
@@ -1161,7 +1161,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
                        /* Use a fudge factor of 256 bytes in case we collide
                         * with a different set_EAs command.
                         */
-                       if(CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
+                       if (CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
                           MAX_SMB2_CLOSE_RESPONSE_SIZE - 256 <
                           used_len + ea_name_len + ea_value_len + 1) {
                                rc = -ENOSPC;
@@ -4591,7 +4591,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
 
        if (shdr->Command != SMB2_READ) {
                cifs_server_dbg(VFS, "only big read responses are supported\n");
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        if (server->ops->is_session_expired &&
index 092b0087c9dc14441d80cc197417c410a2d86f0d..44d4943e9c566fadec7f82faaace3c4f7ab3ac58 100644 (file)
@@ -89,20 +89,26 @@ smb2_hdr_assemble(struct smb2_hdr *shdr, __le16 smb2_cmd,
                  struct TCP_Server_Info *server)
 {
        struct smb3_hdr_req *smb3_hdr;
+
        shdr->ProtocolId = SMB2_PROTO_NUMBER;
        shdr->StructureSize = cpu_to_le16(64);
        shdr->Command = smb2_cmd;
-       if (server->dialect >= SMB30_PROT_ID) {
-               /* After reconnect SMB3 must set ChannelSequence on subsequent reqs */
-               smb3_hdr = (struct smb3_hdr_req *)shdr;
-               /* if primary channel is not set yet, use default channel for chan sequence num */
-               if (SERVER_IS_CHAN(server))
-                       smb3_hdr->ChannelSequence =
-                               cpu_to_le16(server->primary_server->channel_sequence_num);
-               else
-                       smb3_hdr->ChannelSequence = cpu_to_le16(server->channel_sequence_num);
-       }
+
        if (server) {
+               /* After reconnect SMB3 must set ChannelSequence on subsequent reqs */
+               if (server->dialect >= SMB30_PROT_ID) {
+                       smb3_hdr = (struct smb3_hdr_req *)shdr;
+                       /*
+                        * if primary channel is not set yet, use default
+                        * channel for chan sequence num
+                        */
+                       if (SERVER_IS_CHAN(server))
+                               smb3_hdr->ChannelSequence =
+                                       cpu_to_le16(server->primary_server->channel_sequence_num);
+                       else
+                               smb3_hdr->ChannelSequence =
+                                       cpu_to_le16(server->channel_sequence_num);
+               }
                spin_lock(&server->req_lock);
                /* Request up to 10 credits but don't go over the limit. */
                if (server->credits >= server->max_credits)
@@ -2234,7 +2240,7 @@ create_durable_v2_buf(struct cifs_open_parms *oparms)
         * (most servers default to 120 seconds) and most clients default to 0.
         * This can be overridden at mount ("handletimeout=") if the user wants
         * a different persistent (or resilient) handle timeout for all opens
-        * opens on a particular SMB3 mount.
+        * on a particular SMB3 mount.
         */
        buf->dcontext.Timeout = cpu_to_le32(oparms->tcon->handle_timeout);
        buf->dcontext.Flags = cpu_to_le32(SMB2_DHANDLE_FLAG_PERSISTENT);
@@ -2379,7 +2385,7 @@ add_twarp_context(struct kvec *iov, unsigned int *num_iovec, __u64 timewarp)
        return 0;
 }
 
-/* See See http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx */
+/* See http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx */
 static void setup_owner_group_sids(char *buf)
 {
        struct owner_group_sids *sids = (struct owner_group_sids *)buf;
@@ -3124,6 +3130,7 @@ void
 SMB2_ioctl_free(struct smb_rqst *rqst)
 {
        int i;
+
        if (rqst && rqst->rq_iov) {
                cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
                for (i = 1; i < rqst->rq_nvec; i++)
index 1b5d9794ed5b0b5e5e0e63a4dadea8f8c66a6ddd..d52057a511ee3062365c3b0632e33d908d44a643 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/bvec.h>
 #include <linux/highmem.h>
 #include <linux/uaccess.h>
-#include <asm/processor.h>
+#include <linux/processor.h>
 #include <linux/mempool.h>
 #include <linux/sched/signal.h>
 #include <linux/task_io_accounting_ops.h>
index 749660110878fdbd75c2820a14eaf7ba543496ce..544022dd6d2007132a1bc3a310d4ee57f671a047 100644 (file)
@@ -6312,7 +6312,7 @@ int smb2_read(struct ksmbd_work *work)
                                                      aux_payload_buf,
                                                      nbytes);
                kvfree(aux_payload_buf);
-
+               aux_payload_buf = NULL;
                nbytes = 0;
                if (remain_bytes < 0) {
                        err = (int)remain_bytes;
index e5e438bf54996510da5800ea38ac50f60e36b36c..6c0305be895e56fb11464c5fe17245afc4354447 100644 (file)
@@ -1420,7 +1420,6 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
 out:
        posix_acl_release(fattr.cf_acls);
        posix_acl_release(fattr.cf_dacls);
-       mark_inode_dirty(inode);
        return rc;
 }
 
index 6822ac77aec24d00b78f67bc5a18043aa99665e1..d43a5cc1bfa46b142197c991343a295d375af60f 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
 #include "internal.h"
 #include "mount.h"
 
-/**
- * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED
- * @stat: where to store the resulting values
- * @request_mask: STATX_* values requested
- * @inode: inode from which to grab the c/mtime
- *
- * Given @inode, grab the ctime and mtime out if it and store the result
- * in @stat. When fetching the value, flag it as queried so the next write
- * will use a fine-grained timestamp.
- */
-void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode)
-{
-       atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
-
-       /* If neither time was requested, then don't report them */
-       if (!(request_mask & (STATX_CTIME|STATX_MTIME))) {
-               stat->result_mask &= ~(STATX_CTIME|STATX_MTIME);
-               return;
-       }
-
-       stat->mtime = inode->i_mtime;
-       stat->ctime.tv_sec = inode->__i_ctime.tv_sec;
-       /*
-        * Atomically set the QUERIED flag and fetch the new value with
-        * the flag masked off.
-        */
-       stat->ctime.tv_nsec = atomic_long_fetch_or(I_CTIME_QUERIED, pnsec) &
-                                       ~I_CTIME_QUERIED;
-}
-EXPORT_SYMBOL(fill_mg_cmtime);
-
 /**
  * generic_fillattr - Fill in the basic attributes from the inode struct
  * @idmap:             idmap of the mount the inode was found from
@@ -89,14 +58,8 @@ void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask,
        stat->rdev = inode->i_rdev;
        stat->size = i_size_read(inode);
        stat->atime = inode->i_atime;
-
-       if (is_mgtime(inode)) {
-               fill_mg_cmtime(stat, request_mask, inode);
-       } else {
-               stat->mtime = inode->i_mtime;
-               stat->ctime = inode_get_ctime(inode);
-       }
-
+       stat->mtime = inode->i_mtime;
+       stat->ctime = inode_get_ctime(inode);
        stat->blksize = i_blocksize(inode);
        stat->blocks = inode->i_blocks;
 
@@ -419,12 +382,6 @@ SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, stat
 
 #ifdef __ARCH_WANT_NEW_STAT
 
-#if BITS_PER_LONG == 32
-#  define choose_32_64(a,b) a
-#else
-#  define choose_32_64(a,b) b
-#endif
-
 #ifndef INIT_STRUCT_STAT_PADDING
 #  define INIT_STRUCT_STAT_PADDING(st) memset(&st, 0, sizeof(st))
 #endif
index ad22656376d3f88521f98c2c5d9f573e7cd2aeca..6b2296ff248a4385c737c943064c9234dfef402f 100644 (file)
@@ -62,12 +62,12 @@ xfs_trans_ichgtime(
        ASSERT(tp);
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
-       /* If the mtime changes, then ctime must also change */
-       ASSERT(flags & XFS_ICHGTIME_CHG);
+       tv = current_time(inode);
 
-       tv = inode_set_ctime_current(inode);
        if (flags & XFS_ICHGTIME_MOD)
                inode->i_mtime = tv;
+       if (flags & XFS_ICHGTIME_CHG)
+               inode_set_ctime_to_ts(inode, tv);
        if (flags & XFS_ICHGTIME_CREATE)
                ip->i_crtime = tv;
 }
index 2ededd3f6b8ce861489a54038fa4d700637c845c..1c1e6171209def64e5bafb0d06c0906eff60344d 100644 (file)
@@ -573,10 +573,10 @@ xfs_vn_getattr(
        stat->gid = vfsgid_into_kgid(vfsgid);
        stat->ino = ip->i_ino;
        stat->atime = inode->i_atime;
+       stat->mtime = inode->i_mtime;
+       stat->ctime = inode_get_ctime(inode);
        stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks);
 
-       fill_mg_cmtime(stat, request_mask, inode);
-
        if (xfs_has_v3inodes(mp)) {
                if (request_mask & STATX_BTIME) {
                        stat->result_mask |= STATX_BTIME;
@@ -917,7 +917,7 @@ xfs_setattr_size(
        if (newsize != oldsize &&
            !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {
                iattr->ia_ctime = iattr->ia_mtime =
-                       current_mgtime(inode);
+                       current_time(inode);
                iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;
        }
 
index 1f77014c6e1abd136753807d37ac5cdf12099b76..b5c202f5d96cc6bb5f1eb2051f08b35e7c91fce3 100644 (file)
@@ -2065,7 +2065,7 @@ static struct file_system_type xfs_fs_type = {
        .init_fs_context        = xfs_init_fs_context,
        .parameters             = xfs_fs_parameters,
        .kill_sb                = xfs_kill_sb,
-       .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME,
+       .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
 };
 MODULE_ALIAS_FS("xfs");
 
index e0462361adf9ede869e4adea49dc8ad24c41094e..b5bf0b6da791c14c68062e9fb755643ac4db1c54 100644 (file)
@@ -51,6 +51,20 @@ struct drm_exec {
        struct drm_gem_object *prelocked;
 };
 
+/**
+ * drm_exec_obj() - Return the object for a give drm_exec index
+ * @exec: Pointer to the drm_exec context
+ * @index: The index.
+ *
+ * Return: Pointer to the locked object corresponding to @index if
+ * index is within the number of locked objects. NULL otherwise.
+ */
+static inline struct drm_gem_object *
+drm_exec_obj(struct drm_exec *exec, unsigned long index)
+{
+       return index < exec->num_objects ? exec->objects[index] : NULL;
+}
+
 /**
  * drm_exec_for_each_locked_object - iterate over all the locked objects
  * @exec: drm_exec object
@@ -59,10 +73,23 @@ struct drm_exec {
  *
  * Iterate over all the locked GEM objects inside the drm_exec object.
  */
-#define drm_exec_for_each_locked_object(exec, index, obj)      \
-       for (index = 0, obj = (exec)->objects[0];               \
-            index < (exec)->num_objects;                       \
-            ++index, obj = (exec)->objects[index])
+#define drm_exec_for_each_locked_object(exec, index, obj)              \
+       for ((index) = 0; ((obj) = drm_exec_obj(exec, index)); ++(index))
+
+/**
+ * drm_exec_for_each_locked_object_reverse - iterate over all the locked
+ * objects in reverse locking order
+ * @exec: drm_exec object
+ * @index: unsigned long index for the iteration
+ * @obj: the current GEM object
+ *
+ * Iterate over all the locked GEM objects inside the drm_exec object in
+ * reverse locking order. Note that @index may go below zero and wrap,
+ * but that will be caught by drm_exec_obj(), returning a NULL object.
+ */
+#define drm_exec_for_each_locked_object_reverse(exec, index, obj)      \
+       for ((index) = (exec)->num_objects - 1;                         \
+            ((obj) = drm_exec_obj(exec, index)); --(index))
 
 /**
  * drm_exec_until_all_locked - loop until all GEM objects are locked
index 514c8a7a32f0f03d043cee7f16c9391752187795..ba483c87f0e7bd049b056c029b231e62ca535843 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef DRM_KUNIT_HELPERS_H_
 #define DRM_KUNIT_HELPERS_H_
 
+#include <linux/device.h>
+
 #include <kunit/test.h>
 
 struct drm_device;
@@ -51,7 +53,7 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test,
 {
        struct drm_driver *driver;
 
-       driver = kunit_kzalloc(test, sizeof(*driver), GFP_KERNEL);
+       driver = devm_kzalloc(dev, sizeof(*driver), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, driver);
 
        driver->driver_features = features;
index 4ede47649a811801f07a8aba4a392a35e1593c8e..44e9de51eedfb634aa2a44420a0fc32ee61ff924 100644 (file)
@@ -171,7 +171,10 @@ static __always_inline int buffer_uptodate(const struct buffer_head *bh)
        return test_bit_acquire(BH_Uptodate, &bh->b_state);
 }
 
-#define bh_offset(bh)          ((unsigned long)(bh)->b_data & ~PAGE_MASK)
+static inline unsigned long bh_offset(const struct buffer_head *bh)
+{
+       return (unsigned long)(bh)->b_data & (page_size(bh->b_page) - 1);
+}
 
 /* If we *know* page->private refers to buffer_heads */
 #define page_buffers(page)                                     \
index 4aeb3fa1192771cdd8e1e1ebdf18f9b08c983166..b528f063e8ffaa32a45e1b14398f448445771aa6 100644 (file)
@@ -1508,47 +1508,18 @@ static inline bool fsuidgid_has_mapping(struct super_block *sb,
               kgid_has_mapping(fs_userns, kgid);
 }
 
-struct timespec64 current_mgtime(struct inode *inode);
 struct timespec64 current_time(struct inode *inode);
 struct timespec64 inode_set_ctime_current(struct inode *inode);
 
-/*
- * Multigrain timestamps
- *
- * Conditionally use fine-grained ctime and mtime timestamps when there
- * are users actively observing them via getattr. The primary use-case
- * for this is NFS clients that use the ctime to distinguish between
- * different states of the file, and that are often fooled by multiple
- * operations that occur in the same coarse-grained timer tick.
- *
- * The kernel always keeps normalized struct timespec64 values in the ctime,
- * which means that only the first 30 bits of the value are used. Use the
- * 31st bit of the ctime's tv_nsec field as a flag to indicate that the value
- * has been queried since it was last updated.
- */
-#define I_CTIME_QUERIED                (1L<<30)
-
 /**
  * inode_get_ctime - fetch the current ctime from the inode
  * @inode: inode from which to fetch ctime
  *
- * Grab the current ctime tv_nsec field from the inode, mask off the
- * I_CTIME_QUERIED flag and return it. This is mostly intended for use by
- * internal consumers of the ctime that aren't concerned with ensuring a
- * fine-grained update on the next change (e.g. when preparing to store
- * the value in the backing store for later retrieval).
- *
- * This is safe to call regardless of whether the underlying filesystem
- * is using multigrain timestamps.
+ * Grab the current ctime from the inode and return it.
  */
 static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 {
-       struct timespec64 ctime;
-
-       ctime.tv_sec = inode->__i_ctime.tv_sec;
-       ctime.tv_nsec = inode->__i_ctime.tv_nsec & ~I_CTIME_QUERIED;
-
-       return ctime;
+       return inode->__i_ctime;
 }
 
 /**
@@ -2334,7 +2305,6 @@ struct file_system_type {
 #define FS_USERNS_MOUNT                8       /* Can be mounted by userns root */
 #define FS_DISALLOW_NOTIFY_PERM        16      /* Disable fanotify permission events */
 #define FS_ALLOW_IDMAP         32      /* FS has been updated to handle vfs idmappings. */
-#define FS_MGTIME              64      /* FS uses multigrain timestamps */
 #define FS_RENAME_DOES_D_MOVE  32768   /* FS will handle d_move() during rename() internally. */
        int (*init_fs_context)(struct fs_context *);
        const struct fs_parameter_spec *parameters;
@@ -2358,17 +2328,6 @@ struct file_system_type {
 
 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
 
-/**
- * is_mgtime: is this inode using multigrain timestamps
- * @inode: inode to test for multigrain timestamps
- *
- * Return true if the inode uses multigrain timestamps, false otherwise.
- */
-static inline bool is_mgtime(const struct inode *inode)
-{
-       return inode->i_sb->s_type->fs_flags & FS_MGTIME;
-}
-
 extern struct dentry *mount_bdev(struct file_system_type *fs_type,
        int flags, const char *dev_name, void *data,
        int (*fill_super)(struct super_block *, void *, int));
@@ -3054,7 +3013,6 @@ extern void page_put_link(void *);
 extern int page_symlink(struct inode *inode, const char *symname, int len);
 extern const struct inode_operations page_symlink_inode_operations;
 extern void kfree_link(void *);
-void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode);
 void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
 void generic_fill_statx_attr(struct inode *inode, struct kstat *stat);
 extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int);
index 3430cc2b05a696eb0444c8e88db0740ebb5ee34e..0dae9db275380b16bada4327f8f02e53ff8db30f 100644 (file)
@@ -237,7 +237,6 @@ enum i2c_driver_flags {
  * struct i2c_driver - represent an I2C device driver
  * @class: What kind of i2c device we instantiate (for detect)
  * @probe: Callback for device binding
- * @probe_new: Transitional callback for device binding - do not use
  * @remove: Callback for device unbinding
  * @shutdown: Callback for device shutdown
  * @alert: Alert callback, for example for the SMBus alert protocol
@@ -272,16 +271,8 @@ enum i2c_driver_flags {
 struct i2c_driver {
        unsigned int class;
 
-       union {
        /* Standard driver model interfaces */
-               int (*probe)(struct i2c_client *client);
-               /*
-                * Legacy callback that was part of a conversion of .probe().
-                * Today it has the same semantic as .probe(). Don't use for new
-                * code.
-                */
-               int (*probe_new)(struct i2c_client *client);
-       };
+       int (*probe)(struct i2c_client *client);
        void (*remove)(struct i2c_client *client);
 
 
index 1b9b15a492fae417f87b946fe343f7ee29ec890b..cdc684e04a2fb6fcabda07a3427270af79b7eca8 100644 (file)
@@ -189,6 +189,8 @@ struct team {
        struct net_device *dev; /* associated netdevice */
        struct team_pcpu_stats __percpu *pcpu_stats;
 
+       const struct header_ops *header_ops_cache;
+
        struct mutex lock; /* used for overall locking, e.g. port lists write */
 
        /*
index cda1f706eaeb1186972eab1ca88e5d8584fcd9e1..aa0b3ffea93536c7b423742f09efbaee50c7f56e 100644 (file)
@@ -2,7 +2,12 @@
 #ifndef _LINUX_INSTRUCTION_POINTER_H
 #define _LINUX_INSTRUCTION_POINTER_H
 
+#include <asm/linkage.h>
+
 #define _RET_IP_               (unsigned long)__builtin_return_address(0)
+
+#ifndef _THIS_IP_
 #define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
+#endif
 
 #endif /* _LINUX_INSTRUCTION_POINTER_H */
index 52d58b13e5eee7e5b004fb84dd0fba853f2ea0dc..bf4913f4d7ac1710c258b61e0e2f9ef201a24c04 100644 (file)
@@ -222,6 +222,10 @@ enum {
        ATA_HOST_PARALLEL_SCAN  = (1 << 2),     /* Ports on this host can be scanned in parallel */
        ATA_HOST_IGNORE_ATA     = (1 << 3),     /* Ignore ATA devices on this host. */
 
+       ATA_HOST_NO_PART        = (1 << 4), /* Host does not support partial */
+       ATA_HOST_NO_SSC         = (1 << 5), /* Host does not support slumber */
+       ATA_HOST_NO_DEVSLP      = (1 << 6), /* Host does not support devslp */
+
        /* bits 24:31 of host->flags are reserved for LLD specific flags */
 
        /* various lengths of time */
index 20eeba8b009df1100a3c6080f84c93277aaba4dc..cd628c4b011e54fa807674daa8a3361c97c20a5f 100644 (file)
@@ -48,6 +48,7 @@ struct nfs_client {
 #define NFS_CS_NOPING          6               /* - don't ping on connect */
 #define NFS_CS_DS              7               /* - Server is a DS */
 #define NFS_CS_REUSEPORT       8               /* - reuse src port on reconnect */
+#define NFS_CS_PNFS            9               /* - Server used for pnfs */
        struct sockaddr_storage cl_addr;        /* server identifier */
        size_t                  cl_addrlen;
        char *                  cl_hostname;    /* hostname of server */
index aa9f4c6ebe261d40fc3dc21389a97458e1722178..1c315f854ea8013bef87fb820dd0186aefb4a3cf 100644 (file)
@@ -157,7 +157,9 @@ extern      void nfs_unlock_request(struct nfs_page *req);
 extern void nfs_unlock_and_release_request(struct nfs_page *);
 extern struct nfs_page *nfs_page_group_lock_head(struct nfs_page *req);
 extern int nfs_page_group_lock_subrequests(struct nfs_page *head);
-extern void nfs_join_page_group(struct nfs_page *head, struct inode *inode);
+extern void nfs_join_page_group(struct nfs_page *head,
+                               struct nfs_commit_info *cinfo,
+                               struct inode *inode);
 extern int nfs_page_group_lock(struct nfs_page *);
 extern void nfs_page_group_unlock(struct nfs_page *);
 extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
index f6ef8cf5d7741f924f92600ad7dbb9bcf5fb7227..4109f1bd61285b3ada18af6ec26f34380162cff4 100644 (file)
 struct nvmefc_ls_req {
        void                    *rqstaddr;
        dma_addr_t              rqstdma;
-       __le32                  rqstlen;
+       u32                     rqstlen;
        void                    *rspaddr;
        dma_addr_t              rspdma;
-       __le32                  rsplen;
+       u32                     rsplen;
        u32                     timeout;
 
        void                    *private;
@@ -120,7 +120,7 @@ struct nvmefc_ls_req {
 struct nvmefc_ls_rsp {
        void            *rspbuf;
        dma_addr_t      rspdma;
-       __le32          rsplen;
+       u16             rsplen;
 
        void (*done)(struct nvmefc_ls_rsp *rsp);
        void            *nvme_fc_private;       /* LLDD is not to access !! */
index 5b4fb3c791bc267042a9af1b7384e606ae0b043f..2f8dc47f1eb07504903318682a58ec8735ac4c5d 100644 (file)
@@ -779,7 +779,9 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr,
 
        if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0))
                return -EBADMSG;
-       p = xdr_inline_decode(xdr, size_mul(len, sizeof(*p)));
+       if (U32_MAX >= SIZE_MAX / sizeof(*p) && len > SIZE_MAX / sizeof(*p))
+               return -EBADMSG;
+       p = xdr_inline_decode(xdr, len * sizeof(*p));
        if (unlikely(!p))
                return -EBADMSG;
        if (array == NULL)
index c99440aac1a11dfd59497fa4d1cce94c1668afcf..a5ae4af955ff926f9b9d49c30cab61a4f0f9f45e 100644 (file)
@@ -80,8 +80,8 @@ struct thermal_zone_device_ops {
        int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
        int (*get_crit_temp) (struct thermal_zone_device *, int *);
        int (*set_emul_temp) (struct thermal_zone_device *, int);
-       int (*get_trend) (struct thermal_zone_device *, struct thermal_trip *,
-                         enum thermal_trend *);
+       int (*get_trend) (struct thermal_zone_device *,
+                         const struct thermal_trip *, enum thermal_trend *);
        void (*hot)(struct thermal_zone_device *);
        void (*critical)(struct thermal_zone_device *);
 };
index e6359f7346f1fb4a2703e3de6bae8db475972cdb..c33348ba1657e34e888119cc78ec1d245f4539f2 100644 (file)
@@ -350,7 +350,7 @@ struct hci_dev {
        struct list_head list;
        struct mutex    lock;
 
-       char            name[8];
+       const char      *name;
        unsigned long   flags;
        __u16           id;
        __u8            bus;
index f0c13864180e23e43fe065494fe4e42114c6ecd1..15de07d36540526fd4ede91f77af17eaf9ea1a45 100644 (file)
@@ -154,6 +154,7 @@ struct fib_info {
        int                     fib_nhs;
        bool                    fib_nh_is_v6;
        bool                    nh_updated;
+       bool                    pfsrc_removed;
        struct nexthop          *nh;
        struct rcu_head         rcu;
        struct fib_nh           fib_nh[];
index 6da68886fabbcb33a63ef256242d51a618571c95..07022bb0d44d4b5eef5812cc86e042833cf3a337 100644 (file)
@@ -539,7 +539,7 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb,
            READ_ONCE(hh->hh_len))
                return neigh_hh_output(hh, skb);
 
-       return n->output(n, skb);
+       return READ_ONCE(n->output)(n, skb);
 }
 
 static inline struct neighbour *
index a4455f4995abf8687aa391fd3dc609e1c048b6da..7c816359d5a98884cf303b87af1bb2adbb1b48e2 100644 (file)
@@ -1682,7 +1682,7 @@ struct nft_trans_gc {
        struct net              *net;
        struct nft_set          *set;
        u32                     seq;
-       u                     count;
+       u16                     count;
        void                    *priv[NFT_TRANS_GC_BATCHCOUNT];
        struct rcu_head         rcu;
 };
index 44a3f565264d931b1b9257ad4090e5182f322bb6..0577f0cdd23162d6abd7a88b005d9479a7c0f5b0 100644 (file)
@@ -6,26 +6,26 @@
 #define _TRACE_XEN_H
 
 #include <linux/tracepoint.h>
-#include <asm/paravirt_types.h>
+#include <asm/xen/hypervisor.h>
 #include <asm/xen/trace_types.h>
 
 struct multicall_entry;
 
 /* Multicalls */
 DECLARE_EVENT_CLASS(xen_mc__batch,
-           TP_PROTO(enum paravirt_lazy_mode mode),
+           TP_PROTO(enum xen_lazy_mode mode),
            TP_ARGS(mode),
            TP_STRUCT__entry(
-                   __field(enum paravirt_lazy_mode, mode)
+                   __field(enum xen_lazy_mode, mode)
                    ),
            TP_fast_assign(__entry->mode = mode),
            TP_printk("start batch LAZY_%s",
-                     (__entry->mode == PARAVIRT_LAZY_MMU) ? "MMU" :
-                     (__entry->mode == PARAVIRT_LAZY_CPU) ? "CPU" : "NONE")
+                     (__entry->mode == XEN_LAZY_MMU) ? "MMU" :
+                     (__entry->mode == XEN_LAZY_CPU) ? "CPU" : "NONE")
        );
 #define DEFINE_XEN_MC_BATCH(name)                      \
        DEFINE_EVENT(xen_mc__batch, name,               \
-               TP_PROTO(enum paravirt_lazy_mode mode), \
+               TP_PROTO(enum xen_lazy_mode mode),      \
                     TP_ARGS(mode))
 
 DEFINE_XEN_MC_BATCH(xen_mc_batch);
index 43ef24dd030e10237a97373e635632ae5a8e4a9c..9995695204f5d25730ddbc6c9663117eac557072 100644 (file)
@@ -7,18 +7,6 @@
 extern struct shared_info *HYPERVISOR_shared_info;
 extern struct start_info *xen_start_info;
 
-/* Lazy mode for batching updates / context switch */
-enum paravirt_lazy_mode {
-       PARAVIRT_LAZY_NONE,
-       PARAVIRT_LAZY_MMU,
-       PARAVIRT_LAZY_CPU,
-};
-
-static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
-{
-       return PARAVIRT_LAZY_NONE;
-}
-
 #ifdef CONFIG_XEN
 void __init xen_early_init(void);
 #else
index 95d5e28de324af3c46f1fd876e7e3e26c8120c70..23932b0673dc7459037c16e97642598a16f08877 100644 (file)
@@ -105,8 +105,7 @@ int irq_from_virq(unsigned int cpu, unsigned int virq);
 evtchn_port_t evtchn_from_irq(unsigned irq);
 
 int xen_set_callback_via(uint64_t via);
-void xen_evtchn_do_upcall(struct pt_regs *regs);
-int xen_hvm_evtchn_do_upcall(void);
+int xen_evtchn_do_upcall(void);
 
 /* Bind a pirq for a physical interrupt to an irq. */
 int xen_bind_pirq_gsi_to_irq(unsigned gsi,
index 3d07bf79c1e025eb900eace985d14804ed392b2c..7a8e298af81b3b1db393efc547d04a8f2938f091 100644 (file)
@@ -183,6 +183,10 @@ static int io_setup_async_msg(struct io_kiocb *req,
        memcpy(async_msg, kmsg, sizeof(*kmsg));
        if (async_msg->msg.msg_name)
                async_msg->msg.msg_name = &async_msg->addr;
+
+       if ((req->flags & REQ_F_BUFFER_SELECT) && !async_msg->msg.msg_iter.nr_segs)
+               return -EAGAIN;
+
        /* if were using fast_iov, set it to the new one */
        if (iter_is_iovec(&kmsg->msg.msg_iter) && !kmsg->free_iov) {
                size_t fast_idx = iter_iov(&kmsg->msg.msg_iter) - kmsg->fast_iov;
@@ -542,6 +546,7 @@ static int io_recvmsg_copy_hdr(struct io_kiocb *req,
                               struct io_async_msghdr *iomsg)
 {
        iomsg->msg.msg_name = &iomsg->addr;
+       iomsg->msg.msg_iter.nr_segs = 0;
 
 #ifdef CONFIG_COMPAT
        if (req->ctx->compat)
index 07239d4ad81e87e1de4477f8196e8ffcd105161b..ffa037fa777d5f7f1cb8596893fe90c3fb0a2f46 100644 (file)
@@ -697,6 +697,7 @@ void warn_slowpath_fmt(const char *file, int line, unsigned taint,
        if (!fmt) {
                __warn(file, line, __builtin_return_address(0), taint,
                       NULL, NULL);
+               warn_rcu_exit(rcu);
                return;
        }
 
index 2b4a946a6ff5cfcae69fd9e03ee1d5cc0728736e..8d35b9f9aaa3f203e3f2bb103c2cce72fbc44157 100644 (file)
@@ -786,9 +786,9 @@ int hibernate(void)
        unlock_device_hotplug();
        if (snapshot_test) {
                pm_pr_dbg("Checking hibernation image\n");
-               error = swsusp_check(snapshot_test);
+               error = swsusp_check(false);
                if (!error)
-                       error = load_image_and_restore(snapshot_test);
+                       error = load_image_and_restore(false);
        }
        thaw_processes();
 
@@ -945,14 +945,14 @@ static int software_resume(void)
        pm_pr_dbg("Looking for hibernation image.\n");
 
        mutex_lock(&system_transition_mutex);
-       error = swsusp_check(false);
+       error = swsusp_check(true);
        if (error)
                goto Unlock;
 
        /* The snapshot device should not be opened while we're running */
        if (!hibernate_acquire()) {
                error = -EBUSY;
-               swsusp_close(false);
+               swsusp_close(true);
                goto Unlock;
        }
 
@@ -973,7 +973,7 @@ static int software_resume(void)
                goto Close_Finish;
        }
 
-       error = load_image_and_restore(false);
+       error = load_image_and_restore(true);
        thaw_processes();
  Finish:
        pm_notifier_call_chain(PM_POST_RESTORE);
@@ -987,7 +987,7 @@ static int software_resume(void)
        pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
        return error;
  Close_Finish:
-       swsusp_close(false);
+       swsusp_close(true);
        goto Finish;
 }
 
index 46eb14dc50c31ddef2fb29b4fe9a925002e01c18..a98f95e309a338c5a895ebbdff15f21f2ba730d9 100644 (file)
@@ -168,11 +168,11 @@ extern int swsusp_swap_in_use(void);
 #define SF_HW_SIG              8
 
 /* kernel/power/hibernate.c */
-int swsusp_check(bool snapshot_test);
+int swsusp_check(bool exclusive);
 extern void swsusp_free(void);
 extern int swsusp_read(unsigned int *flags_p);
 extern int swsusp_write(unsigned int flags);
-void swsusp_close(bool snapshot_test);
+void swsusp_close(bool exclusive);
 #ifdef CONFIG_SUSPEND
 extern int swsusp_unmark(void);
 #endif
index f6ebcd00c4100ba1c722501d06092a653e513a8c..74edbce2320bae543c522b97301ec9719725cfa1 100644 (file)
@@ -1513,12 +1513,13 @@ end:
 static void *swsusp_holder;
 
 /**
- *      swsusp_check - Check for swsusp signature in the resume device
+ * swsusp_check - Check for swsusp signature in the resume device
+ * @exclusive: Open the resume device exclusively.
  */
 
-int swsusp_check(bool snapshot_test)
+int swsusp_check(bool exclusive)
 {
-       void *holder = snapshot_test ? &swsusp_holder : NULL;
+       void *holder = exclusive ? &swsusp_holder : NULL;
        int error;
 
        hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device, BLK_OPEN_READ,
@@ -1563,17 +1564,18 @@ put:
 }
 
 /**
- *     swsusp_close - close swap device.
+ * swsusp_close - close swap device.
+ * @exclusive: Close the resume device which is exclusively opened.
  */
 
-void swsusp_close(bool snapshot_test)
+void swsusp_close(bool exclusive)
 {
        if (IS_ERR(hib_resume_bdev)) {
                pr_debug("Image device not initialised\n");
                return;
        }
 
-       blkdev_put(hib_resume_bdev, snapshot_test ? &swsusp_holder : NULL);
+       blkdev_put(hib_resume_bdev, exclusive ? &swsusp_holder : NULL);
 }
 
 /**
index 8dbff6e7ad4f53af8965f5ab5ace0c1f2a758c63..cb225921bbca47419eeac08a96c98ac74a57ced2 100644 (file)
@@ -6619,6 +6619,7 @@ dequeue_throttle:
 /* Working cpumask for: load_balance, load_balance_newidle. */
 static DEFINE_PER_CPU(cpumask_var_t, load_balance_mask);
 static DEFINE_PER_CPU(cpumask_var_t, select_rq_mask);
+static DEFINE_PER_CPU(cpumask_var_t, should_we_balance_tmpmask);
 
 #ifdef CONFIG_NO_HZ_COMMON
 
@@ -9579,7 +9580,7 @@ static inline long sibling_imbalance(struct lb_env *env,
        imbalance /= ncores_local + ncores_busiest;
 
        /* Take advantage of resource in an empty sched group */
-       if (imbalance == 0 && local->sum_nr_running == 0 &&
+       if (imbalance <= 1 && local->sum_nr_running == 0 &&
            busiest->sum_nr_running > 1)
                imbalance = 2;
 
@@ -9767,6 +9768,15 @@ static bool update_sd_pick_busiest(struct lb_env *env,
                break;
 
        case group_smt_balance:
+               /*
+                * Check if we have spare CPUs on either SMT group to
+                * choose has spare or fully busy handling.
+                */
+               if (sgs->idle_cpus != 0 || busiest->idle_cpus != 0)
+                       goto has_spare;
+
+               fallthrough;
+
        case group_fully_busy:
                /*
                 * Select the fully busy group with highest avg_load. In
@@ -9806,6 +9816,7 @@ static bool update_sd_pick_busiest(struct lb_env *env,
                        else
                                return true;
                }
+has_spare:
 
                /*
                 * Select not overloaded group with lowest number of idle cpus
@@ -10917,6 +10928,7 @@ static int active_load_balance_cpu_stop(void *data);
 
 static int should_we_balance(struct lb_env *env)
 {
+       struct cpumask *swb_cpus = this_cpu_cpumask_var_ptr(should_we_balance_tmpmask);
        struct sched_group *sg = env->sd->groups;
        int cpu, idle_smt = -1;
 
@@ -10940,8 +10952,9 @@ static int should_we_balance(struct lb_env *env)
                return 1;
        }
 
+       cpumask_copy(swb_cpus, group_balance_mask(sg));
        /* Try to find first idle CPU */
-       for_each_cpu_and(cpu, group_balance_mask(sg), env->cpus) {
+       for_each_cpu_and(cpu, swb_cpus, env->cpus) {
                if (!idle_cpu(cpu))
                        continue;
 
@@ -10953,6 +10966,14 @@ static int should_we_balance(struct lb_env *env)
                if (!(env->sd->flags & SD_SHARE_CPUCAPACITY) && !is_core_idle(cpu)) {
                        if (idle_smt == -1)
                                idle_smt = cpu;
+                       /*
+                        * If the core is not idle, and first SMT sibling which is
+                        * idle has been found, then its not needed to check other
+                        * SMT siblings for idleness:
+                        */
+#ifdef CONFIG_SCHED_SMT
+                       cpumask_andnot(swb_cpus, swb_cpus, cpu_smt_mask(cpu));
+#endif
                        continue;
                }
 
@@ -12918,6 +12939,8 @@ __init void init_sched_fair_class(void)
        for_each_possible_cpu(i) {
                zalloc_cpumask_var_node(&per_cpu(load_balance_mask, i), GFP_KERNEL, cpu_to_node(i));
                zalloc_cpumask_var_node(&per_cpu(select_rq_mask,    i), GFP_KERNEL, cpu_to_node(i));
+               zalloc_cpumask_var_node(&per_cpu(should_we_balance_tmpmask, i),
+                                       GFP_KERNEL, cpu_to_node(i));
 
 #ifdef CONFIG_CFS_BANDWIDTH
                INIT_CSD(&cpu_rq(i)->cfsb_csd, __cfsb_csd_unthrottle, cpu_rq(i));
index 056478c106eec6894b26b57d847ca785cb6b2faa..382e81c33fc437f2e11e49a1f8a7d68e99e5c845 100644 (file)
@@ -715,7 +715,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
        }
 
        vma_iter_init(&vmi, mm, old_addr);
-       if (!do_vmi_munmap(&vmi, mm, old_addr, old_len, uf_unmap, false)) {
+       if (do_vmi_munmap(&vmi, mm, old_addr, old_len, uf_unmap, false) < 0) {
                /* OOM: unable to split vma, just get accounts right */
                if (vm_flags & VM_ACCOUNT && !(flags & MREMAP_DONTUNMAP))
                        vm_acct_memory(old_len >> PAGE_SHIFT);
index 02e62fccc80d4973b6626988eed07ff2482980d1..69595d3418829f08d05829f3ad5166b7421a30fc 100644 (file)
@@ -4586,7 +4586,7 @@ static struct file_system_type shmem_fs_type = {
 #endif
        .kill_sb        = kill_litter_super,
 #ifdef CONFIG_SHMEM
-       .fs_flags       = FS_USERNS_MOUNT | FS_ALLOW_IDMAP | FS_MGTIME,
+       .fs_flags       = FS_USERNS_MOUNT | FS_ALLOW_IDMAP,
 #else
        .fs_flags       = FS_USERNS_MOUNT,
 #endif
index 9d5057cef30a303abf099f1f7eff05afe56abaf3..7a6f20338db8efe42a6f3ec44bb08a37eec35ed3 100644 (file)
@@ -2413,34 +2413,41 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type,
        if (!test_bit(HCI_CONN_AUTH, &conn->flags))
                goto auth;
 
-       /* An authenticated FIPS approved combination key has sufficient
-        * security for security level 4. */
-       if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256 &&
-           sec_level == BT_SECURITY_FIPS)
-               goto encrypt;
-
-       /* An authenticated combination key has sufficient security for
-          security level 3. */
-       if ((conn->key_type == HCI_LK_AUTH_COMBINATION_P192 ||
-            conn->key_type == HCI_LK_AUTH_COMBINATION_P256) &&
-           sec_level == BT_SECURITY_HIGH)
-               goto encrypt;
-
-       /* An unauthenticated combination key has sufficient security for
-          security level 1 and 2. */
-       if ((conn->key_type == HCI_LK_UNAUTH_COMBINATION_P192 ||
-            conn->key_type == HCI_LK_UNAUTH_COMBINATION_P256) &&
-           (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW))
-               goto encrypt;
-
-       /* A combination key has always sufficient security for the security
-          levels 1 or 2. High security level requires the combination key
-          is generated using maximum PIN code length (16).
-          For pre 2.1 units. */
-       if (conn->key_type == HCI_LK_COMBINATION &&
-           (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW ||
-            conn->pin_length == 16))
-               goto encrypt;
+       switch (conn->key_type) {
+       case HCI_LK_AUTH_COMBINATION_P256:
+               /* An authenticated FIPS approved combination key has
+                * sufficient security for security level 4 or lower.
+                */
+               if (sec_level <= BT_SECURITY_FIPS)
+                       goto encrypt;
+               break;
+       case HCI_LK_AUTH_COMBINATION_P192:
+               /* An authenticated combination key has sufficient security for
+                * security level 3 or lower.
+                */
+               if (sec_level <= BT_SECURITY_HIGH)
+                       goto encrypt;
+               break;
+       case HCI_LK_UNAUTH_COMBINATION_P192:
+       case HCI_LK_UNAUTH_COMBINATION_P256:
+               /* An unauthenticated combination key has sufficient security
+                * for security level 2 or lower.
+                */
+               if (sec_level <= BT_SECURITY_MEDIUM)
+                       goto encrypt;
+               break;
+       case HCI_LK_COMBINATION:
+               /* A combination key has always sufficient security for the
+                * security levels 2 or lower. High security level requires the
+                * combination key is generated using maximum PIN code length
+                * (16). For pre 2.1 units.
+                */
+               if (sec_level <= BT_SECURITY_MEDIUM || conn->pin_length == 16)
+                       goto encrypt;
+               break;
+       default:
+               break;
+       }
 
 auth:
        if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
index a5992f1b3c9b74438986f4f3a7289a1e9ddec873..195aea2198a963ebeecaec40f74e03be7e3a70b5 100644 (file)
@@ -2617,7 +2617,11 @@ int hci_register_dev(struct hci_dev *hdev)
        if (id < 0)
                return id;
 
-       snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
+       error = dev_set_name(&hdev->dev, "hci%u", id);
+       if (error)
+               return error;
+
+       hdev->name = dev_name(&hdev->dev);
        hdev->id = id;
 
        BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
@@ -2639,8 +2643,6 @@ int hci_register_dev(struct hci_dev *hdev)
        if (!IS_ERR_OR_NULL(bt_debugfs))
                hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs);
 
-       dev_set_name(&hdev->dev, "%s", hdev->name);
-
        error = device_add(&hdev->dev);
        if (error < 0)
                goto err_wqueue;
@@ -2784,6 +2786,7 @@ void hci_release_dev(struct hci_dev *hdev)
        hci_conn_params_clear_all(hdev);
        hci_discovery_filter_clear(hdev);
        hci_blocked_keys_clear(hdev);
+       hci_codec_list_clear(&hdev->local_codecs);
        hci_dev_unlock(hdev);
 
        ida_simple_remove(&hci_index_ida, hdev->id);
@@ -3418,7 +3421,12 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
                if (c->type == type && c->sent) {
                        bt_dev_err(hdev, "killing stalled connection %pMR",
                                   &c->dst);
+                       /* hci_disconnect might sleep, so, we have to release
+                        * the RCU read lock before calling it.
+                        */
+                       rcu_read_unlock();
                        hci_disconnect(c, HCI_ERROR_REMOTE_USER_TERM);
+                       rcu_read_lock();
                }
        }
 
index 35f251041eeb9b58f2ffce8696a3c84a6f5e8355..31d02b54eea119f0a03f3de45a33475a982ca529 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "hci_request.h"
 #include "hci_debugfs.h"
+#include "hci_codec.h"
 #include "a2mp.h"
 #include "amp.h"
 #include "smp.h"
index b9c5a98238374cccb4a59fbc3d41c7c465db1afd..0be75cf0efed86c450f5765c8f7b8b2b66c1c608 100644 (file)
@@ -71,7 +71,5 @@ struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen,
 void hci_req_add_le_scan_disable(struct hci_request *req, bool rpa_le_conn);
 void hci_req_add_le_passive_scan(struct hci_request *req);
 
-void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next);
-
 void hci_request_setup(struct hci_dev *hdev);
 void hci_request_cancel_all(struct hci_dev *hdev);
index 9b93653c6197300eb5f4c8d55dd3f38557b1976d..d06e07a0ea5a983fd3dabc155f8ff8ce5b5ada4c 100644 (file)
@@ -413,11 +413,6 @@ static int hci_le_scan_restart_sync(struct hci_dev *hdev)
                                           LE_SCAN_FILTER_DUP_ENABLE);
 }
 
-static int le_scan_restart_sync(struct hci_dev *hdev, void *data)
-{
-       return hci_le_scan_restart_sync(hdev);
-}
-
 static void le_scan_restart(struct work_struct *work)
 {
        struct hci_dev *hdev = container_of(work, struct hci_dev,
@@ -427,15 +422,15 @@ static void le_scan_restart(struct work_struct *work)
 
        bt_dev_dbg(hdev, "");
 
-       hci_dev_lock(hdev);
-
-       status = hci_cmd_sync_queue(hdev, le_scan_restart_sync, NULL, NULL);
+       status = hci_le_scan_restart_sync(hdev);
        if (status) {
                bt_dev_err(hdev, "failed to restart LE scan: status %d",
                           status);
-               goto unlock;
+               return;
        }
 
+       hci_dev_lock(hdev);
+
        if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) ||
            !hdev->discovery.scan_start)
                goto unlock;
@@ -5079,6 +5074,7 @@ int hci_dev_close_sync(struct hci_dev *hdev)
        memset(hdev->eir, 0, sizeof(hdev->eir));
        memset(hdev->dev_class, 0, sizeof(hdev->dev_class));
        bacpy(&hdev->random_addr, BDADDR_ANY);
+       hci_codec_list_clear(&hdev->local_codecs);
 
        hci_dev_put(hdev);
        return err;
index 16da946f5881bab7d3b3da2ab5046eb372c6953d..71248163ce9a5c76582037e7ad3ac1a3f2f7e008 100644 (file)
@@ -502,7 +502,7 @@ drop:
 }
 
 /* -------- Socket interface ---------- */
-static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *ba)
+static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *src, bdaddr_t *dst)
 {
        struct sock *sk;
 
@@ -510,7 +510,10 @@ static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *ba)
                if (sk->sk_state != BT_LISTEN)
                        continue;
 
-               if (!bacmp(&iso_pi(sk)->src, ba))
+               if (bacmp(&iso_pi(sk)->dst, dst))
+                       continue;
+
+               if (!bacmp(&iso_pi(sk)->src, src))
                        return sk;
        }
 
@@ -952,7 +955,7 @@ static int iso_listen_cis(struct sock *sk)
 
        write_lock(&iso_sk_list.lock);
 
-       if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src))
+       if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src, &iso_pi(sk)->dst))
                err = -EADDRINUSE;
 
        write_unlock(&iso_sk_list.lock);
index 9d7bc8b96b53a911d5add8d0b21736358441755f..7431f89e897b9549a0c35d9431e36b6de2e80022 100644 (file)
@@ -124,7 +124,7 @@ static int deliver_clone(const struct net_bridge_port *prev,
 
        skb = skb_clone(skb, GFP_ATOMIC);
        if (!skb) {
-               dev->stats.tx_dropped++;
+               DEV_STATS_INC(dev, tx_dropped);
                return -ENOMEM;
        }
 
@@ -268,7 +268,7 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb,
 
        skb = skb_copy(skb, GFP_ATOMIC);
        if (!skb) {
-               dev->stats.tx_dropped++;
+               DEV_STATS_INC(dev, tx_dropped);
                return;
        }
 
index c34a0b0901b07de9e2a3f172527a2bf1c0b6f0b7..c729528b5e85f3a28eff6bd346c18bc11288e7a8 100644 (file)
@@ -181,12 +181,12 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
                        if ((mdst && mdst->host_joined) ||
                            br_multicast_is_router(brmctx, skb)) {
                                local_rcv = true;
-                               br->dev->stats.multicast++;
+                               DEV_STATS_INC(br->dev, multicast);
                        }
                        mcast_hit = true;
                } else {
                        local_rcv = true;
-                       br->dev->stats.multicast++;
+                       DEV_STATS_INC(br->dev, multicast);
                }
                break;
        case BR_PKT_UNICAST:
index 15186247b59af52062907cacec994e736ddbc01b..033034d68f1f057349acdd2f127c427195be6b62 100644 (file)
@@ -294,7 +294,7 @@ int br_nf_pre_routing_finish_bridge(struct net *net, struct sock *sk, struct sk_
                        /* tell br_dev_xmit to continue with forwarding */
                        nf_bridge->bridged_dnat = 1;
                        /* FIXME Need to refragment */
-                       ret = neigh->output(neigh, skb);
+                       ret = READ_ONCE(neigh->output)(neigh, skb);
                }
                neigh_release(neigh);
                return ret;
index 6b76cd103195374f73786b7bb94fb2f4051a3c73..9c09f091cbffe59043ce4614423d7dce7d4ec42a 100644 (file)
@@ -410,7 +410,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev,
                                 */
                                __skb_queue_purge(&n->arp_queue);
                                n->arp_queue_len_bytes = 0;
-                               n->output = neigh_blackhole;
+                               WRITE_ONCE(n->output, neigh_blackhole);
                                if (n->nud_state & NUD_VALID)
                                        n->nud_state = NUD_NOARP;
                                else
@@ -920,7 +920,7 @@ static void neigh_suspect(struct neighbour *neigh)
 {
        neigh_dbg(2, "neigh %p is suspected\n", neigh);
 
-       neigh->output = neigh->ops->output;
+       WRITE_ONCE(neigh->output, neigh->ops->output);
 }
 
 /* Neighbour state is OK;
@@ -932,7 +932,7 @@ static void neigh_connect(struct neighbour *neigh)
 {
        neigh_dbg(2, "neigh %p is connected\n", neigh);
 
-       neigh->output = neigh->ops->connected_output;
+       WRITE_ONCE(neigh->output, neigh->ops->connected_output);
 }
 
 static void neigh_periodic_work(struct work_struct *work)
@@ -988,7 +988,9 @@ static void neigh_periodic_work(struct work_struct *work)
                            (state == NUD_FAILED ||
                             !time_in_range_open(jiffies, n->used,
                                                 n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) {
-                               *np = n->next;
+                               rcu_assign_pointer(*np,
+                                       rcu_dereference_protected(n->next,
+                                               lockdep_is_held(&tbl->lock)));
                                neigh_mark_dead(n);
                                write_unlock(&n->lock);
                                neigh_cleanup_and_release(n);
@@ -1447,7 +1449,7 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr,
                                if (n2)
                                        n1 = n2;
                        }
-                       n1->output(n1, skb);
+                       READ_ONCE(n1->output)(n1, skb);
                        if (n2)
                                neigh_release(n2);
                        rcu_read_unlock();
@@ -3153,7 +3155,7 @@ int neigh_xmit(int index, struct net_device *dev,
                        rcu_read_unlock();
                        goto out_kfree_skb;
                }
-               err = neigh->output(neigh, skb);
+               err = READ_ONCE(neigh->output)(neigh, skb);
                rcu_read_unlock();
        }
        else if (index == NEIGH_LINK_TABLE) {
index b238a1afe9aeddf094046ba056cb8cd6a1660e77..b1e2e3b5027fc7b9a26c9bbdf61006b771b457a3 100644 (file)
@@ -21,16 +21,6 @@ struct plca_reply_data {
 #define PLCA_REPDATA(__reply_base) \
        container_of(__reply_base, struct plca_reply_data, base)
 
-static void plca_update_sint(int *dst, const struct nlattr *attr,
-                            bool *mod)
-{
-       if (!attr)
-               return;
-
-       *dst = nla_get_u32(attr);
-       *mod = true;
-}
-
 // PLCA get configuration message ------------------------------------------- //
 
 const struct nla_policy ethnl_plca_get_cfg_policy[] = {
@@ -38,6 +28,29 @@ const struct nla_policy ethnl_plca_get_cfg_policy[] = {
                NLA_POLICY_NESTED(ethnl_header_policy),
 };
 
+static void plca_update_sint(int *dst, struct nlattr **tb, u32 attrid,
+                            bool *mod)
+{
+       const struct nlattr *attr = tb[attrid];
+
+       if (!attr ||
+           WARN_ON_ONCE(attrid >= ARRAY_SIZE(ethnl_plca_set_cfg_policy)))
+               return;
+
+       switch (ethnl_plca_set_cfg_policy[attrid].type) {
+       case NLA_U8:
+               *dst = nla_get_u8(attr);
+               break;
+       case NLA_U32:
+               *dst = nla_get_u32(attr);
+               break;
+       default:
+               WARN_ON_ONCE(1);
+       }
+
+       *mod = true;
+}
+
 static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
                                     struct ethnl_reply_data *reply_base,
                                     const struct genl_info *info)
@@ -144,13 +157,13 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info)
                return -EOPNOTSUPP;
 
        memset(&plca_cfg, 0xff, sizeof(plca_cfg));
-       plca_update_sint(&plca_cfg.enabled, tb[ETHTOOL_A_PLCA_ENABLED], &mod);
-       plca_update_sint(&plca_cfg.node_id, tb[ETHTOOL_A_PLCA_NODE_ID], &mod);
-       plca_update_sint(&plca_cfg.node_cnt, tb[ETHTOOL_A_PLCA_NODE_CNT], &mod);
-       plca_update_sint(&plca_cfg.to_tmr, tb[ETHTOOL_A_PLCA_TO_TMR], &mod);
-       plca_update_sint(&plca_cfg.burst_cnt, tb[ETHTOOL_A_PLCA_BURST_CNT],
+       plca_update_sint(&plca_cfg.enabled, tb, ETHTOOL_A_PLCA_ENABLED, &mod);
+       plca_update_sint(&plca_cfg.node_id, tb, ETHTOOL_A_PLCA_NODE_ID, &mod);
+       plca_update_sint(&plca_cfg.node_cnt, tb, ETHTOOL_A_PLCA_NODE_CNT, &mod);
+       plca_update_sint(&plca_cfg.to_tmr, tb, ETHTOOL_A_PLCA_TO_TMR, &mod);
+       plca_update_sint(&plca_cfg.burst_cnt, tb, ETHTOOL_A_PLCA_BURST_CNT,
                         &mod);
-       plca_update_sint(&plca_cfg.burst_tmr, tb[ETHTOOL_A_PLCA_BURST_TMR],
+       plca_update_sint(&plca_cfg.burst_tmr, tb, ETHTOOL_A_PLCA_BURST_TMR,
                         &mod);
        if (!mod)
                return 0;
index 6d37bab35c8fcc42e77d1fc081a87d61658751c3..16ed7bfd29e4fbf39e204278950834b9e69b9f97 100644 (file)
@@ -235,7 +235,7 @@ static void handshake_req_submit_test4(struct kunit *test)
        KUNIT_EXPECT_PTR_EQ(test, req, result);
 
        handshake_req_cancel(sock->sk);
-       sock_release(sock);
+       fput(filp);
 }
 
 static void handshake_req_submit_test5(struct kunit *test)
@@ -272,7 +272,7 @@ static void handshake_req_submit_test5(struct kunit *test)
        /* Assert */
        KUNIT_EXPECT_EQ(test, err, -EAGAIN);
 
-       sock_release(sock);
+       fput(filp);
        hn->hn_pending = saved;
 }
 
@@ -306,7 +306,7 @@ static void handshake_req_submit_test6(struct kunit *test)
        KUNIT_EXPECT_EQ(test, err, -EBUSY);
 
        handshake_req_cancel(sock->sk);
-       sock_release(sock);
+       fput(filp);
 }
 
 static void handshake_req_cancel_test1(struct kunit *test)
@@ -340,7 +340,7 @@ static void handshake_req_cancel_test1(struct kunit *test)
        /* Assert */
        KUNIT_EXPECT_TRUE(test, result);
 
-       sock_release(sock);
+       fput(filp);
 }
 
 static void handshake_req_cancel_test2(struct kunit *test)
@@ -382,7 +382,7 @@ static void handshake_req_cancel_test2(struct kunit *test)
        /* Assert */
        KUNIT_EXPECT_TRUE(test, result);
 
-       sock_release(sock);
+       fput(filp);
 }
 
 static void handshake_req_cancel_test3(struct kunit *test)
@@ -427,7 +427,7 @@ static void handshake_req_cancel_test3(struct kunit *test)
        /* Assert */
        KUNIT_EXPECT_FALSE(test, result);
 
-       sock_release(sock);
+       fput(filp);
 }
 
 static struct handshake_req *handshake_req_destroy_test;
@@ -471,7 +471,7 @@ static void handshake_req_destroy_test1(struct kunit *test)
        handshake_req_cancel(sock->sk);
 
        /* Act */
-       sock_release(sock);
+       fput(filp);
 
        /* Assert */
        KUNIT_EXPECT_PTR_EQ(test, handshake_req_destroy_test, req);
index eafa4a033515782b4ade9a81ec12cb22f5e51e35..1ea82bc33ef14bd4411204c58ea5fece02783b35 100644 (file)
@@ -1887,6 +1887,7 @@ int fib_sync_down_addr(struct net_device *dev, __be32 local)
                        continue;
                if (fi->fib_prefsrc == local) {
                        fi->fib_flags |= RTNH_F_DEAD;
+                       fi->pfsrc_removed = true;
                        ret++;
                }
        }
index d13fb9e76b9718c674b82ea9069f98fb29f06425..9bdfdab906fe00cb048718eef932892181723a40 100644 (file)
@@ -2027,6 +2027,7 @@ void fib_table_flush_external(struct fib_table *tb)
 int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
 {
        struct trie *t = (struct trie *)tb->tb_data;
+       struct nl_info info = { .nl_net = net };
        struct key_vector *pn = t->kv;
        unsigned long cindex = 1;
        struct hlist_node *tmp;
@@ -2089,6 +2090,9 @@ int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
 
                        fib_notify_alias_delete(net, n->key, &n->leaf, fa,
                                                NULL);
+                       if (fi->pfsrc_removed)
+                               rtmsg_fib(RTM_DELROUTE, htonl(n->key), fa,
+                                         KEYLENGTH - fa->fa_slen, tb->tb_id, &info, 0);
                        hlist_del_rcu(&fa->fa_list);
                        fib_release_info(fa->fa_info);
                        alias_free_mem_rcu(fa);
index 3a88545a265d6bd064ecc41d33c9541a75fe0f4d..44b6949d72b2216b4d3934cd302bfff94ecae23d 100644 (file)
@@ -1640,9 +1640,12 @@ process:
                struct sock *nsk;
 
                sk = req->rsk_listener;
-               drop_reason = tcp_inbound_md5_hash(sk, skb,
-                                                  &hdr->saddr, &hdr->daddr,
-                                                  AF_INET6, dif, sdif);
+               if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
+                       drop_reason = SKB_DROP_REASON_XFRM_POLICY;
+               else
+                       drop_reason = tcp_inbound_md5_hash(sk, skb,
+                                                          &hdr->saddr, &hdr->daddr,
+                                                          AF_INET6, dif, sdif);
                if (drop_reason) {
                        sk_drops_add(sk, skb);
                        reqsk_put(req);
@@ -1689,6 +1692,7 @@ process:
                        }
                        goto discard_and_relse;
                }
+               nf_reset_ct(skb);
                if (nsk == sk) {
                        reqsk_put(req);
                        tcp_v6_restore_cb(skb);
index ed8ebb6f59097ac18bb284d1c48f9e801e9a92c2..11f3d375cec0003338c15e1e19cf8e4c99127958 100644 (file)
@@ -507,7 +507,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
         */
        if (len > INT_MAX - transhdrlen)
                return -EMSGSIZE;
-       ulen = len + transhdrlen;
 
        /* Mirror BSD error message compatibility */
        if (msg->msg_flags & MSG_OOB)
@@ -628,6 +627,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 
 back_from_confirm:
        lock_sock(sk);
+       ulen = len + skb_queue_empty(&sk->sk_write_queue) ? transhdrlen : 0;
        err = ip6_append_data(sk, ip_generic_getfrag, msg,
                              ulen, transhdrlen, &ipc6,
                              &fl6, (struct rt6_info *)dst,
index e564b5174261159173bfda0756480ca554243b7d..35d2f9c9ada0252e01af3bee1faa1f63a0c94498 100644 (file)
@@ -682,6 +682,14 @@ __ip_set_put(struct ip_set *set)
 /* set->ref can be swapped out by ip_set_swap, netlink events (like dump) need
  * a separate reference counter
  */
+static void
+__ip_set_get_netlink(struct ip_set *set)
+{
+       write_lock_bh(&ip_set_ref_lock);
+       set->ref_netlink++;
+       write_unlock_bh(&ip_set_ref_lock);
+}
+
 static void
 __ip_set_put_netlink(struct ip_set *set)
 {
@@ -1693,11 +1701,11 @@ call_ad(struct net *net, struct sock *ctnl, struct sk_buff *skb,
 
        do {
                if (retried) {
-                       __ip_set_get(set);
+                       __ip_set_get_netlink(set);
                        nfnl_unlock(NFNL_SUBSYS_IPSET);
                        cond_resched();
                        nfnl_lock(NFNL_SUBSYS_IPSET);
-                       __ip_set_put(set);
+                       __ip_set_put_netlink(set);
                }
 
                ip_set_lock(set);
index da5af28ff57b5254c0ec8976c4180113037c96a0..4174076c66fa7795ecbdef18ca2b30f92765cd4d 100644 (file)
@@ -1439,7 +1439,7 @@ static int bind_mcastif_addr(struct socket *sock, struct net_device *dev)
        sin.sin_addr.s_addr  = addr;
        sin.sin_port         = 0;
 
-       return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
+       return kernel_bind(sock, (struct sockaddr *)&sin, sizeof(sin));
 }
 
 static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen,
@@ -1505,8 +1505,8 @@ static int make_send_sock(struct netns_ipvs *ipvs, int id,
        }
 
        get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->mcfg, id);
-       result = sock->ops->connect(sock, (struct sockaddr *) &mcast_addr,
-                                   salen, 0);
+       result = kernel_connect(sock, (struct sockaddr *)&mcast_addr,
+                               salen, 0);
        if (result < 0) {
                pr_err("Error connecting to the multicast addr\n");
                goto error;
@@ -1546,7 +1546,7 @@ static int make_receive_sock(struct netns_ipvs *ipvs, int id,
 
        get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->bcfg, id);
        sock->sk->sk_bound_dev_if = dev->ifindex;
-       result = sock->ops->bind(sock, (struct sockaddr *)&mcast_addr, salen);
+       result = kernel_bind(sock, (struct sockaddr *)&mcast_addr, salen);
        if (result < 0) {
                pr_err("Error binding to the multicast addr\n");
                goto error;
index d819b4d429624da87366d6ad9173f0cedc49ae73..4356189360fb88d695b25070264783520aeef6b1 100644 (file)
@@ -1219,6 +1219,10 @@ static int nf_tables_updtable(struct nft_ctx *ctx)
             flags & NFT_TABLE_F_OWNER))
                return -EOPNOTSUPP;
 
+       /* No dormant off/on/off/on games in single transaction */
+       if (ctx->table->flags & __NFT_TABLE_F_UPDATE)
+               return -EINVAL;
+
        trans = nft_trans_alloc(ctx, NFT_MSG_NEWTABLE,
                                sizeof(struct nft_trans_table));
        if (trans == NULL)
@@ -9575,12 +9579,15 @@ static int nft_trans_gc_space(struct nft_trans_gc *trans)
 struct nft_trans_gc *nft_trans_gc_queue_async(struct nft_trans_gc *gc,
                                              unsigned int gc_seq, gfp_t gfp)
 {
+       struct nft_set *set;
+
        if (nft_trans_gc_space(gc))
                return gc;
 
+       set = gc->set;
        nft_trans_gc_queue_work(gc);
 
-       return nft_trans_gc_alloc(gc->set, gc_seq, gfp);
+       return nft_trans_gc_alloc(set, gc_seq, gfp);
 }
 
 void nft_trans_gc_queue_async_done(struct nft_trans_gc *trans)
@@ -9595,15 +9602,18 @@ void nft_trans_gc_queue_async_done(struct nft_trans_gc *trans)
 
 struct nft_trans_gc *nft_trans_gc_queue_sync(struct nft_trans_gc *gc, gfp_t gfp)
 {
+       struct nft_set *set;
+
        if (WARN_ON_ONCE(!lockdep_commit_lock_is_held(gc->net)))
                return NULL;
 
        if (nft_trans_gc_space(gc))
                return gc;
 
+       set = gc->set;
        call_rcu(&gc->rcu, nft_trans_gc_trans_free);
 
-       return nft_trans_gc_alloc(gc->set, 0, gfp);
+       return nft_trans_gc_alloc(set, 0, gfp);
 }
 
 void nft_trans_gc_queue_sync_done(struct nft_trans_gc *trans)
index f60e424e060764916b6bd37e117c22ddea1b00ea..6705bb895e23930fad97715214d7b6e56c8c2829 100644 (file)
@@ -1636,7 +1636,9 @@ int nfc_llcp_register_device(struct nfc_dev *ndev)
        timer_setup(&local->sdreq_timer, nfc_llcp_sdreq_timer, 0);
        INIT_WORK(&local->sdreq_timeout_work, nfc_llcp_sdreq_timeout_work);
 
+       spin_lock(&llcp_devices_lock);
        list_add(&local->list, &llcp_devices);
+       spin_unlock(&llcp_devices_lock);
 
        return 0;
 }
index d36f3f6b43510dde1ef2e98515b41c6890d76ebf..b15cf316b23a221d47eaf0e7c38200840cc2442b 100644 (file)
@@ -86,11 +86,13 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
                break;
 
        case RDMA_CM_EVENT_ADDR_RESOLVED:
-               rdma_set_service_type(cm_id, conn->c_tos);
-               rdma_set_min_rnr_timer(cm_id, IB_RNR_TIMER_000_32);
-               /* XXX do we need to clean up if this fails? */
-               ret = rdma_resolve_route(cm_id,
-                                        RDS_RDMA_RESOLVE_TIMEOUT_MS);
+               if (conn) {
+                       rdma_set_service_type(cm_id, conn->c_tos);
+                       rdma_set_min_rnr_timer(cm_id, IB_RNR_TIMER_000_32);
+                       /* XXX do we need to clean up if this fails? */
+                       ret = rdma_resolve_route(cm_id,
+                                                RDS_RDMA_RESOLVE_TIMEOUT_MS);
+               }
                break;
 
        case RDMA_CM_EVENT_ROUTE_RESOLVED:
index f0c477c5d1db4e355afc370b563652bad4b52905..a0046e99d6df71987707a655cee0def985328b01 100644 (file)
@@ -145,7 +145,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp)
                addrlen = sizeof(sin);
        }
 
-       ret = sock->ops->bind(sock, addr, addrlen);
+       ret = kernel_bind(sock, addr, addrlen);
        if (ret) {
                rdsdebug("bind failed with %d at address %pI6c\n",
                         ret, &conn->c_laddr);
@@ -173,7 +173,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp)
         * own the socket
         */
        rds_tcp_set_callbacks(sock, cp);
-       ret = sock->ops->connect(sock, addr, addrlen, O_NONBLOCK);
+       ret = kernel_connect(sock, addr, addrlen, O_NONBLOCK);
 
        rdsdebug("connect to address %pI6c returned %d\n", &conn->c_faddr, ret);
        if (ret == -EINPROGRESS)
index 014fa24418c12ea29d7be7fb72028f44bf6bd9ce..53b3535a1e4a84c3e5ae9dee110af2df376c7f20 100644 (file)
@@ -306,7 +306,7 @@ struct socket *rds_tcp_listen_init(struct net *net, bool isv6)
                addr_len = sizeof(*sin);
        }
 
-       ret = sock->ops->bind(sock, (struct sockaddr *)&ss, addr_len);
+       ret = kernel_bind(sock, (struct sockaddr *)&ss, addr_len);
        if (ret < 0) {
                rdsdebug("could not bind %s listener socket: %d\n",
                         isv6 ? "IPv6" : "IPv4", ret);
index c8b08b32f097ec5dfde66b42701be720ab05c826..c4a6f55329552d9c80a41b1b691ce305c22f09f8 100644 (file)
@@ -737,6 +737,14 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
        return ret;
 }
 
+static int __sock_sendmsg(struct socket *sock, struct msghdr *msg)
+{
+       int err = security_socket_sendmsg(sock, msg,
+                                         msg_data_left(msg));
+
+       return err ?: sock_sendmsg_nosec(sock, msg);
+}
+
 /**
  *     sock_sendmsg - send a message through @sock
  *     @sock: socket
@@ -747,10 +755,19 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
  */
 int sock_sendmsg(struct socket *sock, struct msghdr *msg)
 {
-       int err = security_socket_sendmsg(sock, msg,
-                                         msg_data_left(msg));
+       struct sockaddr_storage *save_addr = (struct sockaddr_storage *)msg->msg_name;
+       struct sockaddr_storage address;
+       int ret;
 
-       return err ?: sock_sendmsg_nosec(sock, msg);
+       if (msg->msg_name) {
+               memcpy(&address, msg->msg_name, msg->msg_namelen);
+               msg->msg_name = &address;
+       }
+
+       ret = __sock_sendmsg(sock, msg);
+       msg->msg_name = save_addr;
+
+       return ret;
 }
 EXPORT_SYMBOL(sock_sendmsg);
 
@@ -1138,7 +1155,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)
        if (sock->type == SOCK_SEQPACKET)
                msg.msg_flags |= MSG_EOR;
 
-       res = sock_sendmsg(sock, &msg);
+       res = __sock_sendmsg(sock, &msg);
        *from = msg.msg_iter;
        return res;
 }
@@ -2174,7 +2191,7 @@ int __sys_sendto(int fd, void __user *buff, size_t len, unsigned int flags,
        if (sock->file->f_flags & O_NONBLOCK)
                flags |= MSG_DONTWAIT;
        msg.msg_flags = flags;
-       err = sock_sendmsg(sock, &msg);
+       err = __sock_sendmsg(sock, &msg);
 
 out_put:
        fput_light(sock->file, fput_needed);
@@ -2538,7 +2555,7 @@ static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys,
                err = sock_sendmsg_nosec(sock, msg_sys);
                goto out_freectl;
        }
-       err = sock_sendmsg(sock, msg_sys);
+       err = __sock_sendmsg(sock, msg_sys);
        /*
         * If this is sendmmsg() and sending to current destination address was
         * successful, remember it.
@@ -3499,7 +3516,12 @@ static long compat_sock_ioctl(struct file *file, unsigned int cmd,
 
 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen)
 {
-       return READ_ONCE(sock->ops)->bind(sock, addr, addrlen);
+       struct sockaddr_storage address;
+
+       memcpy(&address, addr, addrlen);
+
+       return READ_ONCE(sock->ops)->bind(sock, (struct sockaddr *)&address,
+                                         addrlen);
 }
 EXPORT_SYMBOL(kernel_bind);
 
index 8d75290f1a31d23d5f61439c18549ed76c36ced8..37b0b212b934757fcb59cfc9a8de32d006c2ee30 100644 (file)
@@ -2725,7 +2725,7 @@ out_unparsable:
 
 out_verifier:
        trace_rpc_bad_verifier(task);
-       goto out_err;
+       goto out_garbage;
 
 out_msg_denied:
        error = -EACCES;
@@ -2751,6 +2751,7 @@ out_msg_denied:
        case rpc_autherr_rejectedverf:
        case rpcsec_gsserr_credproblem:
        case rpcsec_gsserr_ctxproblem:
+               rpcauth_invalcred(task);
                if (!task->tk_cred_retry)
                        break;
                task->tk_cred_retry--;
@@ -2907,19 +2908,22 @@ static const struct rpc_call_ops rpc_cb_add_xprt_call_ops = {
  * @clnt: pointer to struct rpc_clnt
  * @xps: pointer to struct rpc_xprt_switch,
  * @xprt: pointer struct rpc_xprt
- * @dummy: unused
+ * @in_max_connect: pointer to the max_connect value for the passed in xprt transport
  */
 int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt,
                struct rpc_xprt_switch *xps, struct rpc_xprt *xprt,
-               void *dummy)
+               void *in_max_connect)
 {
        struct rpc_cb_add_xprt_calldata *data;
        struct rpc_task *task;
+       int max_connect = clnt->cl_max_connect;
 
-       if (xps->xps_nunique_destaddr_xprts + 1 > clnt->cl_max_connect) {
+       if (in_max_connect)
+               max_connect = *(int *)in_max_connect;
+       if (xps->xps_nunique_destaddr_xprts + 1 > max_connect) {
                rcu_read_lock();
                pr_warn("SUNRPC: reached max allowed number (%d) did not add "
-                       "transport to server: %s\n", clnt->cl_max_connect,
+                       "transport to server: %s\n", max_connect,
                        rpc_peeraddr2str(clnt, RPC_DISPLAY_ADDR));
                rcu_read_unlock();
                return -EINVAL;
index c59cc57286ba4669bd113018a9133ee2642bf15c..346f5ec506823e05fc4f2864223b2df574b0c842 100644 (file)
@@ -113,7 +113,7 @@ quiet_cmd_sign :=
 endif
 
 # Create necessary directories
-$(shell mkdir -p $(sort $(dir $(install-y))))
+$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))
 
 $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
        $(call cmd,install)
index af7fe9f5b1e4d3d79569d47f392a12cbea65accd..8a7051fad0878990cd4569a326fc7137a7db088d 100755 (executable)
@@ -20,7 +20,7 @@ mkdir -p "${destdir}"
        find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
        find include scripts -type f -o -type l
        find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform
-       find "$(find "arch/${SRCARCH}" -name include -o -name scripts -type d)" -type f
+       find "arch/${SRCARCH}" -name include -o -name scripts -type d
 ) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"
 
 {
index 10350534de6d65b3a4103ae9babe42fac3682261..2aa0e219d72177799b915322d73e0af1698901f6 100644 (file)
@@ -2775,14 +2775,20 @@ static int selinux_umount(struct vfsmount *mnt, int flags)
 static int selinux_fs_context_submount(struct fs_context *fc,
                                   struct super_block *reference)
 {
-       const struct superblock_security_struct *sbsec;
+       const struct superblock_security_struct *sbsec = selinux_superblock(reference);
        struct selinux_mnt_opts *opts;
 
+       /*
+        * Ensure that fc->security remains NULL when no options are set
+        * as expected by selinux_set_mnt_opts().
+        */
+       if (!(sbsec->flags & (FSCONTEXT_MNT|CONTEXT_MNT|DEFCONTEXT_MNT)))
+               return 0;
+
        opts = kzalloc(sizeof(*opts), GFP_KERNEL);
        if (!opts)
                return -ENOMEM;
 
-       sbsec = selinux_superblock(reference);
        if (sbsec->flags & FSCONTEXT_MNT)
                opts->fscontext_sid = sbsec->sid;
        if (sbsec->flags & CONTEXT_MNT)
index d61bde1225f23a362aa4c2edd64ec9ec32fc1987..22c0d217b8608f04b4c9c1803379b9546f12ed14 100644 (file)
@@ -278,9 +278,6 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
                         size_t extra_size)
 {
        int err;
-#ifdef CONFIG_SND_DEBUG
-       char name[8];
-#endif
 
        if (extra_size > 0)
                card->private_data = (char *)card + sizeof(struct snd_card);
@@ -364,8 +361,8 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
        }
 
 #ifdef CONFIG_SND_DEBUG
-       sprintf(name, "card%d", idx);
-       card->debugfs_root = debugfs_create_dir(name, sound_debugfs_root);
+       card->debugfs_root = debugfs_create_dir(dev_name(&card->card_dev),
+                                               sound_debugfs_root);
 #endif
        return 0;
 
index ba06484ac4aa9b6f7f05be7c63187cb22341df7b..1431cb997808d071d44efadba2b8a1d49117ee25 100644 (file)
@@ -1770,7 +1770,7 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
        if (IS_ENABLED(CONFIG_SND_UMP))
                snd_iprintf(buffer, "Type: %s\n",
                            rawmidi_is_ump(rmidi) ? "UMP" : "Legacy");
-       if (rmidi->ops->proc_read)
+       if (rmidi->ops && rmidi->ops->proc_read)
                rmidi->ops->proc_read(entry, buffer);
        mutex_lock(&rmidi->open_mutex);
        if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {
index 44302d98950e89aca5de30ca166b5e3ba6de9c7c..18320a248aa7daa080df9499668c400f4da22066 100644 (file)
@@ -349,9 +349,9 @@ snd_seq_midisynth_probe(struct device *_dev)
                if (! port->name[0]) {
                        if (info->name[0]) {
                                if (ports > 1)
-                                       snprintf(port->name, sizeof(port->name), "%s-%u", info->name, p);
+                                       scnprintf(port->name, sizeof(port->name), "%s-%u", info->name, p);
                                else
-                                       snprintf(port->name, sizeof(port->name), "%s", info->name);
+                                       scnprintf(port->name, sizeof(port->name), "%s", info->name);
                        } else {
                                /* last resort */
                                if (ports > 1)
index f26a1812dfa73e564aaf77f8197045c8e9a3a933..2db371d79930d0f2af7630f50901a3d69006e538 100644 (file)
@@ -207,7 +207,7 @@ static void fill_port_info(struct snd_seq_port_info *port,
                SNDRV_SEQ_PORT_TYPE_PORT;
        port->midi_channels = 16;
        if (*group->name)
-               snprintf(port->name, sizeof(port->name), "Group %d (%s)",
+               snprintf(port->name, sizeof(port->name), "Group %d (%.53s)",
                         group->group + 1, group->name);
        else
                sprintf(port->name, "Group %d", group->group + 1);
@@ -416,6 +416,25 @@ static void setup_client_midi_version(struct seq_ump_client *client)
        snd_seq_kernel_client_put(cptr);
 }
 
+/* set up client's group_filter bitmap */
+static void setup_client_group_filter(struct seq_ump_client *client)
+{
+       struct snd_seq_client *cptr;
+       unsigned int filter;
+       int p;
+
+       cptr = snd_seq_kernel_client_get(client->seq_client);
+       if (!cptr)
+               return;
+       filter = ~(1U << 0); /* always allow groupless messages */
+       for (p = 0; p < SNDRV_UMP_MAX_GROUPS; p++) {
+               if (client->groups[p].active)
+                       filter &= ~(1U << (p + 1));
+       }
+       cptr->group_filter = filter;
+       snd_seq_kernel_client_put(cptr);
+}
+
 /* UMP group change notification */
 static void handle_group_notify(struct work_struct *work)
 {
@@ -424,6 +443,7 @@ static void handle_group_notify(struct work_struct *work)
 
        update_group_attrs(client);
        update_port_infos(client);
+       setup_client_group_filter(client);
 }
 
 /* UMP FB change notification */
@@ -492,6 +512,8 @@ static int snd_seq_ump_probe(struct device *_dev)
                        goto error;
        }
 
+       setup_client_group_filter(client);
+
        err = create_ump_endpoint_port(client);
        if (err < 0)
                goto error;
index 7cc84e137999cd8e5a38ac6913e4a9cbc58fc4d0..b141024830ecc831430c697858ce409a56c711af 100644 (file)
@@ -1197,6 +1197,8 @@ int snd_seq_deliver_to_ump(struct snd_seq_client *source,
                           struct snd_seq_event *event,
                           int atomic, int hop)
 {
+       if (dest->group_filter & (1U << dest_port->ump_group))
+               return 0; /* group filtered - skip the event */
        if (event->type == SNDRV_SEQ_EVENT_SYSEX)
                return cvt_sysex_to_ump(dest, dest_port, event, atomic, hop);
        else if (snd_seq_client_is_midi2(dest))
index 6f597d03e7c157ae45476cfd888e64720d1604b0..b1425bf98c3befd7237c6b19920c86667dabe16e 100644 (file)
@@ -84,9 +84,9 @@ static void set_midi_substream_names(struct snd_bebob *bebob,
        struct snd_rawmidi_substream *subs;
 
        list_for_each_entry(subs, &str->substreams, list) {
-               snprintf(subs->name, sizeof(subs->name),
-                        "%s MIDI %d",
-                        bebob->card->shortname, subs->number + 1);
+               scnprintf(subs->name, sizeof(subs->name),
+                         "%s MIDI %d",
+                         bebob->card->shortname, subs->number + 1);
        }
 }
 
index 4c2998034313587ac8a53f18ad708db6fb32e4a7..78988e44b8bcd23329dfd929e144c13163e8602b 100644 (file)
@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_dice *dice,
        struct snd_rawmidi_substream *subs;
 
        list_for_each_entry(subs, &str->substreams, list) {
-               snprintf(subs->name, sizeof(subs->name),
-                        "%s MIDI %d", dice->card->shortname, subs->number + 1);
+               scnprintf(subs->name, sizeof(subs->name),
+                         "%s MIDI %d", dice->card->shortname, subs->number + 1);
        }
 }
 
index 68eb8c39afa6c58ea7994172ea1773b5ac654aed..8f4bace16050a16248c9c117af9cc0888bbf0463 100644 (file)
@@ -100,14 +100,14 @@ static void set_substream_names(struct snd_dg00x *dg00x,
 
                list_for_each_entry(subs, &str->substreams, list) {
                        if (!is_console) {
-                               snprintf(subs->name, sizeof(subs->name),
-                                        "%s MIDI %d",
-                                        dg00x->card->shortname,
-                                        subs->number + 1);
+                               scnprintf(subs->name, sizeof(subs->name),
+                                         "%s MIDI %d",
+                                         dg00x->card->shortname,
+                                         subs->number + 1);
                        } else {
-                               snprintf(subs->name, sizeof(subs->name),
-                                        "%s control",
-                                        dg00x->card->shortname);
+                               scnprintf(subs->name, sizeof(subs->name),
+                                         "%s control",
+                                         dg00x->card->shortname);
                        }
                }
        }
index 25821d186b878f67a389c474ff3d0caf855be3da..da3054fdcc7d66050f51abc09cb2dd6ac309597e 100644 (file)
@@ -79,8 +79,8 @@ static void set_midi_substream_names(struct snd_rawmidi_str *stream,
        struct snd_rawmidi_substream *substream;
 
        list_for_each_entry(substream, &stream->substreams, list) {
-               snprintf(substream->name, sizeof(substream->name),
-                        "%s MIDI %d", name, substream->number + 1);
+               scnprintf(substream->name, sizeof(substream->name),
+                         "%s MIDI %d", name, substream->number + 1);
        }
 }
 
index dd4298876ac087954ae37e3f20ceea93b3362ed6..e3ed4e094ccd0e8311a053878cb9d5e7c429a46b 100644 (file)
@@ -93,11 +93,11 @@ get_hardware_info(struct snd_efw *efw)
        strcpy(efw->card->driver, "Fireworks");
        strcpy(efw->card->shortname, hwinfo->model_name);
        strcpy(efw->card->mixername, hwinfo->model_name);
-       snprintf(efw->card->longname, sizeof(efw->card->longname),
-                "%s %s v%s, GUID %08x%08x at %s, S%d",
-                hwinfo->vendor_name, hwinfo->model_name, version,
-                hwinfo->guid_hi, hwinfo->guid_lo,
-                dev_name(&efw->unit->device), 100 << fw_dev->max_speed);
+       scnprintf(efw->card->longname, sizeof(efw->card->longname),
+                 "%s %s v%s, GUID %08x%08x at %s, S%d",
+                 hwinfo->vendor_name, hwinfo->model_name, version,
+                 hwinfo->guid_hi, hwinfo->guid_lo,
+                 dev_name(&efw->unit->device), 100 << fw_dev->max_speed);
 
        if (hwinfo->flags & BIT(FLAG_RESP_ADDR_CHANGABLE))
                efw->resp_addr_changable = true;
index 84621e3568482431d4334a5d4afb773dfb4a63a7..350bf4d299c2009571427b75b0378314c2965f05 100644 (file)
@@ -84,8 +84,8 @@ static void set_midi_substream_names(struct snd_efw *efw,
        struct snd_rawmidi_substream *subs;
 
        list_for_each_entry(subs, &str->substreams, list) {
-               snprintf(subs->name, sizeof(subs->name),
-                        "%s MIDI %d", efw->card->shortname, subs->number + 1);
+               scnprintf(subs->name, sizeof(subs->name),
+                         "%s MIDI %d", efw->card->shortname, subs->number + 1);
        }
 }
 
index 2365f7dfde2664dfa3990e2e8ab848b2de5ada4d..eebc7e790ee2ab682ea024d6b82723252f995bd4 100644 (file)
@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_motu *motu,
        struct snd_rawmidi_substream *subs;
 
        list_for_each_entry(subs, &str->substreams, list) {
-               snprintf(subs->name, sizeof(subs->name),
-                        "%s MIDI %d", motu->card->shortname, subs->number + 1);
+               scnprintf(subs->name, sizeof(subs->name),
+                         "%s MIDI %d", motu->card->shortname, subs->number + 1);
        }
 }
 
index 775cba3f1f028a03853394443ddc92e9aecad912..c215fa6f7a03713e946b276016fc80f5585d4d9e 100644 (file)
@@ -129,9 +129,9 @@ static void set_midi_substream_names(struct snd_oxfw *oxfw,
        struct snd_rawmidi_substream *subs;
 
        list_for_each_entry(subs, &str->substreams, list) {
-               snprintf(subs->name, sizeof(subs->name),
-                        "%s MIDI %d",
-                        oxfw->card->shortname, subs->number + 1);
+               scnprintf(subs->name, sizeof(subs->name),
+                         "%s MIDI %d",
+                         oxfw->card->shortname, subs->number + 1);
        }
 }
 
index 63d40f1a914f8c710bcdc2e57cf3794102d475b7..241a697ce26b2585f7271ef6e9ae0cbcadce879b 100644 (file)
@@ -108,11 +108,11 @@ static int name_card(struct snd_oxfw *oxfw, const struct ieee1394_device_id *ent
        strcpy(oxfw->card->mixername, m);
        strcpy(oxfw->card->shortname, m);
 
-       snprintf(oxfw->card->longname, sizeof(oxfw->card->longname),
-                "%s %s (OXFW%x %04x), GUID %08x%08x at %s, S%d",
-                v, m, firmware >> 20, firmware & 0xffff,
-                fw_dev->config_rom[3], fw_dev->config_rom[4],
-                dev_name(&oxfw->unit->device), 100 << fw_dev->max_speed);
+       scnprintf(oxfw->card->longname, sizeof(oxfw->card->longname),
+                 "%s %s (OXFW%x %04x), GUID %08x%08x at %s, S%d",
+                 v, m, firmware >> 20, firmware & 0xffff,
+                 fw_dev->config_rom[3], fw_dev->config_rom[4],
+                 dev_name(&oxfw->unit->device), 100 << fw_dev->max_speed);
 end:
        return err;
 }
index 02eed2dce435f24e41f2f5a5b06104d52c2f10e0..c57fac4f196819462aac2d0ebc11f03c16ce36fc 100644 (file)
@@ -108,9 +108,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm)
                /* TODO: support virtual MIDI ports. */
                if (subs->number < tscm->spec->midi_capture_ports) {
                        /* Hardware MIDI ports. */
-                       snprintf(subs->name, sizeof(subs->name),
-                                "%s MIDI %d",
-                                tscm->card->shortname, subs->number + 1);
+                       scnprintf(subs->name, sizeof(subs->name),
+                                 "%s MIDI %d",
+                                 tscm->card->shortname, subs->number + 1);
                }
        }
 
@@ -123,9 +123,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm)
        list_for_each_entry(subs, &stream->substreams, list) {
                if (subs->number < tscm->spec->midi_playback_ports) {
                        /* Hardware MIDI ports only. */
-                       snprintf(subs->name, sizeof(subs->name),
-                                "%s MIDI %d",
-                                tscm->card->shortname, subs->number + 1);
+                       scnprintf(subs->name, sizeof(subs->name),
+                                 "%s MIDI %d",
+                                 tscm->card->shortname, subs->number + 1);
                }
        }
 
index 5cb92f7ccbcac991f95aa1fd2ecea60486fe9248..b57d72ea4503fa7504757eb6542b51e5b2e7b5e9 100644 (file)
@@ -23,7 +23,7 @@ static int ctrl_link_mask;
 module_param_named(sdw_link_mask, ctrl_link_mask, int, 0444);
 MODULE_PARM_DESC(sdw_link_mask, "Intel link mask (one bit per link)");
 
-static bool is_link_enabled(struct fwnode_handle *fw_node, int i)
+static bool is_link_enabled(struct fwnode_handle *fw_node, u8 idx)
 {
        struct fwnode_handle *link;
        char name[32];
@@ -31,7 +31,7 @@ static bool is_link_enabled(struct fwnode_handle *fw_node, int i)
 
        /* Find master handle */
        snprintf(name, sizeof(name),
-                "mipi-sdw-link-%d-subproperties", i);
+                "mipi-sdw-link-%hhu-subproperties", idx);
 
        link = fwnode_get_named_child_node(fw_node, name);
        if (!link)
@@ -51,8 +51,8 @@ static int
 sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
 {
        struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
-       int ret, i;
-       u8 count;
+       u8 count, i;
+       int ret;
 
        if (!adev)
                return -EINVAL;
index c471ac2aa450a1a4ee65d60ca5fad3e47d3d053f..401d8df28d8767a8b1159494d30ab497e6958ffc 100644 (file)
@@ -96,13 +96,13 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n)
        strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
 
        if (!thinkpad[n])
-               snprintf(card->longname, sizeof(card->longname),
-                        "%s at 0x%lx, irq %d, dma %d",
-                        chip->pcm->name, chip->port, irq[n], dma1[n]);
+               scnprintf(card->longname, sizeof(card->longname),
+                         "%s at 0x%lx, irq %d, dma %d",
+                         chip->pcm->name, chip->port, irq[n], dma1[n]);
        else
-               snprintf(card->longname, sizeof(card->longname),
-                        "%s at 0x%lx, irq %d, dma %d [Thinkpad]",
-                        chip->pcm->name, chip->port, irq[n], dma1[n]);
+               scnprintf(card->longname, sizeof(card->longname),
+                         "%s at 0x%lx, irq %d, dma %d [Thinkpad]",
+                         chip->pcm->name, chip->port, irq[n], dma1[n]);
 
        error = snd_card_register(card);
        if (error < 0)
index 1e89233853662046f4161a767877ad87f67a8967..c87be4be6df1d4afeb9c62936a57de4a02297bed 100644 (file)
@@ -98,13 +98,13 @@ static int snd_cs4231_probe(struct device *dev, unsigned int n)
        strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
 
        if (dma2[n] < 0)
-               snprintf(card->longname, sizeof(card->longname),
-                        "%s at 0x%lx, irq %d, dma %d",
-                        chip->pcm->name, chip->port, irq[n], dma1[n]);
+               scnprintf(card->longname, sizeof(card->longname),
+                         "%s at 0x%lx, irq %d, dma %d",
+                         chip->pcm->name, chip->port, irq[n], dma1[n]);
        else
-               snprintf(card->longname, sizeof(card->longname),
-                        "%s at 0x%lx, irq %d, dma %d&%d",
-                        chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);
+               scnprintf(card->longname, sizeof(card->longname),
+                         "%s at 0x%lx, irq %d, dma %d&%d",
+                         chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);
 
        error = snd_wss_mixer(chip);
        if (error < 0)
index 10112e1bb25dc2373c77ae3ef0d120d328a91030..7226cbf2d7de4c5736cbd31858c727bd7b4e2917 100644 (file)
@@ -367,14 +367,14 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
        strscpy(card->driver, chip->pcm->name, sizeof(card->driver));
        strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
        if (dma2[dev] < 0)
-               snprintf(card->longname, sizeof(card->longname),
-                        "%s at 0x%lx, irq %i, dma %i",
-                        chip->pcm->name, chip->port, irq[dev], dma1[dev]);
+               scnprintf(card->longname, sizeof(card->longname),
+                         "%s at 0x%lx, irq %i, dma %i",
+                         chip->pcm->name, chip->port, irq[dev], dma1[dev]);
        else
-               snprintf(card->longname, sizeof(card->longname),
-                        "%s at 0x%lx, irq %i, dma %i&%d",
-                        chip->pcm->name, chip->port, irq[dev], dma1[dev],
-                        dma2[dev]);
+               scnprintf(card->longname, sizeof(card->longname),
+                         "%s at 0x%lx, irq %i, dma %i&%d",
+                         chip->pcm->name, chip->port, irq[dev], dma1[dev],
+                         dma2[dev]);
 
        err = snd_wss_timer(chip, 0);
        if (err < 0)
index f935b56eeec7bfc1baceeb4285c49c3dadeb1c35..97728bf45474238d500aaead219a8d5e3396ae00 100644 (file)
@@ -130,9 +130,9 @@ static int snd_es1688_probe(struct snd_card *card, unsigned int n)
 
        strscpy(card->driver, "ES1688", sizeof(card->driver));
        strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
-       snprintf(card->longname, sizeof(card->longname),
-               "%s at 0x%lx, irq %i, dma %i", chip->pcm->name, chip->port,
-                chip->irq, chip->dma8);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s at 0x%lx, irq %i, dma %i", chip->pcm->name, chip->port,
+                 chip->irq, chip->dma8);
 
        if (fm_port[n] == SNDRV_AUTO_PORT)
                fm_port[n] = port[n];   /* share the same port */
index 59242baed576410d5a2d82d854e79901f1e95842..59792f2fada1d578154c25e11d61ef8153b5689e 100644 (file)
@@ -1344,10 +1344,10 @@ static int snd_miro_probe(struct snd_card *card)
        }
 
        strcpy(card->driver, "miro");
-       snprintf(card->longname, sizeof(card->longname),
-                "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
-                card->shortname, miro->name, codec->pcm->name,
-                miro->wss_base + 4, miro->irq, miro->dma1, miro->dma2);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
+                 card->shortname, miro->name, codec->pcm->name,
+                 miro->wss_base + 4, miro->irq, miro->dma1, miro->dma2);
 
        if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)
                rmidi = NULL;
index 4beeb32fe2a7a9d0bbfb999bbbd6c9020bf3a58a..c33f67dd51331acf457d74b02926dc8392e8a673 100644 (file)
@@ -859,15 +859,15 @@ static int snd_opti9xx_probe(struct snd_card *card)
        strcpy(card->driver, chip->name);
        sprintf(card->shortname, "OPTi %s", card->driver);
 #if defined(CS4231) || defined(OPTi93X)
-       snprintf(card->longname, sizeof(card->longname),
-                "%s, %s at 0x%lx, irq %d, dma %d&%d",
-                card->shortname, codec->pcm->name,
-                chip->wss_base + 4, irq, dma1, xdma2);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s, %s at 0x%lx, irq %d, dma %d&%d",
+                 card->shortname, codec->pcm->name,
+                 chip->wss_base + 4, irq, dma1, xdma2);
 #else
-       snprintf(card->longname, sizeof(card->longname),
-                "%s, %s at 0x%lx, irq %d, dma %d",
-                card->shortname, codec->pcm->name, chip->wss_base + 4, irq,
-                dma1);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s, %s at 0x%lx, irq %d, dma %d",
+                 card->shortname, codec->pcm->name, chip->wss_base + 4, irq,
+                 dma1);
 #endif /* CS4231 || OPTi93X */
 
        if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)
index 0bc0025f7c199a6c678e2bf8c949b33fe882ff28..cc56fafd27b1253e301d58f493b89d17fbdaba08 100644 (file)
@@ -557,7 +557,7 @@ static int sscape_upload_microcode(struct snd_card *card, int version)
        char name[14];
        int err;
 
-       snprintf(name, sizeof(name), "sndscape.co%d", version);
+       scnprintf(name, sizeof(name), "sndscape.co%d", version);
 
        err = request_firmware(&init_fw, name, card->dev);
        if (err < 0) {
index 1415baac9c361349932e2c67d6a97e9a18513527..08e34b184780187f66922448c40761e6281d84a2 100644 (file)
@@ -3102,11 +3102,13 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
        }
        sprintf(card->shortname, "C-Media CMI%d", val);
        if (cm->chip_version < 68)
-               sprintf(modelstr, " (model %d)", cm->chip_version);
+               scnprintf(modelstr, sizeof(modelstr),
+                         " (model %d)", cm->chip_version);
        else
                modelstr[0] = '\0';
-       sprintf(card->longname, "%s%s at %#lx, irq %i",
-               card->shortname, modelstr, cm->iobase, cm->irq);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s%s at %#lx, irq %i",
+                 card->shortname, modelstr, cm->iobase, cm->irq);
 
        if (cm->chip_version >= 39) {
                val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1);
index 76b9c685560bf078ec856843f0db1f42969c7508..7adc1d373d65c377cf2db29f4a6bb63b57db0bb4 100644 (file)
@@ -105,7 +105,7 @@ static void cs35l56_hda_playback_hook(struct device *dev, int action)
        }
 }
 
-static int __maybe_unused cs35l56_hda_runtime_suspend(struct device *dev)
+static int cs35l56_hda_runtime_suspend(struct device *dev)
 {
        struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);
 
@@ -115,7 +115,7 @@ static int __maybe_unused cs35l56_hda_runtime_suspend(struct device *dev)
        return cs35l56_runtime_suspend_common(&cs35l56->base);
 }
 
-static int __maybe_unused cs35l56_hda_runtime_resume(struct device *dev)
+static int cs35l56_hda_runtime_resume(struct device *dev)
 {
        struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);
        int ret;
@@ -218,7 +218,7 @@ static int cs35l56_hda_posture_get(struct snd_kcontrol *kcontrol,
 
        ucontrol->value.integer.value[0] = pos;
 
-       return ret;
+       return 0;
 }
 
 static int cs35l56_hda_posture_put(struct snd_kcontrol *kcontrol,
@@ -865,15 +865,13 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
        sub = acpi_get_subsystem_id(ACPI_HANDLE(cs35l56->base.dev));
 
        if (IS_ERR(sub)) {
-               /* If no ACPI SUB, return 0 and fallback to legacy firmware path, otherwise fail */
-               if (PTR_ERR(sub) == -ENODATA)
-                       return 0;
-               else
-                       return PTR_ERR(sub);
+               dev_info(cs35l56->base.dev,
+                        "Read ACPI _SUB failed(%ld): fallback to generic firmware\n",
+                        PTR_ERR(sub));
+       } else {
+               cs35l56->system_name = sub;
        }
 
-       cs35l56->system_name = sub;
-
        cs35l56->base.reset_gpio = devm_gpiod_get_index_optional(cs35l56->base.dev,
                                                                 "reset",
                                                                 cs35l56->index,
@@ -1003,6 +1001,7 @@ void cs35l56_hda_remove(struct device *dev)
 {
        struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);
 
+       pm_runtime_dont_use_autosuspend(cs35l56->base.dev);
        pm_runtime_get_sync(cs35l56->base.dev);
        pm_runtime_disable(cs35l56->base.dev);
 
@@ -1016,7 +1015,7 @@ void cs35l56_hda_remove(struct device *dev)
 EXPORT_SYMBOL_NS_GPL(cs35l56_hda_remove, SND_HDA_SCODEC_CS35L56);
 
 const struct dev_pm_ops cs35l56_hda_pm_ops = {
-       SET_RUNTIME_PM_OPS(cs35l56_hda_runtime_suspend, cs35l56_hda_runtime_resume, NULL)
+       RUNTIME_PM_OPS(cs35l56_hda_runtime_suspend, cs35l56_hda_runtime_resume, NULL)
        SYSTEM_SLEEP_PM_OPS(cs35l56_hda_system_suspend, cs35l56_hda_system_resume)
        LATE_SYSTEM_SLEEP_PM_OPS(cs35l56_hda_system_suspend_late,
                                 cs35l56_hda_system_resume_early)
index 83e4acdd89aceddb9d8671728b752d3611f2f2d8..757a4d193e0fb5919778847693a3353f2825265b 100644 (file)
@@ -21,7 +21,6 @@ static int cs35l56_hda_i2c_probe(struct i2c_client *clt)
                return -ENOMEM;
 
        cs35l56->base.dev = &clt->dev;
-       cs35l56->base.can_hibernate = true;
        cs35l56->base.regmap = devm_regmap_init_i2c(clt, &cs35l56_regmap_i2c);
        if (IS_ERR(cs35l56->base.regmap)) {
                ret = PTR_ERR(cs35l56->base.regmap);
index dbf7aa88e0e31a48a751e91761cfa644f98ab1c1..bf685d01259d30070aaf3ac7f3ed3204bc30c5bd 100644 (file)
@@ -998,7 +998,11 @@ static int add_control_with_pfx(struct hda_gen_spec *spec, int type,
                                const char *sfx, int cidx, unsigned long val)
 {
        char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
-       snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
+       int len;
+
+       len = snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
+       if (snd_BUG_ON(len >= sizeof(name)))
+               return -EINVAL;
        if (!add_control(spec, type, name, cidx, val))
                return -ENOMEM;
        return 0;
index 765d95e7986171d2d2d3fed9ef2509db975f7074..ca765ac4765f4a27b77f81f466b647a9699f068d 100644 (file)
@@ -2211,6 +2211,7 @@ static const struct snd_pci_quirk power_save_denylist[] = {
        SND_PCI_QUIRK(0x8086, 0x2068, "Intel NUC7i3BNB", 0),
        /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */
        SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0),
+       SND_PCI_QUIRK(0x17aa, 0x316e, "Lenovo ThinkCentre M70q", 0),
        /* https://bugzilla.redhat.com/show_bug.cgi?id=1689623 */
        SND_PCI_QUIRK(0x17aa, 0x367b, "Lenovo IdeaCentre B550", 0),
        /* https://bugzilla.redhat.com/show_bug.cgi?id=1572975 */
index b7e78bfcffd832a33df08cbc5d24b21b353c52d2..751783f3a15c2e5f7a19daf0d71fff3b81db19b0 100644 (file)
@@ -7073,8 +7073,10 @@ static void alc287_fixup_bind_dacs(struct hda_codec *codec,
        snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
        spec->gen.preferred_dacs = preferred_pairs;
        spec->gen.auto_mute_via_amp = 1;
-       snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
-                           0x0); /* Make sure 0x14 was disable */
+       if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
+               snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+                                       0x0); /* Make sure 0x14 was disable */
+       }
 }
 
 
@@ -9812,7 +9814,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
        SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
        SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
-       SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2),
+       SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
+       SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
        SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
        SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
        SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
@@ -10574,6 +10577,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
                {0x17, 0x90170110},
                {0x19, 0x03a11030},
                {0x21, 0x03211020}),
+       SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
+               {0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
+               {0x19, 0x04a11040},
+               {0x21, 0x04211020}),
        SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
                {0x12, 0x90a60130},
                {0x17, 0x90170110},
index b37c877c2c16057505fae4b206d74f96657c66f3..9dee0345f22cf1e550d38f1c3b3c7918e2f116c5 100644 (file)
@@ -2105,15 +2105,15 @@ __snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
        strcpy(card->driver, "RIPTIDE");
        strcpy(card->shortname, "Riptide");
 #ifdef SUPPORT_JOYSTICK
-       snprintf(card->longname, sizeof(card->longname),
-                "%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x gameport 0x%x",
-                card->shortname, chip->port, chip->irq, chip->mpuaddr,
-                chip->opladdr, chip->gameaddr);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x gameport 0x%x",
+                 card->shortname, chip->port, chip->irq, chip->mpuaddr,
+                 chip->opladdr, chip->gameaddr);
 #else
-       snprintf(card->longname, sizeof(card->longname),
-                "%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x",
-                card->shortname, chip->port, chip->irq, chip->mpuaddr,
-                chip->opladdr);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x",
+                 card->shortname, chip->port, chip->irq, chip->mpuaddr,
+                 chip->opladdr);
 #endif
        snd_riptide_proc_init(chip);
        err = snd_card_register(card);
index 3ec15b46fa35696f007ce86b4cec4cc35128937a..94e9eb8e73f2afbc7471bb81bfca59f20f23fdbd 100644 (file)
@@ -213,6 +213,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "21J6"),
                }
        },
+       {
+               .driver_data = &acp6x_card,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "82QF"),
+               }
+       },
        {
                .driver_data = &acp6x_card,
                .matches = {
@@ -220,6 +227,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "82TL"),
                }
        },
+       {
+               .driver_data = &acp6x_card,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "82UG"),
+               }
+       },
        {
                .driver_data = &acp6x_card,
                .matches = {
@@ -262,6 +276,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "M6500RC"),
                }
        },
+       {
+               .driver_data = &acp6x_card,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 B7ED"),
+               }
+       },
        {
                .driver_data = &acp6x_card,
                .matches = {
index 8ee1baa0326911d2ae39a5fa047e73a5e7aa7212..87dd0ccade4ce754b9962a4f931e2a80c2dc0ee8 100644 (file)
@@ -452,11 +452,13 @@ static int aw_dev_parse_reg_bin_with_hdr(struct aw_device *aw_dev,
        if ((aw_bin->all_bin_parse_num != 1) ||
                (aw_bin->header_info[0].bin_data_type != DATA_TYPE_REGISTER)) {
                dev_err(aw_dev->dev, "bin num or type error");
+               ret = -EINVAL;
                goto parse_bin_failed;
        }
 
        if (aw_bin->header_info[0].valid_data_len % 4) {
                dev_err(aw_dev->dev, "bin data len get error!");
+               ret = -EINVAL;
                goto parse_bin_failed;
        }
 
index 9f4f2f4f23f5668c846f2a051eee64c533deb38f..d10e0e2380e852a5ba3b59f749fa685d923634c0 100644 (file)
@@ -27,7 +27,6 @@ static int cs35l56_i2c_probe(struct i2c_client *client)
                return -ENOMEM;
 
        cs35l56->base.dev = dev;
-       cs35l56->base.can_hibernate = true;
 
        i2c_set_clientdata(client, cs35l56);
        cs35l56->base.regmap = devm_regmap_init_i2c(client, regmap_config);
index 600b79c62ec48a5dec9d843cb036477c7867f20a..f2e7c6d0be46c8b57e3701505196e7862d8f05a8 100644 (file)
@@ -1207,6 +1207,7 @@ void cs35l56_remove(struct cs35l56_private *cs35l56)
        flush_workqueue(cs35l56->dsp_wq);
        destroy_workqueue(cs35l56->dsp_wq);
 
+       pm_runtime_dont_use_autosuspend(cs35l56->base.dev);
        pm_runtime_suspend(cs35l56->base.dev);
        pm_runtime_disable(cs35l56->base.dev);
 
index eeab07c850f9582e918815b44c2698fb5d3995f1..974bae4abfad1cfb8339174c1d861db541380b23 100644 (file)
@@ -344,6 +344,16 @@ static int cs42l42_sdw_update_status(struct sdw_slave *peripheral,
        switch (status) {
        case SDW_SLAVE_ATTACHED:
                dev_dbg(cs42l42->dev, "ATTACHED\n");
+
+               /*
+                * The SoundWire core can report stale ATTACH notifications
+                * if we hard-reset CS42L42 in probe() but it had already been
+                * enumerated. Reject the ATTACH if we haven't yet seen an
+                * UNATTACH report for the device being in reset.
+                */
+               if (cs42l42->sdw_waiting_first_unattach)
+                       break;
+
                /*
                 * Initialise codec, this only needs to be done once.
                 * When resuming from suspend, resume callback will handle re-init of codec,
@@ -354,6 +364,16 @@ static int cs42l42_sdw_update_status(struct sdw_slave *peripheral,
                break;
        case SDW_SLAVE_UNATTACHED:
                dev_dbg(cs42l42->dev, "UNATTACHED\n");
+
+               if (cs42l42->sdw_waiting_first_unattach) {
+                       /*
+                        * SoundWire core has seen that CS42L42 is not on
+                        * the bus so release RESET and wait for ATTACH.
+                        */
+                       cs42l42->sdw_waiting_first_unattach = false;
+                       gpiod_set_value_cansleep(cs42l42->reset_gpio, 1);
+               }
+
                break;
        default:
                break;
index a0de0329406a1ff2ea3dc8a29f4ec510335553dd..2961340f15e2ed05d7c551c8d5f68fd557181bdc 100644 (file)
@@ -2320,7 +2320,26 @@ int cs42l42_common_probe(struct cs42l42_private *cs42l42,
 
        if (cs42l42->reset_gpio) {
                dev_dbg(cs42l42->dev, "Found reset GPIO\n");
-               gpiod_set_value_cansleep(cs42l42->reset_gpio, 1);
+
+               /*
+                * ACPI can override the default GPIO state we requested
+                * so ensure that we start with RESET low.
+                */
+               gpiod_set_value_cansleep(cs42l42->reset_gpio, 0);
+
+               /* Ensure minimum reset pulse width */
+               usleep_range(10, 500);
+
+               /*
+                * On SoundWire keep the chip in reset until we get an UNATTACH
+                * notification from the SoundWire core. This acts as a
+                * synchronization point to reject stale ATTACH notifications
+                * if the chip was already enumerated before we reset it.
+                */
+               if (cs42l42->sdw_peripheral)
+                       cs42l42->sdw_waiting_first_unattach = true;
+               else
+                       gpiod_set_value_cansleep(cs42l42->reset_gpio, 1);
        }
        usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2);
 
index 4bd7b85a5747158ecf808c41d970eaa4c15066ab..7785125b73ab9342f70bb3438d69693b6710688b 100644 (file)
@@ -53,6 +53,7 @@ struct  cs42l42_private {
        u8 stream_use;
        bool hp_adc_up_pending;
        bool suspended;
+       bool sdw_waiting_first_unattach;
        bool init_done;
 };
 
index 1a95c370fc4c9d6687650fe7a06f37d95c884084..5643c666d7d04bf2e507126a7ba4d28430b6925f 100644 (file)
@@ -2077,7 +2077,8 @@ static const struct cs42l43_irq cs42l43_irqs[] = {
 
 static int cs42l43_request_irq(struct cs42l43_codec *priv,
                               struct irq_domain *dom, const char * const name,
-                              unsigned int irq, irq_handler_t handler)
+                              unsigned int irq, irq_handler_t handler,
+                              unsigned long flags)
 {
        int ret;
 
@@ -2087,8 +2088,8 @@ static int cs42l43_request_irq(struct cs42l43_codec *priv,
 
        dev_dbg(priv->dev, "Request IRQ %d for %s\n", ret, name);
 
-       ret = devm_request_threaded_irq(priv->dev, ret, NULL, handler, IRQF_ONESHOT,
-                                       name, priv);
+       ret = devm_request_threaded_irq(priv->dev, ret, NULL, handler,
+                                       IRQF_ONESHOT | flags, name, priv);
        if (ret)
                return dev_err_probe(priv->dev, ret, "Failed to request IRQ %s\n", name);
 
@@ -2124,11 +2125,11 @@ static int cs42l43_shutter_irq(struct cs42l43_codec *priv,
                return 0;
        }
 
-       ret = cs42l43_request_irq(priv, dom, close_name, close_irq, handler);
+       ret = cs42l43_request_irq(priv, dom, close_name, close_irq, handler, IRQF_SHARED);
        if (ret)
                return ret;
 
-       return cs42l43_request_irq(priv, dom, open_name, open_irq, handler);
+       return cs42l43_request_irq(priv, dom, open_name, open_irq, handler, IRQF_SHARED);
 }
 
 static int cs42l43_codec_probe(struct platform_device *pdev)
@@ -2178,7 +2179,8 @@ static int cs42l43_codec_probe(struct platform_device *pdev)
 
        for (i = 0; i < ARRAY_SIZE(cs42l43_irqs); i++) {
                ret = cs42l43_request_irq(priv, dom, cs42l43_irqs[i].name,
-                                         cs42l43_irqs[i].irq, cs42l43_irqs[i].handler);
+                                         cs42l43_irqs[i].irq,
+                                         cs42l43_irqs[i].handler, 0);
                if (ret)
                        goto err_pm;
        }
index 15e1a62b9e571053284e3a2e8e8466fd5faf290f..e8cdc166bdaa99a948b03966d8cf67dbf49e7440 100644 (file)
@@ -2403,13 +2403,11 @@ static irqreturn_t rt5640_irq(int irq, void *data)
        struct rt5640_priv *rt5640 = data;
        int delay = 0;
 
-       if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
-               cancel_delayed_work_sync(&rt5640->jack_work);
+       if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
                delay = 100;
-       }
 
        if (rt5640->jack)
-               queue_delayed_work(system_long_wq, &rt5640->jack_work, delay);
+               mod_delayed_work(system_long_wq, &rt5640->jack_work, delay);
 
        return IRQ_HANDLED;
 }
@@ -2565,10 +2563,9 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
        if (jack_data && jack_data->use_platform_clock)
                rt5640->use_platform_clock = jack_data->use_platform_clock;
 
-       ret = devm_request_threaded_irq(component->dev, rt5640->irq,
-                                       NULL, rt5640_irq,
-                                       IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-                                       "rt5640", rt5640);
+       ret = request_irq(rt5640->irq, rt5640_irq,
+                         IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+                         "rt5640", rt5640);
        if (ret) {
                dev_warn(component->dev, "Failed to request IRQ %d: %d\n", rt5640->irq, ret);
                rt5640_disable_jack_detect(component);
@@ -2621,14 +2618,14 @@ static void rt5640_enable_hda_jack_detect(
 
        rt5640->jack = jack;
 
-       ret = devm_request_threaded_irq(component->dev, rt5640->irq,
-                                       NULL, rt5640_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
-                                       "rt5640", rt5640);
+       ret = request_irq(rt5640->irq, rt5640_irq,
+                         IRQF_TRIGGER_RISING | IRQF_ONESHOT, "rt5640", rt5640);
        if (ret) {
                dev_warn(component->dev, "Failed to request IRQ %d: %d\n", rt5640->irq, ret);
-               rt5640->irq = -ENXIO;
+               rt5640->jack = NULL;
                return;
        }
+       rt5640->irq_requested = true;
 
        /* sync initial jack state */
        queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
@@ -2801,12 +2798,12 @@ static int rt5640_suspend(struct snd_soc_component *component)
 {
        struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
 
-       if (rt5640->irq) {
+       if (rt5640->jack) {
                /* disable jack interrupts during system suspend */
                disable_irq(rt5640->irq);
+               rt5640_cancel_work(rt5640);
        }
 
-       rt5640_cancel_work(rt5640);
        snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
        rt5640_reset(component);
        regcache_cache_only(rt5640->regmap, true);
@@ -2829,9 +2826,6 @@ static int rt5640_resume(struct snd_soc_component *component)
        regcache_cache_only(rt5640->regmap, false);
        regcache_sync(rt5640->regmap);
 
-       if (rt5640->irq)
-               enable_irq(rt5640->irq);
-
        if (rt5640->jack) {
                if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
                        snd_soc_component_update_bits(component,
@@ -2859,6 +2853,7 @@ static int rt5640_resume(struct snd_soc_component *component)
                        }
                }
 
+               enable_irq(rt5640->irq);
                queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
        }
 
index 0a50180750e8815c42040b4e433cd2f0381d3148..7689fe3cc86d657e332b820c94cb87396344ab9d 100644 (file)
@@ -1468,8 +1468,10 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
        }
 
        wm8960->regmap = devm_regmap_init_i2c(i2c, &wm8960_regmap);
-       if (IS_ERR(wm8960->regmap))
-               return PTR_ERR(wm8960->regmap);
+       if (IS_ERR(wm8960->regmap)) {
+               ret = PTR_ERR(wm8960->regmap);
+               goto bulk_disable;
+       }
 
        if (pdata)
                memcpy(&wm8960->pdata, pdata, sizeof(struct wm8960_data));
@@ -1479,13 +1481,14 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
        ret = i2c_master_recv(i2c, &val, sizeof(val));
        if (ret >= 0) {
                dev_err(&i2c->dev, "Not wm8960, wm8960 reg can not read by i2c\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto bulk_disable;
        }
 
        ret = wm8960_reset(wm8960->regmap);
        if (ret != 0) {
                dev_err(&i2c->dev, "Failed to issue reset\n");
-               return ret;
+               goto bulk_disable;
        }
 
        if (wm8960->pdata.shared_lrclk) {
@@ -1494,7 +1497,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
                if (ret != 0) {
                        dev_err(&i2c->dev, "Failed to enable LRCM: %d\n",
                                ret);
-                       return ret;
+                       goto bulk_disable;
                }
        }
 
@@ -1528,7 +1531,13 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
 
        ret = devm_snd_soc_register_component(&i2c->dev,
                        &soc_component_dev_wm8960, &wm8960_dai, 1);
+       if (ret)
+               goto bulk_disable;
 
+       return 0;
+
+bulk_disable:
+       regulator_bulk_disable(ARRAY_SIZE(wm8960->supplies), wm8960->supplies);
        return ret;
 }
 
index 6fc34f41b1758094acb4ba653eeb1bb023712399..d1b9238d391e81c089e43a85534d77846d77e440 100644 (file)
@@ -687,7 +687,10 @@ int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type,
        struct wm_coeff_ctl *ctl;
        int ret;
 
+       mutex_lock(&dsp->cs_dsp.pwr_lock);
        ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len);
+       mutex_unlock(&dsp->cs_dsp.pwr_lock);
+
        if (ret < 0)
                return ret;
 
@@ -703,8 +706,14 @@ EXPORT_SYMBOL_GPL(wm_adsp_write_ctl);
 int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type,
                     unsigned int alg, void *buf, size_t len)
 {
-       return cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg),
-                                     0, buf, len);
+       int ret;
+
+       mutex_lock(&dsp->cs_dsp.pwr_lock);
+       ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg),
+                                    0, buf, len);
+       mutex_unlock(&dsp->cs_dsp.pwr_lock);
+
+       return ret;
 }
 EXPORT_SYMBOL_GPL(wm_adsp_read_ctl);
 
index 0b58df56f4daa831baffc5dd294bfbc458add70e..aeb81aa61184fbc0889765ac1573a0a23ef3c2c6 100644 (file)
@@ -315,7 +315,7 @@ static int imx_audmix_probe(struct platform_device *pdev)
        if (IS_ERR(priv->cpu_mclk)) {
                ret = PTR_ERR(priv->cpu_mclk);
                dev_err(&cpu_pdev->dev, "failed to get DAI mclk1: %d\n", ret);
-               return -EINVAL;
+               return ret;
        }
 
        priv->audmix_pdev = audmix_pdev;
index d63782b8bdef8f8b27d9669dabdc550cd0445f5a..bb736d45c9e04e5de7de46698d55b1b16b5a8718 100644 (file)
@@ -19,6 +19,7 @@
 static struct snd_pcm_hardware imx_rpmsg_pcm_hardware = {
        .info = SNDRV_PCM_INFO_INTERLEAVED |
                SNDRV_PCM_INFO_BLOCK_TRANSFER |
+               SNDRV_PCM_INFO_BATCH |
                SNDRV_PCM_INFO_MMAP |
                SNDRV_PCM_INFO_MMAP_VALID |
                SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
index 3c7b95db2eacc182b9d56a71c0847e76a5c910e0..b578f9a32d7f1cd62e9bdf4d84b92063a74c334d 100644 (file)
@@ -89,6 +89,14 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
                            SND_SOC_DAIFMT_NB_NF |
                            SND_SOC_DAIFMT_CBC_CFC;
 
+       /*
+        * i.MX rpmsg sound cards work on codec slave mode. MCLK will be
+        * disabled by CPU DAI driver in hw_free(). Some codec requires MCLK
+        * present at power up/down sequence. So need to set ignore_pmdown_time
+        * to power down codec immediately before MCLK is turned off.
+        */
+       data->dai.ignore_pmdown_time = 1;
+
        /* Optional codec node */
        ret = of_parse_phandle_with_fixed_args(np, "audio-codec", 0, 0, &args);
        if (ret) {
index cb00bc86ac949a5a5592da5a40768271d88e87ba..8876558f19a1bacfd4b7d5b575b25602d885b68a 100644 (file)
@@ -55,6 +55,9 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int
                        return -ENOMEM;
 
                dl[i].codecs->name = devm_kstrdup(dev, cname, GFP_KERNEL);
+               if (!dl[i].codecs->name)
+                       return -ENOMEM;
+
                dl[i].codecs->dai_name = pcm->name;
                dl[i].num_codecs = 1;
                dl[i].num_cpus = 1;
index d8688016907525eb80e6dd014e12d2916237b118..bc2f2849ecfbce1f5e12d8cdc7d56858b6c56798 100644 (file)
@@ -112,34 +112,6 @@ static int axg_spdifin_prepare(struct snd_pcm_substream *substream,
        return 0;
 }
 
-static int axg_spdifin_startup(struct snd_pcm_substream *substream,
-                              struct snd_soc_dai *dai)
-{
-       struct axg_spdifin *priv = snd_soc_dai_get_drvdata(dai);
-       int ret;
-
-       ret = clk_prepare_enable(priv->refclk);
-       if (ret) {
-               dev_err(dai->dev,
-                       "failed to enable spdifin reference clock\n");
-               return ret;
-       }
-
-       regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN,
-                          SPDIFIN_CTRL0_EN);
-
-       return 0;
-}
-
-static void axg_spdifin_shutdown(struct snd_pcm_substream *substream,
-                                struct snd_soc_dai *dai)
-{
-       struct axg_spdifin *priv = snd_soc_dai_get_drvdata(dai);
-
-       regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN, 0);
-       clk_disable_unprepare(priv->refclk);
-}
-
 static void axg_spdifin_write_mode_param(struct regmap *map, int mode,
                                         unsigned int val,
                                         unsigned int num_per_reg,
@@ -251,17 +223,32 @@ static int axg_spdifin_dai_probe(struct snd_soc_dai *dai)
        ret = axg_spdifin_sample_mode_config(dai, priv);
        if (ret) {
                dev_err(dai->dev, "mode configuration failed\n");
-               clk_disable_unprepare(priv->pclk);
-               return ret;
+               goto pclk_err;
        }
 
+       ret = clk_prepare_enable(priv->refclk);
+       if (ret) {
+               dev_err(dai->dev,
+                       "failed to enable spdifin reference clock\n");
+               goto pclk_err;
+       }
+
+       regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN,
+                          SPDIFIN_CTRL0_EN);
+
        return 0;
+
+pclk_err:
+       clk_disable_unprepare(priv->pclk);
+       return ret;
 }
 
 static int axg_spdifin_dai_remove(struct snd_soc_dai *dai)
 {
        struct axg_spdifin *priv = snd_soc_dai_get_drvdata(dai);
 
+       regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN, 0);
+       clk_disable_unprepare(priv->refclk);
        clk_disable_unprepare(priv->pclk);
        return 0;
 }
@@ -270,8 +257,6 @@ static const struct snd_soc_dai_ops axg_spdifin_ops = {
        .probe          = axg_spdifin_dai_probe,
        .remove         = axg_spdifin_dai_remove,
        .prepare        = axg_spdifin_prepare,
-       .startup        = axg_spdifin_startup,
-       .shutdown       = axg_spdifin_shutdown,
 };
 
 static int axg_spdifin_iec958_info(struct snd_kcontrol *kcontrol,
index e29c2fee9521943bd961b5725b30a9024a00e72b..1bd7114c472a8bb8c9032a599b0da385710ee820 100644 (file)
@@ -1303,6 +1303,7 @@ audio_graph:
                if (i >= RSND_MAX_COMPONENT) {
                        dev_info(dev, "reach to max component\n");
                        of_node_put(node);
+                       of_node_put(ports);
                        break;
                }
        }
index eb07238768511a7c7478a6a2556e5a72f0b52ec0..54704250c0a2c43e42ad09ce631953233c444b1e 100644 (file)
@@ -985,6 +985,7 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
 {
        struct snd_soc_dai *cpu_dai;
        struct snd_soc_dai *codec_dai;
+       struct snd_pcm_hw_params tmp_params;
        int i, ret = 0;
 
        snd_soc_dpcm_mutex_assert_held(rtd);
@@ -998,7 +999,6 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
                goto out;
 
        for_each_rtd_codec_dais(rtd, i, codec_dai) {
-               struct snd_pcm_hw_params codec_params;
                unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream);
 
                /*
@@ -1019,23 +1019,22 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
                        continue;
 
                /* copy params for each codec */
-               codec_params = *params;
+               tmp_params = *params;
 
                /* fixup params based on TDM slot masks */
                if (tdm_mask)
-                       soc_pcm_codec_params_fixup(&codec_params, tdm_mask);
+                       soc_pcm_codec_params_fixup(&tmp_params, tdm_mask);
 
                ret = snd_soc_dai_hw_params(codec_dai, substream,
-                                           &codec_params);
+                                           &tmp_params);
                if(ret < 0)
                        goto out;
 
-               soc_pcm_set_dai_params(codec_dai, &codec_params);
-               snd_soc_dapm_update_dai(substream, &codec_params, codec_dai);
+               soc_pcm_set_dai_params(codec_dai, &tmp_params);
+               snd_soc_dapm_update_dai(substream, &tmp_params, codec_dai);
        }
 
        for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
-               struct snd_pcm_hw_params cpu_params;
                unsigned int ch_mask = 0;
                int j;
 
@@ -1047,7 +1046,7 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
                        continue;
 
                /* copy params for each cpu */
-               cpu_params = *params;
+               tmp_params = *params;
 
                if (!rtd->dai_link->codec_ch_maps)
                        goto hw_params;
@@ -1062,16 +1061,16 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
 
                /* fixup cpu channel number */
                if (ch_mask)
-                       soc_pcm_codec_params_fixup(&cpu_params, ch_mask);
+                       soc_pcm_codec_params_fixup(&tmp_params, ch_mask);
 
 hw_params:
-               ret = snd_soc_dai_hw_params(cpu_dai, substream, &cpu_params);
+               ret = snd_soc_dai_hw_params(cpu_dai, substream, &tmp_params);
                if (ret < 0)
                        goto out;
 
                /* store the parameters for each DAI */
-               soc_pcm_set_dai_params(cpu_dai, &cpu_params);
-               snd_soc_dapm_update_dai(substream, &cpu_params, cpu_dai);
+               soc_pcm_set_dai_params(cpu_dai, &tmp_params);
+               snd_soc_dapm_update_dai(substream, &tmp_params, cpu_dai);
        }
 
        ret = snd_soc_pcm_component_hw_params(substream, params);
index 11607c5f5d5a82f4c8c97abb7e6582cfca36677c..9c746e4edef71c2e9cfa94b8ed4fc61b888c8c54 100644 (file)
@@ -217,6 +217,7 @@ int snd_soc_dai_is_dummy(struct snd_soc_dai *dai)
                return 1;
        return 0;
 }
+EXPORT_SYMBOL_GPL(snd_soc_dai_is_dummy);
 
 int snd_soc_component_is_dummy(struct snd_soc_component *component)
 {
index 30db685cc5f4b99ae47fe95e9367abc330c2b349..2d1616b81485c53b0f436ef57bcbabaebb03c184 100644 (file)
@@ -486,10 +486,9 @@ int snd_sof_device_remove(struct device *dev)
                snd_sof_ipc_free(sdev);
                snd_sof_free_debug(sdev);
                snd_sof_remove(sdev);
+               sof_ops_free(sdev);
        }
 
-       sof_ops_free(sdev);
-
        /* release firmware */
        snd_sof_fw_unload(sdev);
 
index b84ca58da9d5da72d4158dabd51564f046630fe7..f9412517eaf29be8345c00ad574ed643dd2066d5 100644 (file)
@@ -460,7 +460,7 @@ int mtl_dsp_cl_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot)
        /* step 3: wait for IPC DONE bit from ROM */
        ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, chip->ipc_ack, status,
                                            ((status & chip->ipc_ack_mask) == chip->ipc_ack_mask),
-                                           HDA_DSP_REG_POLL_INTERVAL_US, MTL_DSP_PURGE_TIMEOUT_US);
+                                           HDA_DSP_REG_POLL_INTERVAL_US, HDA_DSP_INIT_TIMEOUT_US);
        if (ret < 0) {
                if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS)
                        dev_err(sdev->dev, "timeout waiting for purge IPC done\n");
index 02181490f12a6f1b550e0463dcae039161a0993b..95696b3d7c4cfbadb5a3307954a0c9ace19e07cd 100644 (file)
@@ -62,7 +62,6 @@
 #define MTL_DSP_IRQSTS_IPC             BIT(0)
 #define MTL_DSP_IRQSTS_SDW             BIT(6)
 
-#define MTL_DSP_PURGE_TIMEOUT_US       20000000 /* 20s */
 #define MTL_DSP_REG_POLL_INTERVAL_US   10      /* 10 us */
 
 /* Memory windows */
index f2a30cd3137875b69a3f6248d50267dcff24d193..7cb63e6b24dc96f59eea968ae1f718990dedbe18 100644 (file)
@@ -231,7 +231,7 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 
        ret = sof_update_ipc_object(scomp, available_fmt,
                                    SOF_AUDIO_FMT_NUM_TOKENS, swidget->tuples,
-                                   swidget->num_tuples, sizeof(available_fmt), 1);
+                                   swidget->num_tuples, sizeof(*available_fmt), 1);
        if (ret) {
                dev_err(scomp->dev, "Failed to parse audio format token count\n");
                return ret;
index e7ef77012c3586649f364d538c42ab4c89496c48..e5405f854a910c279596b6803c73d9d21b9170c1 100644 (file)
@@ -212,7 +212,8 @@ widget_free:
        sof_widget_free_unlocked(sdev, swidget);
        use_count_decremented = true;
 core_put:
-       snd_sof_dsp_core_put(sdev, swidget->core);
+       if (!use_count_decremented)
+               snd_sof_dsp_core_put(sdev, swidget->core);
 pipe_widget_free:
        if (swidget->id != snd_soc_dapm_scheduler)
                sof_widget_free_unlocked(sdev, swidget->spipe->pipe_widget);
index 1f2c5018bf5aceded1267d64d5974dc8e3495ec5..4737e776d3837d60135523f64e1dc89f298e23e0 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/platform_device.h>
 #include <sound/graph_card.h>
 #include <sound/pcm_params.h>
+#include <sound/soc-dai.h>
 
 #define MAX_PLLA_OUT0_DIV 128
 
@@ -44,6 +45,21 @@ struct tegra_audio_cdata {
        unsigned int plla_out0_rates[NUM_RATE_TYPE];
 };
 
+static bool need_clk_update(struct snd_soc_dai *dai)
+{
+       if (snd_soc_dai_is_dummy(dai) ||
+           !dai->driver->ops ||
+           !dai->driver->name)
+               return false;
+
+       if (strstr(dai->driver->name, "I2S") ||
+           strstr(dai->driver->name, "DMIC") ||
+           strstr(dai->driver->name, "DSPK"))
+               return true;
+
+       return false;
+}
+
 /* Setup PLL clock as per the given sample rate */
 static int tegra_audio_graph_update_pll(struct snd_pcm_substream *substream,
                                        struct snd_pcm_hw_params *params)
@@ -140,19 +156,7 @@ static int tegra_audio_graph_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
        int err;
 
-       /*
-        * This gets called for each DAI link (FE or BE) when DPCM is used.
-        * We may not want to update PLLA rate for each call. So PLLA update
-        * must be restricted to external I/O links (I2S, DMIC or DSPK) since
-        * they actually depend on it. I/O modules update their clocks in
-        * hw_param() of their respective component driver and PLLA rate
-        * update here helps them to derive appropriate rates.
-        *
-        * TODO: When more HW accelerators get added (like sample rate
-        * converter, volume gain controller etc., which don't really
-        * depend on PLLA) we need a better way to filter here.
-        */
-       if (cpu_dai->driver->ops && rtd->dai_link->no_pcm) {
+       if (need_clk_update(cpu_dai)) {
                err = tegra_audio_graph_update_pll(substream, params);
                if (err)
                        return err;
index 49f63f878e6fe8b7acbaa363dfebf3b2114dd753..b5cbf1f195c48cbe16c0da96488880fcad450b10 100644 (file)
@@ -485,7 +485,7 @@ static int init_card(struct snd_usb_caiaqdev *cdev)
        }
 
        usb_make_path(usb_dev, usbpath, sizeof(usbpath));
-       snprintf(card->longname, sizeof(card->longname), "%s %s (%s)",
+       scnprintf(card->longname, sizeof(card->longname), "%s %s (%s)",
                       cdev->vendor_name, cdev->product_name, usbpath);
 
        setup_card(cdev);
index 9105ec623120a964802af82502b247bd9df47051..985b1aea9cdc94bf6687e08c42965d89f84ca8b2 100644 (file)
@@ -1929,7 +1929,6 @@ static int parse_clock_source_unit(struct mixer_build *state, int unitid,
        struct uac_clock_source_descriptor *hdr = _ftr;
        struct usb_mixer_elem_info *cval;
        struct snd_kcontrol *kctl;
-       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        int ret;
 
        if (state->mixer->protocol != UAC_VERSION_2)
@@ -1966,10 +1965,9 @@ static int parse_clock_source_unit(struct mixer_build *state, int unitid,
 
        kctl->private_free = snd_usb_mixer_elem_free;
        ret = snd_usb_copy_string_desc(state->chip, hdr->iClockSource,
-                                      name, sizeof(name));
+                                      kctl->id.name, sizeof(kctl->id.name));
        if (ret > 0)
-               snprintf(kctl->id.name, sizeof(kctl->id.name),
-                        "%s Validity", name);
+               append_ctl_name(kctl, " Validity");
        else
                snprintf(kctl->id.name, sizeof(kctl->id.name),
                         "Clock Source %d Validity", hdr->bClockID);
index 9d11bb08667e7a664017a5ec8530e5ff4ade91f9..d260be8cb6bc03e8c5c2b2a3dc5ff5759ff2588d 100644 (file)
@@ -3205,8 +3205,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
        /* Add input phantom controls */
        if (info->inputs_per_phantom == 1) {
                for (i = 0; i < info->phantom_count; i++) {
-                       snprintf(s, sizeof(s), fmt, i + 1,
-                                "Phantom Power", "Switch");
+                       scnprintf(s, sizeof(s), fmt, i + 1,
+                                 "Phantom Power", "Switch");
                        err = scarlett2_add_new_ctl(
                                mixer, &scarlett2_phantom_ctl,
                                i, 1, s, &private->phantom_ctls[i]);
@@ -3218,8 +3218,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
                        int from = i * info->inputs_per_phantom + 1;
                        int to = (i + 1) * info->inputs_per_phantom;
 
-                       snprintf(s, sizeof(s), fmt2, from, to,
-                                "Phantom Power", "Switch");
+                       scnprintf(s, sizeof(s), fmt2, from, to,
+                                 "Phantom Power", "Switch");
                        err = scarlett2_add_new_ctl(
                                mixer, &scarlett2_phantom_ctl,
                                i, 1, s, &private->phantom_ctls[i]);
index 63b0398c327656b543cca5962bb8991ee8b287cd..55ecf766ca6780447d1ed9103328366bfa7f57b2 100644 (file)
@@ -483,7 +483,7 @@ int xen_snd_front_cfg_card(struct xen_snd_front_info *front_info,
        *stream_cnt = 0;
        num_devices = 0;
        do {
-               snprintf(node, sizeof(node), "%d", num_devices);
+               scnprintf(node, sizeof(node), "%d", num_devices);
                if (!xenbus_exists(XBT_NIL, xb_dev->nodename, node))
                        break;
 
index a03d9bba515148a72192cf2b9cddab32d047858d..f3c82ab5b14cd77819030096b81e0b67cba0df1d 100644 (file)
@@ -11,8 +11,6 @@
 
 #define PHYS_ADDR_MAX  (~(phys_addr_t)0)
 
-#define __ALIGN_KERNEL(x, a)           __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
-#define __ALIGN_KERNEL_MASK(x, mask)   (((x) + (mask)) & ~(mask))
 #define ALIGN(x, a)                    __ALIGN_KERNEL((x), (a))
 #define ALIGN_DOWN(x, a)               __ALIGN_KERNEL((x) - ((a) - 1), (a))
 
@@ -29,7 +27,7 @@ static inline void *phys_to_virt(unsigned long address)
        return __va(address);
 }
 
-void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
+void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid);
 
 static inline void totalram_pages_inc(void)
 {
index 102fd9217f1f9b96438f14e7d9ef643d123ebc43..f6bc226af0c1d1c4d26c1c2d3f7a963c34c728eb 100644 (file)
@@ -1,4 +1,6 @@
 #ifndef _TOOLS_INCLUDE_LINUX_SEQ_FILE_H
 #define _TOOLS_INCLUDE_LINUX_SEQ_FILE_H
 
+struct seq_file;
+
 #endif /* _TOOLS_INCLUDE_LINUX_SEQ_FILE_H */
index 1384090530dbe3e7e0c018c833aeacdf2f95b720..e308d1ba664ef9366edc5f1412dac8659ad3a9bb 100644 (file)
@@ -4333,7 +4333,8 @@ static int validate_ibt_insn(struct objtool_file *file, struct instruction *insn
                        continue;
                }
 
-               if (insn_func(dest) && insn_func(dest) == insn_func(insn)) {
+               if (insn_func(dest) && insn_func(insn) &&
+                   insn_func(dest)->pfunc == insn_func(insn)->pfunc) {
                        /*
                         * Anything from->to self is either _THIS_IP_ or
                         * IRET-to-self.
index fdb7f5db730822e93d7732026218609cda4a054c..f6c6e5474c3afbcb238eae15e71cadb4c986f411 100644 (file)
@@ -20,4 +20,8 @@ void memblock_free_pages(struct page *page, unsigned long pfn,
 {
 }
 
+static inline void accept_memory(phys_addr_t start, phys_addr_t end)
+{
+}
+
 #endif
index 7b0909e8b759d446aa90931f062230d9a5d9e091..d3d58851864e7c7f842e201a1032bf195d50bd7a 100644 (file)
@@ -11,7 +11,7 @@ struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
        return NULL;
 }
 
-void reserve_bootmem_region(phys_addr_t start, phys_addr_t end)
+void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid)
 {
 }
 
index 411647094cc37f832ecc69c829a57036a800c9db..57bf2688edfd68ca8dbc5724da1e78aff9897e59 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
+#include "basic_api.h"
 #include <string.h>
 #include <linux/memblock.h>
-#include "basic_api.h"
 
 #define EXPECTED_MEMBLOCK_REGIONS                      128
 #define FUNC_ADD                                       "memblock_add"
index 4f23302ee6779a4b6b7e7007e2fea98b60094a4c..b5ec59aa62d72ab2ad3f51ffd5d2b4fb6722a8a3 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <linux/types.h>
+#include <linux/seq_file.h>
 #include <linux/memblock.h>
 #include <linux/sizes.h>
 #include <linux/printk.h>
index d7aafe5a1993aaf45aa1c7b237db72a15a27f224..2f1685a3eae14221610a8c861ee4d4d118186ae5 100644 (file)
@@ -431,7 +431,6 @@ long conf_get_long(snd_config_t *root, const char *key1, const char *key2, long
 int conf_get_bool(snd_config_t *root, const char *key1, const char *key2, int def)
 {
        snd_config_t *cfg;
-       long l;
        int ret;
 
        if (!root)
index c95d63e553f4d2eec044968c9c36d77313d570c8..21e482b23f5028f6e35fae82d4416a821659048e 100644 (file)
@@ -188,7 +188,7 @@ static int wait_for_event(struct ctl_data *ctl, int timeout)
 {
        unsigned short revents;
        snd_ctl_event_t *event;
-       int count, err;
+       int err;
        unsigned int mask = 0;
        unsigned int ev_id;
 
@@ -430,7 +430,6 @@ static bool strend(const char *haystack, const char *needle)
 static void test_ctl_name(struct ctl_data *ctl)
 {
        bool name_ok = true;
-       bool check;
 
        ksft_print_msg("%d.%d %s\n", ctl->card->card, ctl->elem,
                       ctl->name);
@@ -863,7 +862,6 @@ static bool test_ctl_write_invalid_value(struct ctl_data *ctl,
                                         snd_ctl_elem_value_t *val)
 {
        int err;
-       long val_read;
 
        /* Ideally this will fail... */
        err = snd_ctl_elem_write(ctl->card->handle, val);
@@ -883,8 +881,7 @@ static bool test_ctl_write_invalid_value(struct ctl_data *ctl,
 
 static bool test_ctl_write_invalid_boolean(struct ctl_data *ctl)
 {
-       int err, i;
-       long val_read;
+       int i;
        bool fail = false;
        snd_ctl_elem_value_t *val;
        snd_ctl_elem_value_alloca(&val);
@@ -994,8 +991,7 @@ static bool test_ctl_write_invalid_integer64(struct ctl_data *ctl)
 
 static bool test_ctl_write_invalid_enumerated(struct ctl_data *ctl)
 {
-       int err, i;
-       unsigned int val_read;
+       int i;
        bool fail = false;
        snd_ctl_elem_value_t *val;
        snd_ctl_elem_value_alloca(&val);
@@ -1027,7 +1023,6 @@ static bool test_ctl_write_invalid_enumerated(struct ctl_data *ctl)
 static void test_ctl_write_invalid(struct ctl_data *ctl)
 {
        bool pass;
-       int err;
 
        /* If the control is turned off let's be polite */
        if (snd_ctl_elem_info_is_inactive(ctl->info)) {
index 2f5e3c462194f0ba8b871f018c933e4351d17f70..c0a39818c5a4bbf99191973a5cf61a0756ee4d90 100644 (file)
@@ -257,7 +257,7 @@ static void find_pcms(void)
 static void test_pcm_time(struct pcm_data *data, enum test_class class,
                          const char *test_name, snd_config_t *pcm_cfg)
 {
-       char name[64], key[128], msg[256];
+       char name[64], msg[256];
        const int duration_s = 2, margin_ms = 100;
        const int duration_ms = duration_s * 1000;
        const char *cs;
@@ -567,7 +567,7 @@ int main(void)
 {
        struct card_data *card;
        struct pcm_data *pcm;
-       snd_config_t *global_config, *cfg, *pcm_cfg;
+       snd_config_t *global_config, *cfg;
        int num_pcm_tests = 0, num_tests, num_std_pcm_tests;
        int ret;
        void *thread_ret;
index 357adc722cbae846657e6f4149447cf71db56ff2..a52ecd43dbe30f81aec81aa8b384c85023e94350 100644 (file)
@@ -313,7 +313,6 @@ TEST_F(pcmtest, ni_playback) {
  */
 TEST_F(pcmtest, reset_ioctl) {
        snd_pcm_t *handle;
-       unsigned char *it;
        int test_res;
        struct pcmtest_test_params *params = &self->params;
 
index cb5f18c06593d4ee051d0f9d0bba098dde3ea19e..c778d4dcc17e58523193ffad46a79212b3e721cd 100755 (executable)
@@ -31,6 +31,9 @@ err_ret=1
 # kselftest skip code is 4
 err_skip=4
 
+# umount required
+UMOUNT_DIR=""
+
 # cgroup RT scheduling prevents chrt commands from succeeding, which
 # induces failures in test wakeup tests.  Disable for the duration of
 # the tests.
@@ -45,6 +48,9 @@ setup() {
 
 cleanup() {
   echo $sched_rt_runtime_orig > $sched_rt_runtime
+  if [ -n "${UMOUNT_DIR}" ]; then
+    umount ${UMOUNT_DIR} ||:
+  fi
 }
 
 errexit() { # message
@@ -124,6 +130,7 @@ parse_opts() { # opts
     ;;
     --logdir|-l)
       LOG_DIR=$2
+      LINK_PTR=
       shift 2
     ;;
     *.tc)
@@ -160,11 +167,13 @@ if [ -z "$TRACING_DIR" ]; then
            mount -t tracefs nodev /sys/kernel/tracing ||
              errexit "Failed to mount /sys/kernel/tracing"
            TRACING_DIR="/sys/kernel/tracing"
+           UMOUNT_DIR=${TRACING_DIR}
        # If debugfs exists, then so does /sys/kernel/debug
        elif [ -d "/sys/kernel/debug" ]; then
            mount -t debugfs nodev /sys/kernel/debug ||
              errexit "Failed to mount /sys/kernel/debug"
            TRACING_DIR="/sys/kernel/debug/tracing"
+           UMOUNT_DIR=${TRACING_DIR}
        else
            err_ret=$err_skip
            errexit "debugfs and tracefs are not configured in this kernel"
@@ -181,7 +190,10 @@ fi
 TOP_DIR=`absdir $0`
 TEST_DIR=$TOP_DIR/test.d
 TEST_CASES=`find_testcases $TEST_DIR`
-LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
+LOG_TOP_DIR=$TOP_DIR/logs
+LOG_DATE=`date +%Y%m%d-%H%M%S`
+LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/
+LINK_PTR=$LOG_TOP_DIR/latest
 KEEP_LOG=0
 KTAP=0
 DEBUG=0
@@ -207,6 +219,10 @@ else
   LOG_FILE=$LOG_DIR/ftracetest.log
   mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR"
   date > $LOG_FILE
+  if [ "x-$LINK_PTR" != "x-" ]; then
+    unlink $LINK_PTR
+    ln -fs $LOG_DATE $LINK_PTR
+  fi
 fi
 
 # Define text colors
index 5125c42efe6576e01fa873b561f8e8c8695ac1ad..22374d29ffdd4c0379bcd9fa82a9d0c6158c7afb 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/unistd.h>
 
 #include "../kselftest_harness.h"
+#include "user_events_selftests.h"
 
 const char *data_file = "/sys/kernel/tracing/user_events_data";
 const char *enable_file = "/sys/kernel/tracing/events/user_events/__abi_event/enable";
@@ -93,6 +94,8 @@ FIXTURE(user) {
 };
 
 FIXTURE_SETUP(user) {
+       USER_EVENT_FIXTURE_SETUP(return);
+
        change_event(false);
        self->check = 0;
 }
diff --git a/tools/testing/selftests/user_events/config b/tools/testing/selftests/user_events/config
new file mode 100644 (file)
index 0000000..64f7a9a
--- /dev/null
@@ -0,0 +1 @@
+CONFIG_USER_EVENTS=y
index 91a4444ad42b28381bf5b4d9d3ae41cdd204e598..32c827a52d7d82ec9b5c791f7b61753510622958 100644 (file)
@@ -15,6 +15,7 @@
 #include <unistd.h>
 
 #include "../kselftest_harness.h"
+#include "user_events_selftests.h"
 
 const char *abi_file = "/sys/kernel/tracing/user_events_data";
 const char *enable_file = "/sys/kernel/tracing/events/user_events/__test_event/enable";
@@ -146,6 +147,7 @@ FIXTURE(user) {
 };
 
 FIXTURE_SETUP(user) {
+       USER_EVENT_FIXTURE_SETUP(return);
 }
 
 FIXTURE_TEARDOWN(user) {
index 5beb0aef1d814910093001a22beba6935e4fd219..6a260caeeddc54ef194608bc9d82fba2892bdfcd 100644 (file)
@@ -16,6 +16,7 @@
 #include <unistd.h>
 
 #include "../kselftest_harness.h"
+#include "user_events_selftests.h"
 
 const char *data_file = "/sys/kernel/tracing/user_events_data";
 const char *status_file = "/sys/kernel/tracing/user_events_status";
@@ -206,6 +207,8 @@ FIXTURE(user) {
 };
 
 FIXTURE_SETUP(user) {
+       USER_EVENT_FIXTURE_SETUP(return);
+
        self->status_fd = open(status_file, O_RDONLY);
        ASSERT_NE(-1, self->status_fd);
 
index 8b09be566fa21a284810af53d05ef0f38a58da5d..f893398cda05a522a433c75cf2b2766be649bac7 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/unistd.h>
 
 #include "../kselftest_harness.h"
+#include "user_events_selftests.h"
 
 const char *data_file = "/sys/kernel/tracing/user_events_data";
 const char *id_file = "/sys/kernel/tracing/events/user_events/__test_event/id";
@@ -113,6 +114,8 @@ FIXTURE(user) {
 };
 
 FIXTURE_SETUP(user) {
+       USER_EVENT_FIXTURE_SETUP(return);
+
        self->data_fd = open(data_file, O_RDWR);
        ASSERT_NE(-1, self->data_fd);
 }
diff --git a/tools/testing/selftests/user_events/user_events_selftests.h b/tools/testing/selftests/user_events/user_events_selftests.h
new file mode 100644 (file)
index 0000000..6903789
--- /dev/null
@@ -0,0 +1,100 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _USER_EVENTS_SELFTESTS_H
+#define _USER_EVENTS_SELFTESTS_H
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "../kselftest.h"
+
+static inline bool tracefs_enabled(char **message, bool *fail)
+{
+       struct stat buf;
+       int ret;
+
+       *message = "";
+       *fail = false;
+
+       /* Ensure tracefs is installed */
+       ret = stat("/sys/kernel/tracing", &buf);
+
+       if (ret == -1) {
+               *message = "Tracefs is not installed";
+               return false;
+       }
+
+       /* Ensure mounted tracefs */
+       ret = stat("/sys/kernel/tracing/README", &buf);
+
+       if (ret == -1 && errno == ENOENT) {
+               if (mount(NULL, "/sys/kernel/tracing", "tracefs", 0, NULL) != 0) {
+                       *message = "Cannot mount tracefs";
+                       *fail = true;
+                       return false;
+               }
+
+               ret = stat("/sys/kernel/tracing/README", &buf);
+       }
+
+       if (ret == -1) {
+               *message = "Cannot access tracefs";
+               *fail = true;
+               return false;
+       }
+
+       return true;
+}
+
+static inline bool user_events_enabled(char **message, bool *fail)
+{
+       struct stat buf;
+       int ret;
+
+       *message = "";
+       *fail = false;
+
+       if (getuid() != 0) {
+               *message = "Must be run as root";
+               *fail = true;
+               return false;
+       }
+
+       if (!tracefs_enabled(message, fail))
+               return false;
+
+       /* Ensure user_events is installed */
+       ret = stat("/sys/kernel/tracing/user_events_data", &buf);
+
+       if (ret == -1) {
+               switch (errno) {
+               case ENOENT:
+                       *message = "user_events is not installed";
+                       return false;
+
+               default:
+                       *message = "Cannot access user_events_data";
+                       *fail = true;
+                       return false;
+               }
+       }
+
+       return true;
+}
+
+#define USER_EVENT_FIXTURE_SETUP(statement) do { \
+       char *message; \
+       bool fail; \
+       if (!user_events_enabled(&message, &fail)) { \
+               if (fail) { \
+                       TH_LOG("Setup failed due to: %s", message); \
+                       ASSERT_FALSE(fail); \
+               } \
+               SKIP(statement, "Skipping due to: %s", message); \
+       } \
+} while (0)
+
+#endif /* _USER_EVENTS_SELFTESTS_H */