28 Aug, 2016

1 commit

  • Pull KVM fixes from Paolo Bonzini:
    "ARM:
    - fixes for ITS init issues, error handling, IRQ leakage, race
    conditions
    - an erratum workaround for timers
    - some removal of misleading use of errors and comments
    - a fix for GICv3 on 32-bit guests

    MIPS:
    - fix for where the guest could wrongly map the first page of
    physical memory

    x86:
    - nested virtualization fixes"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
    MIPS: KVM: Check for pfn noslot case
    kvm: nVMX: fix nested tsc scaling
    KVM: nVMX: postpone VMCS changes on MSR_IA32_APICBASE write
    KVM: nVMX: fix msr bitmaps to prevent L2 from accessing L0 x2APIC
    arm64: KVM: report configured SRE value to 32-bit world
    arm64: KVM: remove misleading comment on pmu status
    KVM: arm/arm64: timer: Workaround misconfigured timer interrupt
    arm64: Document workaround for Cortex-A72 erratum #853709
    KVM: arm/arm64: Change misleading use of is_error_pfn
    KVM: arm64: ITS: avoid re-mapping LPIs
    KVM: arm64: check for ITS device on MSI injection
    KVM: arm64: ITS: move ITS registration into first VCPU run
    KVM: arm64: vgic-its: Make updates to propbaser/pendbaser atomic
    KVM: arm64: vgic-its: Plug race in vgic_put_irq
    KVM: arm64: vgic-its: Handle errors from vgic_add_lpi
    KVM: arm64: ITS: return 1 on successful MSI injection

    Linus Torvalds
     

27 Aug, 2016

1 commit

  • Commit 97f2645f358b ("tree-wide: replace config_enabled() with
    IS_ENABLED()") mostly killed config_enabled(), but some new users have
    appeared for v4.8-rc1. They are all used for a boolean option, so can
    be replaced with IS_ENABLED() safely.

    Link: http://lkml.kernel.org/r/1471970749-24867-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Acked-by: Kees Cook
    Acked-by: Peter Oberparleiter
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Ralf Baechle
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

19 Aug, 2016

1 commit

  • When mapping a page into the guest we error check using is_error_pfn(),
    however this doesn't detect a value of KVM_PFN_NOSLOT, indicating an
    error HVA for the page. This can only happen on MIPS right now due to
    unusual memslot management (e.g. being moved / removed / resized), or
    with an Enhanced Virtual Memory (EVA) configuration where the default
    KVM_HVA_ERR_* and kvm_is_error_hva() definitions are unsuitable (fixed
    in a later patch). This case will be treated as a pfn of zero, mapping
    the first page of physical memory into the guest.

    It would appear the MIPS KVM port wasn't updated prior to being merged
    (in v3.10) to take commit 81c52c56e2b4 ("KVM: do not treat noslot pfn as
    a error pfn") into account (merged v3.8), which converted a bunch of
    is_error_pfn() calls to is_error_noslot_pfn(). Switch to using
    is_error_noslot_pfn() instead to catch this case properly.

    Fixes: 858dd5d45733 ("KVM/MIPS32: MMU/TLB operations for the Guest.")
    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: Radim Krčmář
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Cc: # 3.10.y-
    Signed-off-by: Paolo Bonzini

    James Hogan
     

12 Aug, 2016

4 commits

  • Propagate errors from kvm_mips_handle_kseg0_tlb_fault() and
    kvm_mips_handle_mapped_seg_tlb_fault(), usually triggering an internal
    error since they normally indicate the guest accessed bad physical
    memory or the commpage in an unexpected way.

    Fixes: 858dd5d45733 ("KVM/MIPS32: MMU/TLB operations for the Guest.")
    Fixes: e685c689f3a8 ("KVM/MIPS32: Privileged instruction/target branch emulation.")
    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Cc: # 3.10.x-
    Signed-off-by: Radim Krčmář

    James Hogan
     
  • Two consecutive gfns are loaded into host TLB, so ensure the range check
    isn't off by one if guest_pmap_npages is odd.

    Fixes: 858dd5d45733 ("KVM/MIPS32: MMU/TLB operations for the Guest.")
    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Cc: # 3.10.x-
    Signed-off-by: Radim Krčmář

    James Hogan
     
  • kvm_mips_handle_mapped_seg_tlb_fault() calculates the guest frame number
    based on the guest TLB EntryLo values, however it is not range checked
    to ensure it lies within the guest_pmap. If the physical memory the
    guest refers to is out of range then dump the guest TLB and emit an
    internal error.

    Fixes: 858dd5d45733 ("KVM/MIPS32: MMU/TLB operations for the Guest.")
    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Cc: # 3.10.x-
    Signed-off-by: Radim Krčmář

    James Hogan
     
  • kvm_mips_handle_mapped_seg_tlb_fault() appears to map the guest page at
    virtual address 0 to PFN 0 if the guest has created its own mapping
    there. The intention is unclear, but it may have been an attempt to
    protect the zero page from being mapped to anything but the comm page in
    code paths you wouldn't expect from genuine commpage accesses (guest
    kernel mode cache instructions on that address, hitting trapping
    instructions when executing from that address with a coincidental TLB
    eviction during the KVM handling, and guest user mode accesses to that
    address).

    Fix this to check for mappings exactly at KVM_GUEST_COMMPAGE_ADDR (it
    may not be at address 0 since commit 42aa12e74e91 ("MIPS: KVM: Move
    commpage so 0x0 is unmapped")), and set the corresponding EntryLo to be
    interpreted as 0 (invalid).

    Fixes: 858dd5d45733 ("KVM/MIPS32: MMU/TLB operations for the Guest.")
    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Cc: # 3.10.x-
    Signed-off-by: Radim Krčmář

    James Hogan
     

06 Aug, 2016

1 commit

  • Pull MIPS updates from Ralf Baechle:
    "This is the main pull request for MIPS for 4.8. Also includes is a
    minor SSB cleanup as SSB code traditionally is merged through the MIPS
    tree:

    ATH25:
    - MIPS: Add default configuration for ath25

    Boot:
    - For zboot, copy appended dtb to the end of the kernel
    - store the appended dtb address in a variable

    BPF:
    - Fix off by one error in offset allocation

    Cobalt code:
    - Fix typos

    Core code:
    - debugfs_create_file returns NULL on error, so don't use IS_ERR for
    testing for errors.
    - Fix double locking issue in RM7000 S-cache code. This would only
    affect RM7000 ARC systems on reboot.
    - Fix page table corruption on THP permission changes.
    - Use compat_sys_keyctl for 32 bit userspace on 64 bit kernels.
    David says, there are no compatibility issues raised by this fix.
    - Move some signal code around.
    - Rewrite r4k count/compare clockevent device registration such that
    min_delta_ticks/max_delta_ticks files are guaranteed to be
    initialized.
    - Only register r4k count/compare as clockevent device if we can
    assume the clock to be constant.
    - Fix MSA asm warnings in control reg accessors
    - uasm and tlbex fixes and tweaking.
    - Print segment physical address when EU=1.
    - Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO.
    - CP: Allow booting by VP other than VP 0
    - Cache handling fixes and optimizations for r4k class caches
    - Add hotplug support for R6 processors
    - Cleanup hotplug bits in kconfig
    - traps: return correct si code for accessing nonmapped addresses
    - Remove cpu_has_safe_index_cacheops

    Lantiq:
    - Register IRQ handler for virtual IRQ number
    - Fix EIU interrupt loading code
    - Use the real EXIN count
    - Fix build error.

    Loongson 3:
    - Increase HPET_MIN_PROG_DELTA and decrease HPET_MIN_CYCLES

    Octeon:
    - Delete built-in DTB pruning code for D-Link DSR-1000N.
    - Clean up GPIO definitions in dlink_dsr-1000n.dts.
    - Add more LEDs to the DSR-100n DTS
    - Fix off by one in octeon_irq_gpio_map()
    - Typo fixes
    - Enable SATA by default in cavium_octeon_defconfig
    - Support readq/writeq()
    - Remove forced mappings of USB interrupts.
    - Ensure DMA descriptors are always in the low 4GB
    - Improve USB reset code for OCTEON II.

    Pistachio:
    - Add maintainers entry for pistachio SoC Support
    - Remove plat_setup_iocoherency

    Ralink:
    - Fix pwm UART in spis group pinmux.

    SSB:
    - Change bare unsigned to unsigned int to suit coding style

    Tools:
    - Fix reloc tool compiler warnings.

    Other:
    - Delete use of ARCH_WANT_OPTIONAL_GPIOLIB"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (61 commits)
    MIPS: mm: Fix definition of R6 cache instruction
    MIPS: tools: Fix relocs tool compiler warnings
    MIPS: Cobalt: Fix typo
    MIPS: Octeon: Fix typo
    MIPS: Lantiq: Fix build failure
    MIPS: Use CPHYSADDR to implement mips32 __pa
    MIPS: Octeon: Dlink_dsr-1000n.dts: add more leds.
    MIPS: Octeon: Clean up GPIO definitions in dlink_dsr-1000n.dts.
    MIPS: Octeon: Delete built-in DTB pruning code for D-Link DSR-1000N.
    MIPS: store the appended dtb address in a variable
    MIPS: ZBOOT: copy appended dtb to the end of the kernel
    MIPS: ralink: fix spis group pinmux
    MIPS: Factor o32 specific code into signal_o32.c
    MIPS: non-exec stack & heap when non-exec PT_GNU_STACK is present
    MIPS: Use per-mm page to execute branch delay slot instructions
    MIPS: Modify error handling
    MIPS: c-r4k: Use SMP calls for CM indexed cache ops
    MIPS: c-r4k: Avoid small flush_icache_range SMP calls
    MIPS: c-r4k: Local flush_icache_range cache op override
    MIPS: c-r4k: Split r4k_flush_kernel_vmap_range()
    ...

    Linus Torvalds
     

05 Aug, 2016

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "RTC for 4.8

    Cleanups:
    - huge cleanup of rtc-generic and char/genrtc this allowed to cleanup
    rtc-cmos, rtc-sh, rtc-m68k, rtc-powerpc and rtc-parisc
    - move mn10300 to rtc-cmos

    Subsystem:
    - fix wakealarms after hibernate
    - multiples fixes for rctest
    - simplify implementations of .read_alarm

    New drivers:
    - Maxim MAX6916

    Drivers:
    - ds1307: fix weekday
    - m41t80: add wakeup support
    - pcf85063: add support for PCF85063A variant
    - rv8803: extend i2c fix and other fixes
    - s35390a: fix alarm reading, this fixes instant reboot after
    shutdown for QNAP TS-41x
    - s3c: clock fixes"

    * tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (65 commits)
    rtc: rv8803: Clear V1F when setting the time
    rtc: rv8803: Stop the clock while setting the time
    rtc: rv8803: Always apply the I²C workaround
    rtc: rv8803: Fix read day of week
    rtc: rv8803: Remove the check for valid time
    rtc: rv8803: Kconfig: Indicate rx8900 support
    rtc: asm9260: remove .owner field for driver
    rtc: at91sam9: Fix missing spin_lock_init()
    rtc: m41t80: add suspend handlers for alarm IRQ
    rtc: m41t80: make it a real error message
    rtc: pcf85063: Add support for the PCF85063A device
    rtc: pcf85063: fix year range
    rtc: hym8563: in .read_alarm set .tm_sec to 0 to signal minute accuracy
    rtc: explicitly set tm_sec = 0 for drivers with minute accurancy
    rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq()
    rtc: s3c: Remove unnecessary call to disable already disabled clock
    rtc: abx80x: use devm_add_action_or_reset()
    rtc: m41t80: use devm_add_action_or_reset()
    rtc: fix a typo and reduce three empty lines to one
    rtc: s35390a: improve two comments in .set_alarm
    ...

    Linus Torvalds
     

04 Aug, 2016

2 commits

  • The dma-mapping core and the implementations do not change the DMA
    attributes passed by pointer. Thus the pointer can point to const data.
    However the attributes do not have to be a bitfield. Instead unsigned
    long will do fine:

    1. This is just simpler. Both in terms of reading the code and setting
    attributes. Instead of initializing local attributes on the stack
    and passing pointer to it to dma_set_attr(), just set the bits.

    2. It brings safeness and checking for const correctness because the
    attributes are passed by value.

    Semantic patches for this change (at least most of them):

    virtual patch
    virtual context

    @r@
    identifier f, attrs;

    @@
    f(...,
    - struct dma_attrs *attrs
    + unsigned long attrs
    , ...)
    {
    ...
    }

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
    )

    and

    // Options: --all-includes
    virtual patch
    virtual context

    @r@
    identifier f, attrs;
    type t;

    @@
    t f(..., struct dma_attrs *attrs);

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
    )

    Link: http://lkml.kernel.org/r/1468399300-5399-2-git-send-email-k.kozlowski@samsung.com
    Signed-off-by: Krzysztof Kozlowski
    Acked-by: Vineet Gupta
    Acked-by: Robin Murphy
    Acked-by: Hans-Christian Noren Egtvedt
    Acked-by: Mark Salter [c6x]
    Acked-by: Jesper Nilsson [cris]
    Acked-by: Daniel Vetter [drm]
    Reviewed-by: Bart Van Assche
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Fabien Dessenne [bdisp]
    Reviewed-by: Marek Szyprowski [vb2-core]
    Acked-by: David Vrabel [xen]
    Acked-by: Konrad Rzeszutek Wilk [xen swiotlb]
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Richard Kuo [hexagon]
    Acked-by: Geert Uytterhoeven [m68k]
    Acked-by: Gerald Schaefer [s390]
    Acked-by: Bjorn Andersson
    Acked-by: Hans-Christian Noren Egtvedt [avr32]
    Acked-by: Vineet Gupta [arc]
    Acked-by: Robin Murphy [arm64 and dma-iommu]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Krzysztof Kozlowski
     
  • The use of config_enabled() against config options is ambiguous. In
    practical terms, config_enabled() is equivalent to IS_BUILTIN(), but the
    author might have used it for the meaning of IS_ENABLED(). Using
    IS_ENABLED(), IS_BUILTIN(), IS_MODULE() etc. makes the intention
    clearer.

    This commit replaces config_enabled() with IS_ENABLED() where possible.
    This commit is only touching bool config options.

    I noticed two cases where config_enabled() is used against a tristate
    option:

    - config_enabled(CONFIG_HWMON)
    [ drivers/net/wireless/ath/ath10k/thermal.c ]

    - config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)
    [ drivers/gpu/drm/gma500/opregion.c ]

    I did not touch them because they should be converted to IS_BUILTIN()
    in order to keep the logic, but I was not sure it was the authors'
    intention.

    Link: http://lkml.kernel.org/r/1465215656-20569-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Acked-by: Kees Cook
    Cc: Stas Sergeev
    Cc: Matt Redfearn
    Cc: Joshua Kinard
    Cc: Jiri Slaby
    Cc: Bjorn Helgaas
    Cc: Borislav Petkov
    Cc: Markos Chandras
    Cc: "Dmitry V. Levin"
    Cc: yu-cheng yu
    Cc: James Hogan
    Cc: Brian Gerst
    Cc: Johannes Berg
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: Will Drewry
    Cc: Nikolay Martynov
    Cc: Huacai Chen
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Cc: Daniel Borkmann
    Cc: Leonid Yegoshin
    Cc: Rafal Milecki
    Cc: James Cowgill
    Cc: Greg Kroah-Hartman
    Cc: Ralf Baechle
    Cc: Alex Smith
    Cc: Adam Buchbinder
    Cc: Qais Yousef
    Cc: Jiang Liu
    Cc: Mikko Rapeli
    Cc: Paul Gortmaker
    Cc: Denys Vlasenko
    Cc: Brian Norris
    Cc: Hidehiro Kawai
    Cc: "Luis R. Rodriguez"
    Cc: Andy Lutomirski
    Cc: Ingo Molnar
    Cc: Dave Hansen
    Cc: "Kirill A. Shutemov"
    Cc: Roland McGrath
    Cc: Paul Burton
    Cc: Kalle Valo
    Cc: Viresh Kumar
    Cc: Tony Wu
    Cc: Huaitong Han
    Cc: Sumit Semwal
    Cc: Alexei Starovoitov
    Cc: Juergen Gross
    Cc: Jason Cooper
    Cc: "David S. Miller"
    Cc: Oleg Nesterov
    Cc: Andrea Gelmini
    Cc: David Woodhouse
    Cc: Marc Zyngier
    Cc: Rabin Vincent
    Cc: "Maciej W. Rozycki"
    Cc: David Daney
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

03 Aug, 2016

10 commits

  • Ralf Baechle
     
  • Commit a168b8f1cde6 ("MIPS: mm: Add MIPS R6 instruction encodings") added
    an incorrect definition of the redefined MIPSr6 cache instruction.

    Executing any kernel code including this instuction results in a
    reserved instruction exception and kernel panic.

    Fix the instruction definition.

    Fixes: a168b8f1cde6588ff7a67699fa11e01bc77a5ddd
    Signed-off-by: Matt Redfearn
    Cc: # 4.x-
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13663/
    Signed-off-by: Ralf Baechle

    Matt Redfearn
     
  • When using clang as HOSTCC, the following warnings appear:

    In file included from arch/mips/boot/tools/relocs_64.c:27:0:
    arch/mips/boot/tools/relocs.c: In function ‘read_relocs’:
    arch/mips/boot/tools/relocs.c:397:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    ELF_R_SYM(rel->r_info) = elf32_to_cpu(ELF_R_SYM(rel->r_info));
    ^~~~~~~~~
    arch/mips/boot/tools/relocs.c:397:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    arch/mips/boot/tools/relocs.c: In function ‘walk_relocs’:
    arch/mips/boot/tools/relocs.c:491:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    Elf_Sym *sym = &sh_symtab[ELF_R_SYM(rel->r_info)];
    ^~~~~~~
    arch/mips/boot/tools/relocs.c: In function ‘do_reloc’:
    arch/mips/boot/tools/relocs.c:502:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    unsigned r_type = ELF_R_TYPE(rel->r_info);
    ^~~~~~~~
    arch/mips/boot/tools/relocs.c: In function ‘do_reloc_info’:
    arch/mips/boot/tools/relocs.c:641:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    rel_type(ELF_R_TYPE(rel->r_info)),
    ^~~~~~~~

    Fix them by making Elf64_Mips_Rela a union

    Signed-off-by: Harvey Hunt
    Acked-by: Matt Redfearn
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13683/
    Signed-off-by: Ralf Baechle

    Harvey Hunt
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13316/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13315/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Some configs of mips like xway_defconffig are failing with the error:
    arch/mips/lantiq/irq.c:209:2: error: initialization from incompatible
    pointer type [-Werror]
    "icu",
    ^
    arch/mips/lantiq/irq.c:209:2: error: (near initialization for
    'ltq_irq_type.parent_device') [-Werror]
    arch/mips/lantiq/irq.c:219:2: error: initialization from incompatible
    pointer type [-Werror]
    "eiu",
    ^
    arch/mips/lantiq/irq.c:219:2: error: (near initialization for
    'ltq_eiu_type.parent_device') [-Werror]

    The first member of the "struct irq" is no longer a pointer for the
    name.

    Fixes: be45beb2df69 ("genirq: Add runtime power management support for IRQ chips")
    Signed-off-by: Sudip Mukherjee
    Acked-by: John Crispin
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13684/
    Signed-off-by: Ralf Baechle

    Sudip Mukherjee
     
  • Merge yet more updates from Andrew Morton:

    - the rest of ocfs2

    - various hotfixes, mainly MM

    - quite a bit of misc stuff - drivers, fork, exec, signals, etc.

    - printk updates

    - firmware

    - checkpatch

    - nilfs2

    - more kexec stuff than usual

    - rapidio updates

    - w1 things

    * emailed patches from Andrew Morton : (111 commits)
    ipc: delete "nr_ipc_ns"
    kcov: allow more fine-grained coverage instrumentation
    init/Kconfig: add clarification for out-of-tree modules
    config: add android config fragments
    init/Kconfig: ban CONFIG_LOCALVERSION_AUTO with allmodconfig
    relay: add global mode support for buffer-only channels
    init: allow blacklisting of module_init functions
    w1:omap_hdq: fix regression
    w1: add helper macro module_w1_family
    w1: remove need for ida and use PLATFORM_DEVID_AUTO
    rapidio/switches: add driver for IDT gen3 switches
    powerpc/fsl_rio: apply changes for RIO spec rev 3
    rapidio: modify for rev.3 specification changes
    rapidio: change inbound window size type to u64
    rapidio/idt_gen2: fix locking warning
    rapidio: fix error handling in mbox request/release functions
    rapidio/tsi721_dma: advance queue processing from transfer submit call
    rapidio/tsi721: add messaging mbox selector parameter
    rapidio/tsi721: add PCIe MRRS override parameter
    rapidio/tsi721_dma: add channel mask and queue size parameters
    ...

    Linus Torvalds
     
  • There was only one use of __initdata_refok and __exit_refok

    __init_refok was used 46 times against 82 for __ref.

    Those definitions are obsolete since commit 312b1485fb50 ("Introduce new
    section reference annotations tags: __ref, __refdata, __refconst")

    This patch removes the following compatibility definitions and replaces
    them treewide.

    /* compatibility defines */
    #define __init_refok __ref
    #define __initdata_refok __refdata
    #define __exit_refok __ref

    I can also provide separate patches if necessary.
    (One patch per tree and check in 1 month or 2 to remove old definitions)

    [akpm@linux-foundation.org: coding-style fixes]
    Link: http://lkml.kernel.org/r/1466796271-3043-1-git-send-email-fabf@skynet.be
    Signed-off-by: Fabian Frederick
    Cc: Ingo Molnar
    Cc: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     
  • Pull PCI updates from Bjorn Helgaas:
    "Highlights:

    - ARM64 support for ACPI host bridges

    - new drivers for Axis ARTPEC-6 and Marvell Aardvark

    - new pci_alloc_irq_vectors() interface for MSI-X, MSI, legacy INTx

    - pci_resource_to_user() cleanup (more to come)

    Detailed summary:

    Enumeration:
    - Move ecam.h to linux/include/pci-ecam.h (Jayachandran C)
    - Add parent device field to ECAM struct pci_config_window (Jayachandran C)
    - Add generic MCFG table handling (Tomasz Nowicki)
    - Refactor pci_bus_assign_domain_nr() for CONFIG_PCI_DOMAINS_GENERIC (Tomasz Nowicki)
    - Factor DT-specific pci_bus_find_domain_nr() code out (Tomasz Nowicki)

    Resource management:
    - Add devm_request_pci_bus_resources() (Bjorn Helgaas)
    - Unify pci_resource_to_user() declarations (Bjorn Helgaas)
    - Implement pci_resource_to_user() with pcibios_resource_to_bus() (microblaze, powerpc, sparc) (Bjorn Helgaas)
    - Request host bridge window resources (designware, iproc, rcar, xgene, xilinx, xilinx-nwl) (Bjorn Helgaas)
    - Make PCI I/O space optional on ARM32 (Bjorn Helgaas)
    - Ignore write combining when mapping I/O port space (Bjorn Helgaas)
    - Claim bus resources on MIPS PCI_PROBE_ONLY set-ups (Bjorn Helgaas)
    - Remove unicore32 pci=firmware command line parameter handling (Bjorn Helgaas)
    - Support I/O resources when parsing host bridge resources (Jayachandran C)
    - Add helpers to request/release memory and I/O regions (Johannes Thumshirn)
    - Use pci_(request|release)_mem_regions (NVMe, lpfc, GenWQE, ethernet/intel, alx) (Johannes Thumshirn)
    - Extend pci=resource_alignment to specify device/vendor IDs (Koehrer Mathias (ETAS/ESW5))
    - Add generic pci_bus_claim_resources() (Lorenzo Pieralisi)
    - Claim bus resources on ARM32 PCI_PROBE_ONLY set-ups (Lorenzo Pieralisi)
    - Remove ARM32 and ARM64 arch-specific pcibios_enable_device() (Lorenzo Pieralisi)
    - Add pci_unmap_iospace() to unmap I/O resources (Sinan Kaya)
    - Remove powerpc __pci_mmap_set_pgprot() (Yinghai Lu)

    PCI device hotplug:
    - Allow additional bus numbers for hotplug bridges (Keith Busch)
    - Ignore interrupts during D3cold (Lukas Wunner)

    Power management:
    - Enforce type casting for pci_power_t (Andy Shevchenko)
    - Don't clear d3cold_allowed for PCIe ports (Mika Westerberg)
    - Put PCIe ports into D3 during suspend (Mika Westerberg)
    - Power on bridges before scanning new devices (Mika Westerberg)
    - Runtime resume bridge before rescan (Mika Westerberg)
    - Add runtime PM support for PCIe ports (Mika Westerberg)
    - Remove redundant check of pcie_set_clkpm (Shawn Lin)

    Virtualization:
    - Add function 1 DMA alias quirk for Marvell 88SE9182 (Aaron Sierra)
    - Add DMA alias quirk for Adaptec 3805 (Alex Williamson)
    - Mark Atheros AR9485 and QCA9882 to avoid bus reset (Chris Blake)
    - Add ACS quirk for Solarflare SFC9220 (Edward Cree)

    MSI:
    - Fix PCI_MSI dependencies (Arnd Bergmann)
    - Add pci_msix_desc_addr() helper (Christoph Hellwig)
    - Switch msix_program_entries() to use pci_msix_desc_addr() (Christoph Hellwig)
    - Make the "entries" argument to pci_enable_msix() optional (Christoph Hellwig)
    - Provide sensible IRQ vector alloc/free routines (Christoph Hellwig)
    - Spread interrupt vectors in pci_alloc_irq_vectors() (Christoph Hellwig)

    Error Handling:
    - Bind DPC to Root Ports as well as Downstream Ports (Keith Busch)
    - Remove DPC tristate module option (Keith Busch)
    - Convert Downstream Port Containment driver to use devm_* functions (Mika Westerberg)

    Generic host bridge driver:
    - Select IRQ_DOMAIN (Arnd Bergmann)
    - Claim bus resources on PCI_PROBE_ONLY set-ups (Lorenzo Pieralisi)

    ACPI host bridge driver:
    - Add ARM64 acpi_pci_bus_find_domain_nr() (Tomasz Nowicki)
    - Add ARM64 ACPI support for legacy IRQs parsing and consolidation with DT code (Tomasz Nowicki)
    - Implement ARM64 AML accessors for PCI_Config region (Tomasz Nowicki)
    - Support ARM64 ACPI-based PCI host controller (Tomasz Nowicki)

    Altera host bridge driver:
    - Check link status before retrain link (Ley Foon Tan)
    - Poll for link up status after retraining the link (Ley Foon Tan)

    Axis ARTPEC-6 host bridge driver:
    - Add PCI_MSI_IRQ_DOMAIN dependency (Arnd Bergmann)
    - Add DT binding for Axis ARTPEC-6 PCIe controller (Niklas Cassel)
    - Add Axis ARTPEC-6 PCIe controller driver (Niklas Cassel)

    Intel VMD host bridge driver:
    - Use lock save/restore in interrupt enable path (Jon Derrick)
    - Select device dma ops to override (Keith Busch)
    - Initialize list item in IRQ disable (Keith Busch)
    - Use x86_vector_domain as parent domain (Keith Busch)
    - Separate MSI and MSI-X vector sharing (Keith Busch)

    Marvell Aardvark host bridge driver:
    - Add DT binding for the Aardvark PCIe controller (Thomas Petazzoni)
    - Add Aardvark PCI host controller driver (Thomas Petazzoni)
    - Add Aardvark PCIe support for Armada 3700 (Thomas Petazzoni)

    Microsoft Hyper-V host bridge driver:
    - Fix interrupt cleanup path (Cathy Avery)
    - Don't leak buffer in hv_pci_onchannelcallback() (Vitaly Kuznetsov)
    - Handle all pending messages in hv_pci_onchannelcallback() (Vitaly Kuznetsov)

    NVIDIA Tegra host bridge driver:
    - Program PADS_REFCLK_CFG* always, not just on legacy SoCs (Stephen Warren)
    - Program PADS_REFCLK_CFG* registers with per-SoC values (Stephen Warren)
    - Use lower-case hex consistently for register definitions (Thierry Reding)
    - Use generic pci_remap_iospace() rather than ARM32-specific one (Thierry Reding)
    - Stop setting pcibios_min_mem (Thierry Reding)

    Renesas R-Car host bridge driver:
    - Drop gen2 dummy I/O port region (Bjorn Helgaas)

    TI DRA7xx host bridge driver:
    - Fix return value in case of error (Christophe JAILLET)

    Xilinx AXI host bridge driver:
    - Fix return value in case of error (Christophe JAILLET)

    Miscellaneous:
    - Make bus_attr_resource_alignment static (Ben Dooks)
    - Include for isa_dma_bridge_buggy (Ben Dooks)
    - MAINTAINERS: Add file patterns for PCI device tree bindings (Geert Uytterhoeven)
    - Make host bridge drivers explicitly non-modular (Paul Gortmaker)"

    * tag 'pci-v4.8-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (125 commits)
    PCI: xgene: Make explicitly non-modular
    PCI: thunder-pem: Make explicitly non-modular
    PCI: thunder-ecam: Make explicitly non-modular
    PCI: tegra: Make explicitly non-modular
    PCI: rcar-gen2: Make explicitly non-modular
    PCI: rcar: Make explicitly non-modular
    PCI: mvebu: Make explicitly non-modular
    PCI: layerscape: Make explicitly non-modular
    PCI: keystone: Make explicitly non-modular
    PCI: hisi: Make explicitly non-modular
    PCI: generic: Make explicitly non-modular
    PCI: designware-plat: Make it explicitly non-modular
    PCI: artpec6: Make explicitly non-modular
    PCI: armada8k: Make explicitly non-modular
    PCI: artpec: Add PCI_MSI_IRQ_DOMAIN dependency
    PCI: Add ACS quirk for Solarflare SFC9220
    arm64: dts: marvell: Add Aardvark PCIe support for Armada 3700
    PCI: aardvark: Add Aardvark PCI host controller driver
    dt-bindings: add DT binding for the Aardvark PCIe controller
    PCI: tegra: Program PADS_REFCLK_CFG* registers with per-SoC values
    ...

    Linus Torvalds
     
  • Pull KVM updates from Paolo Bonzini:

    - ARM: GICv3 ITS emulation and various fixes. Removal of the
    old VGIC implementation.

    - s390: support for trapping software breakpoints, nested
    virtualization (vSIE), the STHYI opcode, initial extensions
    for CPU model support.

    - MIPS: support for MIPS64 hosts (32-bit guests only) and lots
    of cleanups, preliminary to this and the upcoming support for
    hardware virtualization extensions.

    - x86: support for execute-only mappings in nested EPT; reduced
    vmexit latency for TSC deadline timer (by about 30%) on Intel
    hosts; support for more than 255 vCPUs.

    - PPC: bugfixes.

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (302 commits)
    KVM: PPC: Introduce KVM_CAP_PPC_HTM
    MIPS: Select HAVE_KVM for MIPS64_R{2,6}
    MIPS: KVM: Reset CP0_PageMask during host TLB flush
    MIPS: KVM: Fix ptr->int cast via KVM_GUEST_KSEGX()
    MIPS: KVM: Sign extend MFC0/RDHWR results
    MIPS: KVM: Fix 64-bit big endian dynamic translation
    MIPS: KVM: Fail if ebase doesn't fit in CP0_EBase
    MIPS: KVM: Use 64-bit CP0_EBase when appropriate
    MIPS: KVM: Set CP0_Status.KX on MIPS64
    MIPS: KVM: Make entry code MIPS64 friendly
    MIPS: KVM: Use kmap instead of CKSEG0ADDR()
    MIPS: KVM: Use virt_to_phys() to get commpage PFN
    MIPS: Fix definition of KSEGX() for 64-bit
    KVM: VMX: Add VMCS to CPU's loaded VMCSs before VMPTRLD
    kvm: x86: nVMX: maintain internal copy of current VMCS
    KVM: PPC: Book3S HV: Save/restore TM state in H_CEDE
    KVM: PPC: Book3S HV: Pull out TM state save/restore into separate procedures
    KVM: arm64: vgic-its: Simplify MAPI error handling
    KVM: arm64: vgic-its: Make vgic_its_cmd_handle_mapi similar to other handlers
    KVM: arm64: vgic-its: Turn device_id validation into generic ID validation
    ...

    Linus Torvalds
     

02 Aug, 2016

19 commits

  • Use CPHYSADDR to implement the __pa macro converting from a virtual to a
    physical address for MIPS32, much as is already done for MIPS64 (though
    without the complication of having both compatibility & XKPHYS
    segments).

    This allows for __pa to work regardless of whether the address being
    translated is in kseg0 or kseg1, unlike the previous subtraction based
    approach which only worked for addresses in kseg0. Working for kseg1
    addresses is important if __pa is used on addresses allocated by
    dma_alloc_coherent, where on systems with non-coherent I/O we provide
    addresses in kseg1. If this address is then used with
    dma_map_single_attrs then it is provided to virt_to_page, which in turn
    calls virt_to_phys which is a wrapper around __pa. The result is that we
    end up with a physical address 0x20000000 bytes (ie. the size of kseg0)
    too high.

    In addition to providing consistency with MIPS64 & fixing the kseg1 case
    above this has the added bonus of generating smaller code for systems
    implementing MIPS32r2 & beyond, where a single ext instruction can
    extract the physical address rather than needing to load an immediate
    into a temp register & subtract it. This results in ~1.3KB savings for a
    boston_defconfig kernel adjusted to set CONFIG_32BIT=y.

    This patch does not change the EVA case, which may or may not have
    similar issues around handling both cached & uncached addresses but is
    beyond the scope of this patch.

    Signed-off-by: Paul Burton
    Cc: Dan Williams
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13836/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Add more leds discovered by reverse engineering. Labels are according
    to markings in the mechanics.

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Cc: devicetree@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13466/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Clean up GPIO definitions in dlink_dsr-1000n.dts.

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Cc: devicetree@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13465/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Users will get more complete functionality by using the appended DTB,
    so delete the legacy booting support for this board.

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Cc: devicetree@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13464/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Instead of rewriting the arguments to match the UHI spec, store the
    address of a appended or UHI supplied dtb in fw_supplied_dtb.

    That way the original bootloader arugments are kept intact while still
    making the use of an appended dtb invisible for mach code.

    Mach code can still find out if it is an appended dtb by comparing
    fw_arg1 with fw_supplied_dtb.

    Signed-off-by: Jonas Gorski
    Cc: Kevin Cernekee
    Cc: Florian Fainelli
    Cc: John Crispin
    Cc: Paul Burton
    Cc: James Hogan
    Cc: Alban Bedel
    Cc: Daniel Gimpelevich
    Cc: Antony Pavlov
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13699/
    Signed-off-by: Ralf Baechle

    Jonas Gorski
     
  • Instead of rewriting the arguments, just move the appended dtb to where
    the decompressed kernel expects it. This eliminates the need for special
    casing vmlinuz.bin appended dtb files.

    Signed-off-by: Jonas Gorski
    Cc: Kevin Cernekee
    Cc: Florian Fainelli
    Cc: John Crispin
    Cc: Paul Burton
    Cc: James Hogan
    Cc: Alban Bedel
    Cc: Daniel Gimpelevich
    Cc: Antony Pavlov
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13698/
    Signed-off-by: Ralf Baechle

    Jonas Gorski
     
  • pwm function for spis conflicts with uart2 and uart1, fix this by changing it
    to pwm_uart2, which reflects the real use of these pins with these pinmux
    (2 for pwm and 2 for uart).

    Signed-off-by: Álvaro Fernández Rojas
    Cc: john@phrozen.org
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13369/
    Signed-off-by: Ralf Baechle

    Álvaro Fernández Rojas
     
  • The commit ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
    caused building a 64 bit kernel with support for n32 and not o32
    to produce a build error:

    arch/mips/kernel/signal32.c:415:11: error: ‘vdso_image_o32’ undeclared here (not in a function)
    .vdso = &vdso_image_o32,

    Fix this by moving the o32 specific code into signal_o32.c and
    updating the Makefile accordingly.

    Signed-off-by: Harvey Hunt
    Cc: Leonid Yegoshin
    Cc: Alex Smith
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13690/
    Signed-off-by: Ralf Baechle

    Harvey Hunt
     
  • The stack and heap have both been executable by default on MIPS until
    now. This patch changes the default to be non-executable, but only for
    ELF binaries with a non-executable PT_GNU_STACK header present. This
    does apply to both the heap & the stack, despite the name PT_GNU_STACK,
    and this matches the behaviour of other architectures like ARM & x86.

    Current MIPS toolchains do not produce the PT_GNU_STACK header, which
    means that we can rely upon this patch not changing the behaviour of
    existing binaries. The new default will only take effect for newly
    compiled binaries once toolchains are updated to support PT_GNU_STACK,
    and since those binaries are newly compiled they can be compiled
    expecting the change in default behaviour. Again this matches the way in
    which the ARM & x86 architectures handled their implementations of
    non-executable memory.

    Signed-off-by: Paul Burton
    Cc: Leonid Yegoshin
    Cc: Maciej Rozycki
    Cc: Faraz Shahbazker
    Cc: Raghu Gandham
    Cc: Matthew Fortune
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13765/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • In some cases the kernel needs to execute an instruction from the delay
    slot of an emulated branch instruction. These cases include:

    - Emulated floating point branch instructions (bc1[ft]l?) for systems
    which don't include an FPU, or upon which the kernel is run with the
    "nofpu" parameter.

    - MIPSr6 systems running binaries targeting older revisions of the
    architecture, which may include branch instructions whose encodings
    are no longer valid in MIPSr6.

    Executing instructions from such delay slots is done by writing the
    instruction to memory followed by a trap, as part of an "emuframe", and
    executing it. This avoids the requirement of an emulator for the entire
    MIPS instruction set. Prior to this patch such emuframes are written to
    the user stack and executed from there.

    This patch moves FP branch delay emuframes off of the user stack and
    into a per-mm page. Allocating a page per-mm leaves userland with access
    to only what it had access to previously, and compared to other
    solutions is relatively simple.

    When a thread requires a delay slot emulation, it is allocated a frame.
    A thread may only have one frame allocated at any one time, since it may
    only ever be executing one instruction at any one time. In order to
    ensure that we can free up allocated frame later, its index is recorded
    in struct thread_struct. In the typical case, after executing the delay
    slot instruction we'll execute a break instruction with the BRK_MEMU
    code. This traps back to the kernel & leads to a call to do_dsemulret
    which frees the allocated frame & moves the user PC back to the
    instruction that would have executed following the emulated branch.
    In some cases the delay slot instruction may be invalid, such as a
    branch, or may trigger an exception. In these cases the BRK_MEMU break
    instruction will not be hit. In order to ensure that frames are freed
    this patch introduces dsemul_thread_cleanup() and calls it to free any
    allocated frame upon thread exit. If the instruction generated an
    exception & leads to a signal being delivered to the thread, or indeed
    if a signal simply happens to be delivered to the thread whilst it is
    executing from the struct emuframe, then we need to take care to exit
    the frame appropriately. This is done by either rolling back the user PC
    to the branch or advancing it to the continuation PC prior to signal
    delivery, using dsemul_thread_rollback(). If this were not done then a
    sigreturn would return to the struct emuframe, and if that frame had
    meanwhile been used in response to an emulated branch instruction within
    the signal handler then we would execute the wrong user code.

    Whilst a user could theoretically place something like a compact branch
    to self in a delay slot and cause their thread to become stuck in an
    infinite loop with the frame never being deallocated, this would:

    - Only affect the users single process.

    - Be architecturally invalid since there would be a branch in the
    delay slot, which is forbidden.

    - Be extremely unlikely to happen by mistake, and provide a program
    with no more ability to harm the system than a simple infinite loop
    would.

    If a thread requires a delay slot emulation & no frame is available to
    it (ie. the process has enough other threads that all frames are
    currently in use) then the thread joins a waitqueue. It will sleep until
    a frame is freed by another thread in the process.

    Since we now know whether a thread has an allocated frame due to our
    tracking of its index, the cookie field of struct emuframe is removed as
    we can be more certain whether we have a valid frame. Since a thread may
    only ever have a single frame at any given time, the epc field of struct
    emuframe is also removed & the PC to continue from is instead stored in
    struct thread_struct. Together these changes simplify & shrink struct
    emuframe somewhat, allowing twice as many frames to fit into the page
    allocated for them.

    The primary benefit of this patch is that we are now free to mark the
    user stack non-executable where that is possible.

    Signed-off-by: Paul Burton
    Cc: Leonid Yegoshin
    Cc: Maciej Rozycki
    Cc: Faraz Shahbazker
    Cc: Raghu Gandham
    Cc: Matthew Fortune
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13764/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • debugfs_create_file returns NULL on error so an IS_ERR test is
    incorrect here and a NULL check is required.

    The Coccinelle semantic patch used to make this change is as follows:
    @@
    expression e;
    @@

    e = debugfs_create_file(...);
    if(
    - IS_ERR(e)
    + !e
    )
    {

    }

    Signed-off-by: Amitoj Kaur Chawla
    Cc: julia.lawall@lip6.fr
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13834/
    Signed-off-by: Ralf Baechle

    Amitoj Kaur Chawla
     
  • Conflicts:
    drivers/nvme/host/pci.c

    Bjorn Helgaas
     
  • We are now able to support KVM T&E with MIPS32 guests on some MIPS64r2
    and MIPS64r6 hosts, so select HAVE_KVM so it can be enabled.

    Signed-off-by: James Hogan
    Cc: Ralf Baechle
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    James Hogan
     
  • KVM sometimes flushes host TLB entries, reading each one to check if it
    corresponds to a guest KSeg0 address. In the absence of EntryHi.EHInv
    bits to invalidate the whole entry, the entries will be set to unique
    virtual addresses in KSeg0 (which is not TLB mapped), spaced 2*PAGE_SIZE
    apart.

    The TLB read however will clobber the CP0_PageMask register with
    whatever page size that TLB entry had, and that same page size will be
    written back into the TLB entry along with the unique address.

    This would cause breakage when transparent huge pages are enabled on
    64-bit host kernels, since huge page entries will overlap other nearby
    entries when separated by only 2*PAGE_SIZE, causing a machine check
    exception.

    Fix this by restoring the old CP0_PageMask value (which should be set to
    the normal page size) after reading the TLB entry if we're going to go
    ahead and invalidate it.

    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    James Hogan
     
  • kvm_mips_trans_replace() passes a pointer to KVM_GUEST_KSEGX(). This
    breaks on 64-bit builds due to the cast of that 64-bit pointer to a
    different sized 32-bit int. Cast the pointer argument to an unsigned
    long to work around the warning.

    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    James Hogan
     
  • When emulating MFC0 instructions to load 32-bit values from guest COP0
    registers and the RDHWR instruction to read the CC (Count) register,
    sign extend the result to comply with the MIPS64 architecture. The
    result must be in canonical 32-bit form or the guest may malfunction.

    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    James Hogan
     
  • The MFC0 and MTC0 instructions in the guest which cause traps can be
    replaced with 32-bit loads and stores to the commpage, however on big
    endian 64-bit builds the offset needs to have 4 added so as to
    load/store the least significant half of the long instead of the most
    significant half.

    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    James Hogan
     
  • Fail if the address of the allocated exception base doesn't fit into the
    CP0_EBase register. This can happen on MIPS64 if CP0_EBase.WG isn't
    implemented but RAM is available outside of the range of KSeg0.

    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    James Hogan
     
  • Update the KVM entry point to write CP0_EBase as a 64-bit register when
    it is 64-bits wide, and to set the WG (write gate) bit if it exists in
    order to write bits 63:30 (or 31:30 on MIPS32).

    Prior to MIPS64r6 it was UNDEFINED to perform a 64-bit read or write of
    a 32-bit COP0 register. Since this is dynamically generated code,
    generate the right type of access depending on whether the kernel is
    64-bit and cpu_has_ebase_wg.

    Signed-off-by: James Hogan
    Cc: Paolo Bonzini
    Cc: "Radim Krčmář"
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    James Hogan