* Re: [PATCH, net] ibmvnic: fix firmware version when no firmware level has been provided by the VIOS server
From: Desnes Augusto Nunes do Rosário @ 2018-02-02 14:37 UTC (permalink / raw)
To: Tyrel Datwyler, netdev; +Cc: tlfalcon, linuxppc-dev, nfont, jallen
In-Reply-To: <e82c4a78-37b3-afc5-6250-8ce8bb2ec5ce@linux.vnet.ibm.com>
Hello Tyrel,
I concur with your observations, but since this patch has already been
merged, I'll address them in another patch.
Thank you for your review,
On 02/01/2018 07:02 PM, Tyrel Datwyler wrote:
> On 02/01/2018 10:04 AM, Desnes Augusto Nunes do Rosario wrote:
>> Older versions of VIOS servers do not send the firmware level in the VPD
>> buffer for the ibmvnic driver. Thus, not only the current message is mis-
>> leading but the firmware version in the ethtool will be NULL. Therefore,
>> this patch fixes the firmware string and its warning.
>>
>> Fixes: 4e6759be28e4 ("ibmvnic: Feature implementation of VPD for the ibmvnic driver")
>>
>> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
>> ---
>> drivers/net/ethernet/ibm/ibmvnic.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
>> index b65f5f3ac034..2b3e71b63a7a 100644
>> --- a/drivers/net/ethernet/ibm/ibmvnic.c
>> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
>> @@ -3290,7 +3290,11 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
>> */
>> substr = strnstr(adapter->vpd->buff, "RM", adapter->vpd->len);
>> if (!substr) {
>> - dev_info(dev, "No FW level provided by VPD\n");
>> + dev_info(dev, "Warning - No FW level has been provided in the VPD buffer by the VIOS Server\n");
>> + ptr = strncpy((char *)adapter->fw_version, "N/A",
>
> Is "N/A" the right thing to report? Would something like "Unknown" or "Unreported" be better?
>
>> + 3 * sizeof(char));
>> + if (!ptr)
>> + dev_err(dev, "Failed to inform that firmware version is unavailable to the adapter\n");
>
> The sentence structure here seems awkward. I would probably just get rid of this error and this one later in the function.
>
> dev_err(dev, "Failed to isolate FW level string\n");
>
> Instead just check and report if adapter->fw_version == NULL in the complete: label section.
>
> -Tyrel
>
>> goto complete;
>> }
>>
>
--
Desnes Augusto Nunes do Rosário
------------------------------------------
Linux Developer - IBM / Brazil
M.Sc. in Electrical and Computer Engineering - UFRN
^ permalink raw reply
* Re: [PATCH, net] ibmvnic: fix firmware version when no firmware level has been provided by the VIOS server
From: Desnes Augusto Nunes do Rosário @ 2018-02-02 14:34 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linuxppc-dev, tlfalcon, jallen, nfont
In-Reply-To: <20180201.145935.1511421104143236233.davem@davemloft.net>
Hello David,
Thank you for your review and the heads up about protocol.
On 02/01/2018 05:59 PM, David Miller wrote:
> From: Desnes Augusto Nunes do Rosario <desnesn@linux.vnet.ibm.com>
> Date: Thu, 1 Feb 2018 16:04:30 -0200
>
>> Older versions of VIOS servers do not send the firmware level in the VPD
>> buffer for the ibmvnic driver. Thus, not only the current message is mis-
>> leading but the firmware version in the ethtool will be NULL. Therefore,
>> this patch fixes the firmware string and its warning.
>>
>> Fixes: 4e6759be28e4 ("ibmvnic: Feature implementation of VPD for the ibmvnic driver")
>>
>> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
>
> Applied.
>
> Please do not put empty lines between Fixes: and Signed-off-by: and other
> tags, all tags are equal and are placed together in an uninterrupted
> sequences of consequetive lines.
>
> Thank you.
>
--
Desnes Augusto Nunes do Rosário
------------------------------------------
Linux Developer - IBM / Brazil
M.Sc. in Electrical and Computer Engineering - UFRN
^ permalink raw reply
* [GIT PULL] Please pull powerpc/linux.git powerpc-4.16-1 tag
From: Michael Ellerman @ 2018-02-02 13:42 UTC (permalink / raw)
To: Linus Torvalds
Cc: aik, amodra, andrew.donnellan, aneesh.kumar, anju, anton, arnd,
bauerman, benh, bhaktipriya96, bhelgaas, bryantly, bsingharora,
christophe.leroy, clombard, cyrilbur, daniel.thompson, david,
dmitry.torokhov, fbarrat, geert+renesas, geoff, gomonovych,
gpiccoli, gromero, gustavo, ivan, jk, joakim.tjernlund, joe,
jpoimboe, jsperbeck, julia, kamalesh, khandual, leoyang.li,
linux-kernel, linuxppc-dev, linuxram, maddy, mahesh, malat, mwb,
naveen.n.rao, nfont, npiggin, oss, paulus, robh, ruscur, santosh,
schwab, stewart, sukadev, tj, wei.guo.simon, gregkh,
dan.j.williams, bhelgaas
[-- Attachment #1: Type: text/plain, Size: 38169 bytes --]
Hi Linus,
Please pull powerpc updates for 4.16.
We've added a new driver in drivers/misc, which Greg was OK for us to
merge via powerpc, though it has still resulted in a trivial
conflict in the Makefile and Kconfig.
There's also a conflict with the nvdimm tree, which you haven't merged
yet AFIACS, but also trivial (just take our deletion), and Dan is aware
of it.
And there's one change to non-powerpc PCI code, in aerdrv_core.c, which
was acked by Bjorn.
cheers
The following changes since commit ae64f9bd1d3621b5e60d7363bc20afb46aede215:
Linux 4.15-rc2 (2017-12-03 11:01:47 -0500)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-4.16-1
for you to fetch changes up to 015eb1b89e959c9349f0a01803fb8ed1ced36f09:
powerpc/mm/radix: Fix build error when RADIX_MMU=n (2018-01-30 20:41:30 +1100)
----------------------------------------------------------------
powerpc updates for 4.16
Highlights:
- Enable support for memory protection keys aka "pkeys" on Power7/8/9 when
using the hash table MMU.
- Extend our interrupt soft masking to support masking PMU interrupts as well
as "normal" interrupts, and then use that to implement local_t for a ~4x
speedup vs the current atomics-based implementation.
- A new driver "ocxl" for "Open Coherent Accelerator Processor Interface
(OpenCAPI)" devices.
- Support for new device tree properties on PowerVM to describe hotpluggable
memory and devices.
- Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE to the 64-bit VDSO.
- Freescale updates from Scott:
"Contains fixes for CPM GPIO and an FSL PCI erratum workaround, plus a
minor cleanup patch."
As well as quite a lot of other changes all over the place, and small fixes and
cleanups as always.
Thanks to:
Alan Modra, Alastair D'Silva, Alexey Kardashevskiy, Alistair Popple, Andreas
Schwab, Andrew Donnellan, Aneesh Kumar K.V, Anju T Sudhakar, Anshuman
Khandual, Anton Blanchard, Arnd Bergmann, Balbir Singh, Benjamin
Herrenschmidt, Bhaktipriya Shridhar, Bryant G. Ly, Cédric Le Goater,
Christophe Leroy, Christophe Lombard, Cyril Bur, David Gibson, Desnes A. Nunes
do Rosario, Dmitry Torokhov, Frederic Barrat, Geert Uytterhoeven, Guilherme G.
Piccoli, Gustavo A. R. Silva, Gustavo Romero, Ivan Mikhaylov, Joakim
Tjernlund, Joe Perches, Josh Poimboeuf, Juan J. Alvarez, Julia Cartwright,
Kamalesh Babulal, Madhavan Srinivasan, Mahesh Salgaonkar, Mathieu Malaterre,
Michael Bringmann, Michael Hanselmann, Michael Neuling, Nathan Fontenot,
Naveen N. Rao, Nicholas Piggin, Paul Mackerras, Philippe Bergheaud, Ram Pai,
Russell Currey, Santosh Sivaraj, Scott Wood, Seth Forshee, Simon Guo, Stewart
Smith, Sukadev Bhattiprolu, Thiago Jung Bauermann, Vaibhav Jain, Vasyl
Gomonovych.
----------------------------------------------------------------
Alan Modra (1):
powerpc/modules: Fix alignment of .toc section in kernel modules
Alexey Kardashevskiy (2):
powerpc/powernv/ioda: Finish removing explicit max window size check
powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn
Andreas Schwab (1):
macintosh/adb: Properly mark continued kernel messages
Andrew Donnellan (2):
selftests/powerpc: Add alignment handler selftest
powerpc/powernv: Set correct configuration space size for opencapi devices
Aneesh Kumar K.V (6):
powerpc/mm/hugetlb: Use pte_access_permitted for hugetlb access check
powerpc/mm/book3s/64: Add proper pte access check helper
powerpc/mm: Add proper pte access check helper for other platforms
powerpc/mm: Remove unused flag arg in global_invalidates
powerpc/hash: Skip non initialized page size in init_hpte_page_sizes
selftest/powerpc: Add additional option to mmap_bench test
Anju T Sudhakar (5):
powerpc/perf: Remove thread_imc_pmu global variable from
powerpc/perf: IMC code cleanup with some code refactoring
powerpc/perf: Pass struct imc_events as a parameter to imc_parse_event()
powerpc/powernv: Add debugfs interface for imc-mode and imc-command
powerpc/perf: Change the data type for the variable 'ncpu' in IMC code
Anshuman Khandual (1):
powerpc/mm: Invalidate subpage_prot() system call on radix platforms
Anton Blanchard (1):
powerpc: Expose TSCR via sysfs
Arnd Bergmann (2):
powerpc/mpic_timer: avoid struct timeval
powerpc/spufs: use timespec64 for timestamps
Balbir Singh (2):
powerpc/crash: Remove the test for cpu_online in the IPI callback
powernv/kdump: Fix cases where the kdump kernel can get HMI's
Benjamin Herrenschmidt (10):
powerpc: Remove DEBUG define in 64-bit early setup code
powerpc: Reduce log level of "OPAL detected !" message
powerpc/xive: Move definition of ESB bits
powerpc/xive: Add interrupt flag to disable automatic EOI
powerpc: Add aacraid and nvme to powernv_defconfig
powerpc: Make newline in cpuinfo unconditional
powerpc: Cosmetic cleanup of cpuinfo_op
powerpc/xive: Remove incorrect debug code
powerpc: Remove useless EXC_COMMON_HV
powerpc: Use the TRAP macro whenever comparing a trap number
Bhaktipriya Shridhar (1):
ps3: Remove deprecated create_singlethread_workqueue
Bryant G. Ly (10):
powerpc/pci: Separate SR-IOV Calls
powerpc/pseries: Add pseries SR-IOV Machine dependent calls
PCI/IOV: Add pci_vf_drivers_autoprobe() interface
powerpc/eeh: Update VF config space after EEH
PCI/AER: Add uevents in AER and EEH error/resume
powerpc/pseries: Set eeh_pe of EEH_PE_VF type
powerpc/eeh: Add EEH operations to notify resume
powerpc/eeh: Add EEH notify resume sysfs
powerpc/pseries/pci: Associate PEs to VFs in configure SR-IOV
powerpc/pseries: Add Initialization of VF Bars
Christophe Leroy (15):
powerpc/32s: Fix compile error with CONFIG_PPC_PTDUMP
powerpc/8xx: do not select CONFIG_PPC_LIB_RHEAP
powerpc/8xx: Remove CPU6 ERRATA Workaround
powerpc/8xx: remove EXCEPTION_PROLOG/EPILOG_0 and change r3 to r12
powerpc/8xx: Only perform perf counting when perf is in use.
powerpc/8xx: remove unused _PAGE_WRITETHRU
powerpc/mm: extend _PAGE_PRIVILEGED to all CPUs
powerpc/mm: Introduce _PAGE_NA
powerpc/8xx: Remove _PAGE_USER and handle user access at PMD level
powerpc/8xx: Use L1 entry APG to handle _PAGE_ACCESSED for CONFIG_SWAP
powerpc: restore alphabetic order in Kconfig
powerpc/lib/code-patching: refactor patch_instruction()
powerpc/lib/feature-fixups: use raw_patch_instruction()
powerpc/sysdev: change CPM GPIO to platform_device
powerpc/mm/nohash: do not flush the entire mm when range is a single page
Christophe Lombard (1):
cxl: Add support for ASB_Notify on POWER9
Cyril Bur (1):
selftests/powerpc: Check for pthread errors in tm-unavailable
David Gibson (1):
powerpc/pseries: Don't give a warning when HPT resizing isn't available
Dmitry Torokhov (4):
powerpc/powermac: fix OF node refcount leak
powerpc/powermac: drop useless call to of_find_node_by_name
powerpc: Use of for_each_node_by_name() instead of open-coding it
powerpc: make use of for_each_node_by_type() instead of open-coding it
Frederic Barrat (12):
powerpc/powernv: Introduce new PHB type for opencapi links
powerpc/powernv: Add opal calls for opencapi
powerpc/powernv: Add platform-specific services for opencapi
powerpc/powernv: Capture actag information for the device
ocxl: Driver code for 'generic' opencapi devices
ocxl: Add AFU interrupt support
ocxl: Add a kernel API for other opencapi drivers
ocxl: Add trace points
ocxl: Add Makefile and Kconfig
cxl: Remove support for "Processing accelerators" class
ocxl: Documentation
ocxl: add MAINTAINERS entry
Geert Uytterhoeven (1):
dt: booting-without-of: DT fix s/#interrupt-cell/#interrupt-cells/
Guilherme G. Piccoli (1):
powerpc/powernv: Add ppc_pci_reset_phbs parameter to issue a PHB reset
Gustavo A. R. Silva (2):
macintosh: change some data types from int to bool
macintosh/ams-input: Use true and false for boolean values
Gustavo Romero (2):
powerpc/tm: Fix endianness flip on trap
powerpc/selftests: Check endianness on trap in TM
Ivan Mikhaylov (4):
powerpc/44x/fsp2: Add fsp2 headers
powerpc/44x/fsp2: Interrupt handling setup
powerpc/44x/fsp2: tvsense workaround for dd1
powerpc/44x/fsp2: Add irq error handlers
Joakim Tjernlund (1):
powerpc/fsl_pci: Correct fsl_pci_mcheck_exception
Joe Perches (1):
powerpc: Use pr_warn instead of pr_warning
Josh Poimboeuf (2):
powerpc/modules: Don't try to restore r2 after a sibling call
powerpc/modules: Improve restore_r2() error message
Julia Cartwright (1):
powerpc/mpc52xx_gpt: make use of raw_spinlock variants
Kamalesh Babulal (1):
powerpc/modules: Add REL24 relocation support of livepatch symbols
Madhavan Srinivasan (16):
powerpc: Hard wire PT_SOFTE value to 1 in ptrace & signals
powerpc/64: Add #defines for paca->soft_enabled flags
powerpc/64: Fix arch_local_irq_disable() prototype
powerpc/64: Move set_soft_enabled() and rename
powerpc/64: Implement and use soft_enabled_return API
powerpc/64: Implement and use soft_enabled_set_return API
powerpc/64: Cleanup hard_irq_disable() macro
powerpc/64: Change soft_enabled from flag to bitmask
powerpc/64: Rename soft_enabled to irq_soft_mask
powerpc/64s: Avoid using EXCEPTION_PROLOG_1 macro in MASKABLE_*
powerpc/64s: Add support to take additional parameter in MASKABLE_* macro
powerpc/64s: Add support to mask perf interrupts and replay them
powerpc: Add new kconfig CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
powerpc/64s: Add new set of irq_soft_mask_ functions for PMI masking
powerpc: use generic atomic implementation for local_t
powerpc/64s: Implement local_t using irq soft masking
Mahesh Salgaonkar (1):
powerpc/radix: Remove trace_tlbie call from radix__flush_tlb_all
Mathieu Malaterre (5):
powerpc/xive: Properly use static keyword for inline function
powerpc/xmon: Do not compute/store the major opcode
powerpc: Fix old-style function definition
backlight: Fix old-style function definition
powerpc/boot/dts: Remove leading 0x and 0s from bindings notation
Michael Bringmann (7):
powerpc/firmware: Add definitions for new drc-info firmware feature
pseries/drc-info: Search DRC properties for CPU indexes
hotplug/drc-info: Add code to search ibm,drc-info property
powerpc: Enable support for ibm,drc-info devtree property
powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes
powerpc/numa: Ensure nodes initialized for hotplug
powerpc/pseries: Fix cpu hotplug crash with memoryless nodes
Michael Ellerman (13):
powerpc/boot: Only build uartlite if XILINX_VIRTEX=y
powerpc/boot: Only build OPAL code when necessary
powerpc/boot: Only build CPM code when necessary
selftests/powerpc: Add a test of SEGV error behaviour
powerpc/64s: Fix ps3 build error due to tlbiel_all()
Merge branch 'topic/ppc-kvm' into next
Merge branch 'fixes' into next
Merge branch 'next' of https://git.kernel.org/.../scottwood/linux into next
powerpc/cell: Remove axonram driver
powerpc/watchdog: Tweak watchdog printks
powerpc/watchdog: regs can't be null in soft_nmi_interrupt()
powerpc/watchdog: Print the NIP in soft_nmi_interrupt()
powerpc/mm/radix: Fix build error when RADIX_MMU=n
Nathan Fontenot (9):
powerpc/numa: Look up device node in of_get_assoc_arrays()
powerpc/numa: Look up device node in of_get_usable_memory()
powerpc/numa: Look up associativity array in of_drconf_to_nid_single
powerpc/mm: Separate ibm, dynamic-memory data from DT format
powerpc/numa: Update numa code use walk_drmem_lmbs
powerpc/pseries: Update memory hotplug code to use drmem LMB array
powerpc: Move of_drconf_cell struct to asm/drmem.h
powerpc/drmem: Add support for ibm, dynamic-memory-v2 property
powerpc/pseries: Enable support of ibm,dynamic-memory-v2
Nicholas Piggin (19):
powerpc/32: Add .data.rel* sections explicitly
powerpc/64: Don't trace irqs-off at interrupt return to soft-disabled context
powerpc: System reset avoid interleaving oops using die synchronisation
powerpc/64s: Improve local TLB flush for boot and MCE on POWER9
powerpc/powernv: Remove real mode access limit for early allocations
powerpc/pseries: radix is not subject to RMA limit, remove it
powerpc/64: rtas avoid accessing paca in 32-bit mode
powerpc/pseries: lift RTAS limit for radix
powerpc/pseries: lift RTAS limit for hash
powerpc/64s: Relax PACA address limitations
powerpc/watchdog: remove arch_trigger_cpumask_backtrace
powerpc: define __ARCH_IRQ_EXIT_IRQS_DISABLED
cpuidle/powernv: avoid double irq enable coming out of idle
cpuidle/powernv: avoid double irq enable coming out of idle
powerpc/pseries/cpuidle: add polling idle for shared processor guests
powerpc/64: Improve inline asm in arch_local_irq_disable
powerpc/watchdog: improve watchdog comments
powerpc/pseries, ps3: panic flush kernel messages before halting system
powerpc/64s: Improve RFI L1-D cache flush fallback
Paul Mackerras (1):
KVM: PPC: Book3S HV: Improve handling of debug-trigger HMIs on POWER9
Ram Pai (30):
powerpc: introduce pte_set_hidx() helper
powerpc: introduce pte_get_hash_gslot() helper
powerpc: Free up four 64K PTE bits in 4K backed HPTE pages
powerpc: Free up four 64K PTE bits in 64K backed HPTE pages
powerpc: shifted-by-one hidx value
powerpc: Swizzle around 4K PTE bits to free up bit 5 and bit 6
powerpc: use helper functions to get and set hash slots
powerpc: capture the PTE format changes in the dump pte report
powerpc: initial pkey plumbing
powerpc: track allocation status of all pkeys
powerpc: helper function to read, write AMR, IAMR, UAMOR registers
powerpc: helper functions to initialize AMR, IAMR and UAMOR registers
powerpc: cleanup AMR, IAMR when a key is allocated or freed
powerpc: implementation for arch_set_user_pkey_access()
powerpc: ability to create execute-disabled pkeys
powerpc: store and restore the pkey state across context switches
powerpc: introduce execute-only pkey
powerpc: ability to associate pkey to a vma
powerpc: implementation for arch_override_mprotect_pkey()
powerpc: map vma key-protection bits to pte key bits.
powerpc: Program HPTE key protection bits
powerpc: helper to validate key-access permissions of a pte
powerpc: check key protection for user page access
powerpc: implementation for arch_vma_access_permitted()
powerpc: Handle exceptions caused by pkey violation
powerpc: introduce get_mm_addr_key() helper
powerpc: Deliver SEGV signal on pkey violation
powerpc: Enable pkey subsystem
powerpc: sys_pkey_alloc() and sys_pkey_free() system calls
powerpc: sys_pkey_mprotect() system call
Russell Currey (1):
powerpc: Use octal numbers for file permissions
Santosh Sivaraj (1):
powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE
Simon Guo (1):
selftests/powerpc: Fix build errors in powerpc ptrace selftests
Stewart Smith (1):
rtc-opal: Fix handling of firmware error codes, prevent busy loops
Sukadev Bhattiprolu (1):
powerpc/kernel: Block interrupts when updating TIDR
Thiago Jung Bauermann (1):
powerpc/ptrace: Add memory protection key regset
Vasyl Gomonovych (1):
powerpc/fsl_pci: Fix ptr_ret.cocci warnings
Documentation/ABI/testing/sysfs-class-ocxl | 35 +
Documentation/accelerators/ocxl.rst | 160 +++++
Documentation/devicetree/booting-without-of.txt | 2 +-
Documentation/filesystems/dax.txt | 1 -
Documentation/ioctl/ioctl-number.txt | 1 +
MAINTAINERS | 12 +
arch/powerpc/Kconfig | 19 +-
arch/powerpc/Kconfig.debug | 6 +-
arch/powerpc/Makefile | 1 +
arch/powerpc/boot/Makefile | 8 +-
arch/powerpc/boot/dts/a3m071.dts | 10 +-
arch/powerpc/boot/dts/akebono.dts | 4 +-
arch/powerpc/boot/dts/c2k.dts | 6 +-
arch/powerpc/boot/dts/currituck.dts | 2 +-
arch/powerpc/boot/dts/fsl/mpc8568mds.dts | 12 +-
arch/powerpc/boot/dts/fsl/mpc8569mds.dts | 20 +-
arch/powerpc/boot/dts/fsl/p1021mds.dts | 6 +-
arch/powerpc/boot/dts/fsl/p1025rdb.dtsi | 8 +-
arch/powerpc/boot/dts/fsl/p1025rdb_32b.dts | 2 +-
arch/powerpc/boot/dts/fsl/p1025twr.dtsi | 8 +-
arch/powerpc/boot/dts/fsl/t1040rdb.dts | 2 +-
arch/powerpc/boot/dts/fsl/t1042d4rdb.dts | 10 +-
arch/powerpc/boot/dts/fsl/t1042rdb.dts | 2 +-
arch/powerpc/boot/dts/fsl/t104xrdb.dtsi | 6 +-
arch/powerpc/boot/dts/fsp2.dts | 6 +-
arch/powerpc/boot/dts/gamecube.dts | 14 +-
arch/powerpc/boot/dts/haleakala.dts | 2 +-
arch/powerpc/boot/dts/kilauea.dts | 4 +-
arch/powerpc/boot/dts/kmeter1.dts | 10 +-
arch/powerpc/boot/dts/makalu.dts | 4 +-
arch/powerpc/boot/dts/mpc832x_mds.dts | 10 +-
arch/powerpc/boot/dts/mpc832x_rdb.dts | 8 +-
arch/powerpc/boot/dts/mpc836x_mds.dts | 8 +-
arch/powerpc/boot/dts/sbc8548-altflash.dts | 8 +-
arch/powerpc/boot/dts/sbc8548.dts | 8 +-
arch/powerpc/boot/dts/wii.dts | 32 +-
arch/powerpc/boot/serial.c | 6 +
arch/powerpc/configs/mpc866_ads_defconfig | 1 -
arch/powerpc/configs/powernv_defconfig | 2 +
arch/powerpc/include/asm/book3s/32/pgtable.h | 23 +
arch/powerpc/include/asm/book3s/64/hash-4k.h | 20 +
arch/powerpc/include/asm/book3s/64/hash-64k.h | 71 +-
arch/powerpc/include/asm/book3s/64/hash.h | 8 +-
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 5 +
arch/powerpc/include/asm/book3s/64/mmu.h | 10 +
arch/powerpc/include/asm/book3s/64/pgtable.h | 79 ++-
arch/powerpc/include/asm/book3s/64/tlbflush-hash.h | 1 +
.../powerpc/include/asm/book3s/64/tlbflush-radix.h | 7 +
arch/powerpc/include/asm/book3s/64/tlbflush.h | 38 ++
arch/powerpc/include/asm/bug.h | 4 +-
arch/powerpc/include/asm/code-patching.h | 2 +
arch/powerpc/include/asm/cpm.h | 2 +-
arch/powerpc/include/asm/cpm1.h | 2 +
arch/powerpc/include/asm/cputable.h | 21 +-
arch/powerpc/include/asm/drmem.h | 102 +++
arch/powerpc/include/asm/eeh.h | 2 +
arch/powerpc/include/asm/exception-64s.h | 103 +--
arch/powerpc/include/asm/firmware.h | 5 +-
arch/powerpc/include/asm/hardirq.h | 1 +
arch/powerpc/include/asm/head-64.h | 47 +-
arch/powerpc/include/asm/hmi.h | 4 +
arch/powerpc/include/asm/hugetlb.h | 3 +-
arch/powerpc/include/asm/hw_irq.h | 161 ++++-
arch/powerpc/include/asm/imc-pmu.h | 9 +-
arch/powerpc/include/asm/irqflags.h | 14 +-
arch/powerpc/include/asm/kexec.h | 2 +
arch/powerpc/include/asm/kvm_ppc.h | 2 +-
arch/powerpc/include/asm/local.h | 200 +++---
arch/powerpc/include/asm/machdep.h | 8 +
arch/powerpc/include/asm/mman.h | 13 +-
arch/powerpc/include/asm/mmu-8xx.h | 60 +-
arch/powerpc/include/asm/mmu.h | 9 +
arch/powerpc/include/asm/mmu_context.h | 22 +
arch/powerpc/include/asm/mpic_timer.h | 8 +-
arch/powerpc/include/asm/nmi.h | 4 -
arch/powerpc/include/asm/nohash/32/pgalloc.h | 3 +-
arch/powerpc/include/asm/nohash/32/pgtable.h | 2 +-
arch/powerpc/include/asm/nohash/32/pte-8xx.h | 25 +-
arch/powerpc/include/asm/nohash/pgtable.h | 27 +-
arch/powerpc/include/asm/nohash/pte-book3e.h | 1 +
arch/powerpc/include/asm/opal-api.h | 5 +-
arch/powerpc/include/asm/opal.h | 6 +
arch/powerpc/include/asm/paca.h | 5 +-
arch/powerpc/include/asm/pci-bridge.h | 9 +-
arch/powerpc/include/asm/pci.h | 2 +
arch/powerpc/include/asm/pkeys.h | 218 +++++++
arch/powerpc/include/asm/pnv-ocxl.h | 36 +
arch/powerpc/include/asm/ppc-opcode.h | 2 +
arch/powerpc/include/asm/processor.h | 5 +
arch/powerpc/include/asm/prom.h | 27 +-
arch/powerpc/include/asm/pte-common.h | 37 +-
arch/powerpc/include/asm/reg.h | 6 +-
arch/powerpc/include/asm/reg_8xx.h | 82 ---
arch/powerpc/include/asm/systbl.h | 3 +
arch/powerpc/include/asm/unistd.h | 6 +-
arch/powerpc/include/asm/xive-regs.h | 35 +
arch/powerpc/include/asm/xive.h | 40 +-
arch/powerpc/include/uapi/asm/elf.h | 1 +
arch/powerpc/include/uapi/asm/mman.h | 6 +
arch/powerpc/include/uapi/asm/unistd.h | 3 +
arch/powerpc/kernel/asm-offsets.c | 7 +-
arch/powerpc/kernel/cpu_setup_power.S | 50 --
arch/powerpc/kernel/cputable.c | 15 -
arch/powerpc/kernel/crash.c | 16 +-
arch/powerpc/kernel/dt_cpu_ftrs.c | 30 -
arch/powerpc/kernel/eeh.c | 59 ++
arch/powerpc/kernel/eeh_driver.c | 10 +-
arch/powerpc/kernel/eeh_sysfs.c | 64 +-
arch/powerpc/kernel/entry_32.S | 10 +-
arch/powerpc/kernel/entry_64.S | 67 +-
arch/powerpc/kernel/exceptions-64e.S | 20 +-
arch/powerpc/kernel/exceptions-64s.S | 118 ++--
arch/powerpc/kernel/head_64.S | 11 +-
arch/powerpc/kernel/head_8xx.S | 275 ++++----
arch/powerpc/kernel/idle_book3e.S | 5 +-
arch/powerpc/kernel/idle_power4.S | 5 +-
arch/powerpc/kernel/irq.c | 29 +-
arch/powerpc/kernel/mce.c | 142 +++-
arch/powerpc/kernel/mce_power.c | 115 +---
arch/powerpc/kernel/module.lds | 8 +
arch/powerpc/kernel/module_64.c | 35 +-
arch/powerpc/kernel/optprobes_head.S | 2 +-
arch/powerpc/kernel/paca.c | 13 +-
arch/powerpc/kernel/pci-common.c | 27 +-
arch/powerpc/kernel/pci_dn.c | 6 -
arch/powerpc/kernel/pci_of_scan.c | 2 +-
arch/powerpc/kernel/proc_powerpc.c | 2 +-
arch/powerpc/kernel/process.c | 28 +-
arch/powerpc/kernel/prom.c | 115 ++--
arch/powerpc/kernel/prom_init.c | 2 +
arch/powerpc/kernel/ptrace.c | 78 +++
arch/powerpc/kernel/rtas-proc.c | 14 +-
arch/powerpc/kernel/rtas_flash.c | 2 +-
arch/powerpc/kernel/rtasd.c | 2 +-
arch/powerpc/kernel/setup-common.c | 21 +-
arch/powerpc/kernel/setup.h | 4 +
arch/powerpc/kernel/setup_64.c | 48 +-
arch/powerpc/kernel/signal_32.c | 8 +
arch/powerpc/kernel/signal_64.c | 11 +-
arch/powerpc/kernel/smp.c | 18 +
arch/powerpc/kernel/sysfs.c | 8 +
arch/powerpc/kernel/time.c | 6 +-
arch/powerpc/kernel/traps.c | 51 +-
arch/powerpc/kernel/vdso64/gettimeofday.S | 67 +-
arch/powerpc/kernel/vmlinux.lds.S | 1 +
arch/powerpc/kernel/watchdog.c | 100 ++-
arch/powerpc/kvm/book3s_hv.c | 10 +-
arch/powerpc/kvm/book3s_hv_ras.c | 14 +-
arch/powerpc/kvm/book3s_hv_rm_mmu.c | 9 +-
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 11 +-
arch/powerpc/kvm/book3s_xics.c | 2 +-
arch/powerpc/lib/code-patching.c | 37 +-
arch/powerpc/lib/feature-fixups.c | 8 +-
arch/powerpc/mm/8xx_mmu.c | 4 +-
arch/powerpc/mm/Makefile | 3 +-
arch/powerpc/mm/drmem.c | 439 +++++++++++++
arch/powerpc/mm/dump_linuxpagetables.c | 32 +-
arch/powerpc/mm/fault.c | 53 +-
arch/powerpc/mm/hash64_4k.c | 14 +-
arch/powerpc/mm/hash64_64k.c | 123 ++--
arch/powerpc/mm/hash_native_64.c | 97 +++
arch/powerpc/mm/hash_utils_64.c | 97 ++-
arch/powerpc/mm/hugetlbpage-hash64.c | 16 +-
arch/powerpc/mm/hugetlbpage.c | 8 +-
arch/powerpc/mm/init_64.c | 5 +-
arch/powerpc/mm/mem.c | 3 +-
arch/powerpc/mm/mmu_context_book3s64.c | 2 +
arch/powerpc/mm/numa.c | 333 ++++------
arch/powerpc/mm/pgtable-radix.c | 23 +-
arch/powerpc/mm/pgtable.c | 3 +-
arch/powerpc/mm/pgtable_32.c | 9 +-
arch/powerpc/mm/pgtable_64.c | 14 +-
arch/powerpc/mm/pkeys.c | 468 +++++++++++++
arch/powerpc/mm/subpage-prot.c | 3 +
arch/powerpc/mm/tlb-radix.c | 68 +-
arch/powerpc/mm/tlb_nohash.c | 5 +-
arch/powerpc/perf/8xx-pmu.c | 52 +-
arch/powerpc/perf/Makefile | 2 +-
arch/powerpc/perf/core-book3s.c | 2 +-
arch/powerpc/perf/imc-pmu.c | 102 +--
arch/powerpc/platforms/44x/fsp2.c | 259 +++++++-
arch/powerpc/platforms/44x/fsp2.h | 272 ++++++++
arch/powerpc/platforms/512x/mpc512x_shared.c | 4 +-
arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 52 +-
arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 2 +-
arch/powerpc/platforms/83xx/mpc832x_mds.c | 2 +-
arch/powerpc/platforms/83xx/mpc832x_rdb.c | 2 +-
arch/powerpc/platforms/83xx/mpc836x_mds.c | 2 +-
arch/powerpc/platforms/85xx/socrates_fpga_pic.c | 7 +-
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 2 +-
arch/powerpc/platforms/8xx/Kconfig | 12 -
arch/powerpc/platforms/Kconfig | 11 -
arch/powerpc/platforms/Kconfig.cputype | 8 -
arch/powerpc/platforms/cell/interrupt.c | 3 +-
arch/powerpc/platforms/cell/setup.c | 3 +-
arch/powerpc/platforms/cell/spider-pic.c | 3 +-
arch/powerpc/platforms/cell/spu_manage.c | 4 +-
arch/powerpc/platforms/cell/spufs/file.c | 6 +-
arch/powerpc/platforms/cell/spufs/inode.c | 4 +-
arch/powerpc/platforms/cell/spufs/spufs.h | 2 +-
arch/powerpc/platforms/pasemi/dma_lib.c | 4 +-
arch/powerpc/platforms/powermac/backlight.c | 6 +-
arch/powerpc/platforms/powermac/feature.c | 3 +-
arch/powerpc/platforms/powermac/pic.c | 8 +-
arch/powerpc/platforms/powermac/smp.c | 4 +-
arch/powerpc/platforms/powernv/Makefile | 1 +
arch/powerpc/platforms/powernv/eeh-powernv.c | 101 +--
arch/powerpc/platforms/powernv/npu-dma.c | 7 +-
arch/powerpc/platforms/powernv/ocxl.c | 515 +++++++++++++++
arch/powerpc/platforms/powernv/opal-dump.c | 4 +-
arch/powerpc/platforms/powernv/opal-elog.c | 4 +-
arch/powerpc/platforms/powernv/opal-imc.c | 77 +++
arch/powerpc/platforms/powernv/opal-sysparam.c | 6 +-
arch/powerpc/platforms/powernv/opal-wrappers.S | 3 +
arch/powerpc/platforms/powernv/opal.c | 28 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 88 ++-
arch/powerpc/platforms/powernv/pci.c | 4 +
arch/powerpc/platforms/powernv/pci.h | 8 +-
arch/powerpc/platforms/powernv/smp.c | 28 +
arch/powerpc/platforms/ps3/device-init.c | 12 +-
arch/powerpc/platforms/ps3/mm.c | 4 +-
arch/powerpc/platforms/ps3/os-area.c | 2 +-
arch/powerpc/platforms/ps3/setup.c | 1 +
arch/powerpc/platforms/pseries/cmm.c | 16 +-
arch/powerpc/platforms/pseries/eeh_pseries.c | 162 ++++-
arch/powerpc/platforms/pseries/firmware.c | 2 +
arch/powerpc/platforms/pseries/hotplug-cpu.c | 3 +
arch/powerpc/platforms/pseries/hotplug-memory.c | 522 ++++++---------
arch/powerpc/platforms/pseries/hvCall_inst.c | 2 +-
arch/powerpc/platforms/pseries/ibmebus.c | 4 +-
arch/powerpc/platforms/pseries/iommu.c | 8 +-
arch/powerpc/platforms/pseries/lparcfg.c | 8 +-
arch/powerpc/platforms/pseries/mobility.c | 2 +-
arch/powerpc/platforms/pseries/of_helpers.c | 60 ++
arch/powerpc/platforms/pseries/pci.c | 177 ++++-
arch/powerpc/platforms/pseries/pseries_energy.c | 126 +++-
arch/powerpc/platforms/pseries/reconfig.c | 2 +-
arch/powerpc/platforms/pseries/scanlog.c | 2 +-
arch/powerpc/platforms/pseries/setup.c | 176 ++++-
arch/powerpc/platforms/pseries/suspend.c | 3 +-
arch/powerpc/sysdev/Makefile | 4 +-
arch/powerpc/sysdev/axonram.c | 383 -----------
arch/powerpc/sysdev/cpm1.c | 33 +-
arch/powerpc/sysdev/cpm2.c | 11 -
arch/powerpc/sysdev/cpm_common.c | 5 +-
arch/powerpc/sysdev/cpm_gpio.c | 80 +++
arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c | 16 +-
arch/powerpc/sysdev/fsl_pci.c | 14 +-
arch/powerpc/sysdev/mpic.c | 10 +-
arch/powerpc/sysdev/mpic_timer.c | 55 +-
arch/powerpc/sysdev/mv64x60_pci.c | 2 +-
arch/powerpc/sysdev/xics/icp-native.c | 10 +-
arch/powerpc/sysdev/xics/ics-opal.c | 4 +-
arch/powerpc/sysdev/xics/ics-rtas.c | 4 +-
arch/powerpc/sysdev/xics/xics-common.c | 8 +-
arch/powerpc/sysdev/xive/common.c | 8 +-
arch/powerpc/xmon/ppc-dis.c | 4 -
arch/powerpc/xmon/xmon.c | 6 +-
drivers/cpuidle/cpuidle-powernv.c | 2 +
drivers/cpuidle/cpuidle-pseries.c | 16 +-
drivers/macintosh/adb.c | 24 +-
drivers/macintosh/adbhid.c | 55 +-
drivers/macintosh/ams/ams-input.c | 4 +-
drivers/macintosh/therm_adt746x.c | 4 +-
drivers/macintosh/via-pmu-backlight.c | 2 +-
drivers/macintosh/windfarm_pm112.c | 8 +-
drivers/macintosh/windfarm_pm121.c | 5 +-
drivers/macintosh/windfarm_pm72.c | 2 +-
drivers/macintosh/windfarm_pm81.c | 5 +-
drivers/macintosh/windfarm_pm91.c | 5 +-
drivers/macintosh/windfarm_rm31.c | 2 +-
drivers/misc/Kconfig | 1 +
drivers/misc/Makefile | 1 +
drivers/misc/cxl/context.c | 2 +
drivers/misc/cxl/cxl.h | 3 +
drivers/misc/cxl/cxllib.c | 3 +-
drivers/misc/cxl/file.c | 15 +-
drivers/misc/cxl/native.c | 13 +-
drivers/misc/cxl/pci.c | 2 -
drivers/misc/ocxl/Kconfig | 31 +
drivers/misc/ocxl/Makefile | 11 +
drivers/misc/ocxl/afu_irq.c | 202 ++++++
drivers/misc/ocxl/config.c | 723 +++++++++++++++++++++
drivers/misc/ocxl/context.c | 279 ++++++++
drivers/misc/ocxl/file.c | 432 ++++++++++++
drivers/misc/ocxl/link.c | 647 ++++++++++++++++++
drivers/misc/ocxl/main.c | 33 +
drivers/misc/ocxl/ocxl_internal.h | 131 ++++
drivers/misc/ocxl/pasid.c | 107 +++
drivers/misc/ocxl/pci.c | 585 +++++++++++++++++
drivers/misc/ocxl/sysfs.c | 142 ++++
drivers/misc/ocxl/trace.c | 6 +
drivers/misc/ocxl/trace.h | 182 ++++++
drivers/pci/hotplug/rpadlpar_core.c | 13 +-
drivers/pci/hotplug/rpadlpar_sysfs.c | 3 +-
drivers/pci/hotplug/rpaphp.h | 8 +-
drivers/pci/hotplug/rpaphp_core.c | 107 ++-
drivers/pci/iov.c | 11 +
drivers/pci/pcie/aer/aerdrv_core.c | 3 +
drivers/ps3/ps3av.c | 11 +-
drivers/rtc/rtc-opal.c | 12 +-
include/linux/pci.h | 38 ++
include/misc/ocxl-config.h | 45 ++
include/misc/ocxl.h | 214 ++++++
include/uapi/linux/elf.h | 1 +
include/uapi/misc/cxl.h | 10 +-
include/uapi/misc/ocxl.h | 49 ++
tools/testing/selftests/powerpc/alignment/Makefile | 3 +-
.../powerpc/alignment/alignment_handler.c | 491 ++++++++++++++
.../selftests/powerpc/benchmarks/mmap_bench.c | 53 +-
tools/testing/selftests/powerpc/mm/.gitignore | 3 +-
tools/testing/selftests/powerpc/mm/Makefile | 2 +-
tools/testing/selftests/powerpc/mm/segv_errors.c | 78 +++
.../selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c | 4 +-
.../selftests/powerpc/ptrace/ptrace-tm-spr.c | 3 +-
.../selftests/powerpc/ptrace/ptrace-tm-vsx.c | 2 +-
tools/testing/selftests/powerpc/tm/.gitignore | 1 +
tools/testing/selftests/powerpc/tm/Makefile | 3 +-
tools/testing/selftests/powerpc/tm/tm-trap.c | 329 ++++++++++
.../testing/selftests/powerpc/tm/tm-unavailable.c | 43 +-
320 files changed, 11608 insertions(+), 3055 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-class-ocxl
create mode 100644 Documentation/accelerators/ocxl.rst
create mode 100644 arch/powerpc/include/asm/drmem.h
create mode 100644 arch/powerpc/include/asm/pkeys.h
create mode 100644 arch/powerpc/include/asm/pnv-ocxl.h
create mode 100644 arch/powerpc/kernel/module.lds
create mode 100644 arch/powerpc/mm/drmem.c
create mode 100644 arch/powerpc/mm/pkeys.c
create mode 100644 arch/powerpc/platforms/44x/fsp2.h
create mode 100644 arch/powerpc/platforms/powernv/ocxl.c
delete mode 100644 arch/powerpc/sysdev/axonram.c
create mode 100644 arch/powerpc/sysdev/cpm_gpio.c
create mode 100644 drivers/misc/ocxl/Kconfig
create mode 100644 drivers/misc/ocxl/Makefile
create mode 100644 drivers/misc/ocxl/afu_irq.c
create mode 100644 drivers/misc/ocxl/config.c
create mode 100644 drivers/misc/ocxl/context.c
create mode 100644 drivers/misc/ocxl/file.c
create mode 100644 drivers/misc/ocxl/link.c
create mode 100644 drivers/misc/ocxl/main.c
create mode 100644 drivers/misc/ocxl/ocxl_internal.h
create mode 100644 drivers/misc/ocxl/pasid.c
create mode 100644 drivers/misc/ocxl/pci.c
create mode 100644 drivers/misc/ocxl/sysfs.c
create mode 100644 drivers/misc/ocxl/trace.c
create mode 100644 drivers/misc/ocxl/trace.h
create mode 100644 include/misc/ocxl-config.h
create mode 100644 include/misc/ocxl.h
create mode 100644 include/uapi/misc/ocxl.h
create mode 100644 tools/testing/selftests/powerpc/alignment/alignment_handler.c
create mode 100644 tools/testing/selftests/powerpc/mm/segv_errors.c
create mode 100644 tools/testing/selftests/powerpc/tm/tm-trap.c
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply
* [ppc32] WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 dmam_alloc_coherent+0xd8/0x118
From: Mathieu Malaterre @ 2018-02-02 13:11 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Christoph Hellwig
Hi there,
What is this warning all about (system is Mac Mini G4) ? Thanks
[ 3.265537] pata-macio 0.00020000:ata-3: Activating pata-macio
chipset KeyLargo ATA-3, Apple bus ID 0
[ 3.272686] WARNING: CPU: 0 PID: 1 at
./include/linux/dma-mapping.h:516 dmam_alloc_coherent+0xd8/0x118
[ 3.280031] Modules linked in:
[ 3.283660] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0+ #333
[ 3.287314] NIP: c0643f5c LR: c0643ec8 CTR: 00000000
[ 3.290920] REGS: df4f1c00 TRAP: 0700 Not tainted (4.15.0+)
[ 3.294499] MSR: 00029032 <EE,ME,IR,DR,RI> CR: 28228428 XER: 20000000
[ 3.298056]
GPR00: c0643ec8 df4f1cb0 df4ee940 de15de50 00000000
00000000 de15de5c 00000000
GPR08: 00000000 00000000 c08e4d88 00000000 24228484
00000000 c0004cc8 00000000
GPR16: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 c0c90000
GPR24: c0b4fdd0 c0c3d6e0 00000000 de00beec 00001020
014000c0 de15de50 de017c18
[ 3.315308] NIP [c0643f5c] dmam_alloc_coherent+0xd8/0x118
[ 3.318724] LR [c0643ec8] dmam_alloc_coherent+0x44/0x118
[ 3.322073] Call Trace:
[ 3.325399] [df4f1cb0] [c0643ec8] dmam_alloc_coherent+0x44/0x118 (unreliable)
[ 3.328858] [df4f1cd0] [c06a5f4c] pata_macio_port_start+0x48/0x98
[ 3.332294] [df4f1cf0] [c068b25c] ata_host_start.part.9+0x108/0x220
[ 3.335706] [df4f1d10] [c06912d8] ata_host_activate+0x70/0x15c
[ 3.339084] [df4f1d30] [c06a6a8c] pata_macio_common_init+0x300/0x568
[ 3.342459] [df4f1d90] [c06a6ef4] pata_macio_attach+0xe4/0x18c
[ 3.345862] [df4f1db0] [c06582bc] macio_device_probe+0x64/0xf8
[ 3.349218] [df4f1dd0] [c062c5e8] driver_probe_device+0x334/0x4b4
[ 3.352537] [df4f1e00] [c062c884] __driver_attach+0x11c/0x120
[ 3.355822] [df4f1e20] [c0629a14] bus_for_each_dev+0x70/0xc0
[ 3.359074] [df4f1e50] [c062b338] bus_add_driver+0x180/0x2dc
[ 3.362277] [df4f1e70] [c062d620] driver_register+0x94/0x13c
[ 3.365415] [df4f1e80] [c0b937f8] pata_macio_init+0x68/0x90
[ 3.368474] [df4f1ea0] [c0004af4] do_one_initcall+0x4c/0x178
[ 3.371471] [df4f1f00] [c0b50774] kernel_init_freeable+0x138/0x1d0
[ 3.374421] [df4f1f30] [c0004cec] kernel_init+0x24/0x118
[ 3.377337] [df4f1f40] [c0018304] ret_from_kernel_thread+0x5c/0x64
[ 3.380249] --- interrupt: 0 at (null)
LR = (null)
[ 3.385965] Instruction dump:
[ 3.388713] 7fc4f378 7fe3fb78 93be0004 913e0008 939e0000 4bfecd79
7fa3eb78 80010024
[ 3.391513] bb61000c 38210020 7c0803a6 4e800020 <0fe00000> 812a0000
2f890000 409eff98
[ 3.394280] ---[ end trace a4431b67b2b33261 ]---
[ 3.397425] scsi host1: pata_macio
^ permalink raw reply
* Re: [PATCH v11 3/3] mm, x86: display pkey in smaps only if arch supports pkeys
From: Ram Pai @ 2018-02-02 7:21 UTC (permalink / raw)
To: kbuild test robot
Cc: kbuild-all, mpe, mingo, akpm, linuxppc-dev, linux-mm, x86,
linux-arch, linux-kernel, dave.hansen, benh, paulus, khandual,
aneesh.kumar, bsingharora, hbabu, mhocko, bauerman, ebiederm,
corbet, arnd, fweimer, msuchanek
In-Reply-To: <201802021225.JPjLbdCs%fengguang.wu@intel.com>
On Fri, Feb 02, 2018 at 12:27:27PM +0800, kbuild test robot wrote:
> Hi Ram,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v4.15 next-20180201]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_0day-2Dci_linux_commits_Ram-2DPai_mm-2Dx86-2Dpowerpc-2DEnhancements-2Dto-2DMemory-2DProtection-2DKeys_20180202-2D120004&d=DwIBAg&c=jf_iaSHvJObTbx-siA1ZOg&r=m-UrKChQVkZtnPpjbF6YY99NbT8FBByQ-E-ygV8luxw&m=Fv3tEHet1bTUrDjOnzEhXvGM_4tGlkYhJHPBnWNWgVA&s=Z1W6CV2tfPmLYU8lVv1oDRl2cAyQA76KE2P064A2CQY&e=
> config: x86_64-randconfig-x005-201804 (attached as .config)
> compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All error/warnings (new ones prefixed by >>):
>
> In file included from arch/x86/include/asm/mmu_context.h:8:0,
> from arch/x86/events/core.c:36:
> >> include/linux/pkeys.h:16:23: error: expected identifier or '(' before numeric constant
> #define vma_pkey(vma) 0
> ^
> >> arch/x86/include/asm/mmu_context.h:298:19: note: in expansion of macro 'vma_pkey'
> static inline int vma_pkey(struct vm_area_struct *vma)
> ^~~~~~~~
>
> vim +16 include/linux/pkeys.h
>
> 7
> 8 #ifdef CONFIG_ARCH_HAS_PKEYS
> 9 #include <asm/pkeys.h>
> 10 #else /* ! CONFIG_ARCH_HAS_PKEYS */
> 11 #define arch_max_pkey() (1)
> 12 #define execute_only_pkey(mm) (0)
> 13 #define arch_override_mprotect_pkey(vma, prot, pkey) (0)
> 14 #define PKEY_DEDICATED_EXECUTE_ONLY 0
> 15 #define ARCH_VM_PKEY_FLAGS 0
> > 16 #define vma_pkey(vma) 0
Oops. Thanks for catching the issue. The following fix will resolve the error.
diff --git a/arch/x86/include/asm/mmu_context.h
b/arch/x86/include/asm/mmu_context.h
index 6d16d15..c1aeb19 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -238,11 +238,6 @@ static inline int vma_pkey(struct vm_area_struct
*vma)
return (vma->vm_flags & vma_pkey_mask) >> VM_PKEY_SHIFT;
}
-#else
-static inline int vma_pkey(struct vm_area_struct *vma)
-{
- return 0;
-}
#endif
RP
^ permalink raw reply related
* Re: [RFC] powerpc/mm/pgtable: Split mappings on hot-unplug
From: Bharata B Rao @ 2018-02-02 5:54 UTC (permalink / raw)
To: Balbir Singh
Cc: open list:LINUX FOR POWERPC (32-BIT AND 64-BIT), David Gibson,
Aneesh Kumar KV, Michael Ellerman
In-Reply-To: <CAKTCnz=gRT8xBjW6XMkdWDu79jkQ=-1qBxJgxrqMyKw=MCAu_A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1865 bytes --]
On Fri, Feb 2, 2018 at 8:38 AM, Balbir Singh <bsingharora@gmail.com> wrote:
> On Thu, Feb 1, 2018 at 11:48 PM, Balbir Singh <bsingharora@gmail.com>
> wrote:
> > This patch splits the a linear mapping if the hot-unplug range
> > is smaller than the mapping size. The code detects if the mapping
> > needs to be split into a smaller size and if so, uses the stop
> > machine infrastructure to map the current linear mapping with
> > a smaller size mapping. Then the requested area is unmapped.
> >
> > A new API to do a local TLB flush is introduced and exported.
> > This API is used in stop mapping after clearing the larger
> > mapping and before creating the smaller mapping. There is also
> > a check to ensure that we don't overlap with kernel text
> > (the region that is being split) as it could cause the executing
> > text to fault.
> >
> > There are some caveats with this approach, as the unmapping can
> > cause reserved memory area to be freed up (memblock reserved
> > mappings and allocations as well), that can be a problem. There
> > could be a case where radix__map_kernel_page() may fault if the
> > area selected to unmap contains the process page table, this is
> > not a new problem created by the patch, but something to watch
> > out for while testing. The right approach to solving the hot-unplug
> > issue is to make the node/DIMM to be marked hotpluggable so that
> > all the memory in that is movable. Currently there is no method
> > of enforcing the hotpluggable property via libvirt or qemu.
>
In fact QEMU presents all the hotpluggable memory to the guest via
ibm,dynamic-reconfiguration-memory DT node. So guest kernel can easily mark
them as hotpluggable and that is what I tried in my earlier attempts.
However that won't fly with PowerVM for the reason described in
https://patchwork.ozlabs.org/patch/856015/
Regards,
Bharata.
[-- Attachment #2: Type: text/html, Size: 2591 bytes --]
^ permalink raw reply
* Re: [PATCH v11 3/3] mm, x86: display pkey in smaps only if arch supports pkeys
From: kbuild test robot @ 2018-02-02 4:27 UTC (permalink / raw)
To: Ram Pai
Cc: kbuild-all, mpe, mingo, akpm, linuxppc-dev, linux-mm, x86,
linux-arch, linux-kernel, dave.hansen, benh, paulus, khandual,
aneesh.kumar, bsingharora, hbabu, mhocko, bauerman, ebiederm,
linuxram, corbet, arnd, fweimer, msuchanek
In-Reply-To: <1517341452-11924-4-git-send-email-linuxram@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]
Hi Ram,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.15 next-20180201]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ram-Pai/mm-x86-powerpc-Enhancements-to-Memory-Protection-Keys/20180202-120004
config: x86_64-randconfig-x005-201804 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
In file included from arch/x86/include/asm/mmu_context.h:8:0,
from arch/x86/events/core.c:36:
>> include/linux/pkeys.h:16:23: error: expected identifier or '(' before numeric constant
#define vma_pkey(vma) 0
^
>> arch/x86/include/asm/mmu_context.h:298:19: note: in expansion of macro 'vma_pkey'
static inline int vma_pkey(struct vm_area_struct *vma)
^~~~~~~~
vim +16 include/linux/pkeys.h
7
8 #ifdef CONFIG_ARCH_HAS_PKEYS
9 #include <asm/pkeys.h>
10 #else /* ! CONFIG_ARCH_HAS_PKEYS */
11 #define arch_max_pkey() (1)
12 #define execute_only_pkey(mm) (0)
13 #define arch_override_mprotect_pkey(vma, prot, pkey) (0)
14 #define PKEY_DEDICATED_EXECUTE_ONLY 0
15 #define ARCH_VM_PKEY_FLAGS 0
> 16 #define vma_pkey(vma) 0
17
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30449 bytes --]
^ permalink raw reply
* Re: [RFC] powerpc/mm/pgtable: Split mappings on hot-unplug
From: Balbir Singh @ 2018-02-02 3:08 UTC (permalink / raw)
To: open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)
Cc: David Gibson, Aneesh Kumar KV, Michael Ellerman, Balbir Singh,
Bharata B Rao
In-Reply-To: <20180201181819.5723-1-bsingharora@gmail.com>
On Thu, Feb 1, 2018 at 11:48 PM, Balbir Singh <bsingharora@gmail.com> wrote:
> This patch splits the a linear mapping if the hot-unplug range
> is smaller than the mapping size. The code detects if the mapping
> needs to be split into a smaller size and if so, uses the stop
> machine infrastructure to map the current linear mapping with
> a smaller size mapping. Then the requested area is unmapped.
>
> A new API to do a local TLB flush is introduced and exported.
> This API is used in stop mapping after clearing the larger
> mapping and before creating the smaller mapping. There is also
> a check to ensure that we don't overlap with kernel text
> (the region that is being split) as it could cause the executing
> text to fault.
>
> There are some caveats with this approach, as the unmapping can
> cause reserved memory area to be freed up (memblock reserved
> mappings and allocations as well), that can be a problem. There
> could be a case where radix__map_kernel_page() may fault if the
> area selected to unmap contains the process page table, this is
> not a new problem created by the patch, but something to watch
> out for while testing. The right approach to solving the hot-unplug
> issue is to make the node/DIMM to be marked hotpluggable so that
> all the memory in that is movable. Currently there is no method
> of enforcing the hotpluggable property via libvirt or qemu.
>
> I've tested these changes under a kvm guest with 2 vcpus, from
> a split mapping point of view, some of the caveats mentioned
> above applied to the testing I did.
>
> TODOs
>
> 1. In addition of checking overlapping text, we should check for
> reserved memory allocations in the unmapped region
> 2. The code has duplication across several remove_*pgtable
> (pgd/pud/pmd), we could create helper functions to simplify
> the functionality.
>
> Signed-off-by: Balbir Singh <bsingharora@gmail.com>
> ---
> .../powerpc/include/asm/book3s/64/tlbflush-radix.h | 1 +
> arch/powerpc/mm/pgtable-radix.c | 130 +++++++++++++++++----
> arch/powerpc/mm/tlb-radix.c | 6 +
> 3 files changed, 116 insertions(+), 21 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> index 6a9e68003387..d1d4104e676d 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> @@ -20,6 +20,7 @@ extern void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
> extern void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
> unsigned long end);
> extern void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
> +extern void radix__flush_tlb_local_kernel_range(unsigned long start, unsigned long end);
>
> extern void radix__local_flush_tlb_mm(struct mm_struct *mm);
> extern void radix__local_flush_all_mm(struct mm_struct *mm);
> diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
> index cfbbee941a76..10b6a1c433ff 100644
> --- a/arch/powerpc/mm/pgtable-radix.c
> +++ b/arch/powerpc/mm/pgtable-radix.c
> @@ -17,6 +17,7 @@
> #include <linux/of_fdt.h>
> #include <linux/mm.h>
> #include <linux/string_helpers.h>
> +#include <linux/stop_machine.h>
>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> @@ -671,6 +672,35 @@ static void free_pmd_table(pmd_t *pmd_start, pud_t *pud)
> pud_clear(pud);
> }
>
> +struct change_mapping_params {
> + pte_t *pte;
> + unsigned long start;
> + unsigned long end;
> + unsigned long size;
> + unsigned long aligned_start;
> + unsigned long aligned_end;
> +};
> +
> +static int stop_machine_change_mapping(void *data)
> +{
> + struct change_mapping_params *params =
> + (struct change_mapping_params *)data;
> + unsigned long addr;
> +
> + if (!data)
> + return -1;
> +
> + spin_unlock(&init_mm.page_table_lock);
> + pte_clear(&init_mm, params->aligned_start, params->pte);
> + radix__flush_tlb_local_kernel_range(params->aligned_start,
> + params->aligned_end);
> + for (addr = params->aligned_start; addr < params->aligned_end;
> + addr += params->size)
> + create_physical_mapping(addr, addr + params->size);
> + spin_lock(&init_mm.page_table_lock);
> + return 0;
> +}
> +
> static void remove_pte_table(pte_t *pte_start, unsigned long addr,
> unsigned long end)
> {
> @@ -699,12 +729,65 @@ static void remove_pte_table(pte_t *pte_start, unsigned long addr,
> }
> }
>
> +/*
> + * clear the pte and potentially split the mapping helper
> + * Return values are as follows
> + *
> + * 0: pte cleared, no changes required
> + * 1: pte cleared and mapping split
> + * -1: We can't clear this pte range
> + */
> +static int clear_and_maybe_split_kernel_mapping(unsigned long addr,
> + unsigned long end, unsigned long size, unsigned long prev_size,
> + pte_t *pte)
> +{
> + unsigned long mask = ~(size - 1);
> + unsigned long aligned_start = addr & mask;
> + unsigned long aligned_end = addr + size;
> + struct change_mapping_params params;
> + bool split_region = false;
> +
> + if ((end - addr) < size) {
> + /*
> + * We're going to clear the PTE, but not flushed
> + * the mapping, time to remap and flush. The
> + * effects if visible outside the processor or
> + * if we are running in code close to the
> + * mapping we cleared, we are in trouble.
> + */
> + if (overlaps_kernel_text(aligned_start, addr) ||
> + overlaps_kernel_text(end, aligned_end)) {
> + /*
> + * Hack, just return, don't pte_clear
> + */
> + return -1;
> + }
> + split_region = true;
> + }
> +
> + if (split_region) {
> + params.pte = pte;
> + params.start = addr;
> + params.end = end;
> + params.size = prev_size;
> + params.aligned_end = aligned_end;
> + params.aligned_end = min_t(unsigned long, aligned_end,
> + (unsigned long)__va(memblock_end_of_DRAM()));
> + stop_machine(stop_machine_change_mapping, ¶ms, NULL);
> + return 1;
> + }
> +
> + pte_clear(&init_mm, addr, pte);
> + return 0;
> +}
> +
> static void remove_pmd_table(pmd_t *pmd_start, unsigned long addr,
> unsigned long end)
> {
> unsigned long next;
> pte_t *pte_base;
> pmd_t *pmd;
> + int rc = 0;
>
> pmd = pmd_start + pmd_index(addr);
> for (; addr < end; addr = next, pmd++) {
> @@ -714,14 +797,15 @@ static void remove_pmd_table(pmd_t *pmd_start, unsigned long addr,
> continue;
>
> if (pmd_huge(*pmd)) {
> - if (!IS_ALIGNED(addr, PMD_SIZE) ||
> - !IS_ALIGNED(next, PMD_SIZE)) {
> - WARN_ONCE(1, "%s: unaligned range\n", __func__);
> + rc = clear_and_maybe_split_kernel_mapping(addr, end,
> + PMD_SIZE, PAGE_SIZE, (pte_t *)pmd);
> + if (rc == 0)
> continue;
> - }
> -
> - pte_clear(&init_mm, addr, (pte_t *)pmd);
> - continue;
> + if (rc == 1) {
> + pte_base = (pte_t *)pmd_page_vaddr(*pmd);
> + remove_pte_table(pte_base, addr, end);
> + } else
> + return;
> }
>
> pte_base = (pte_t *)pmd_page_vaddr(*pmd);
> @@ -736,6 +820,7 @@ static void remove_pud_table(pud_t *pud_start, unsigned long addr,
> unsigned long next;
> pmd_t *pmd_base;
> pud_t *pud;
> + int rc = 0;
>
> pud = pud_start + pud_index(addr);
> for (; addr < end; addr = next, pud++) {
> @@ -745,14 +830,15 @@ static void remove_pud_table(pud_t *pud_start, unsigned long addr,
> continue;
>
> if (pud_huge(*pud)) {
> - if (!IS_ALIGNED(addr, PUD_SIZE) ||
> - !IS_ALIGNED(next, PUD_SIZE)) {
> - WARN_ONCE(1, "%s: unaligned range\n", __func__);
> + rc = clear_and_maybe_split_kernel_mapping(addr, end,
> + PUD_SIZE, PMD_SIZE, (pte_t *)pud);
> + if (rc == 0)
> continue;
> - }
> -
> - pte_clear(&init_mm, addr, (pte_t *)pud);
> - continue;
> + if (rc == 1) {
> + pmd_base = (pmd_t *)pud_page_vaddr(*pud);
> + remove_pmd_table(pmd_base, addr, end);
> + } else
> + return;
> }
>
> pmd_base = (pmd_t *)pud_page_vaddr(*pud);
> @@ -766,6 +852,7 @@ static void remove_pagetable(unsigned long start, unsigned long end)
> unsigned long addr, next;
> pud_t *pud_base;
> pgd_t *pgd;
> + int rc = 0;
>
> spin_lock(&init_mm.page_table_lock);
>
> @@ -777,14 +864,15 @@ static void remove_pagetable(unsigned long start, unsigned long end)
> continue;
>
> if (pgd_huge(*pgd)) {
> - if (!IS_ALIGNED(addr, PGDIR_SIZE) ||
> - !IS_ALIGNED(next, PGDIR_SIZE)) {
> - WARN_ONCE(1, "%s: unaligned range\n", __func__);
> + rc = clear_and_maybe_split_kernel_mapping(addr, end,
> + PGD_SIZE, PUD_SIZE, (pte_t *)pgd);
> + if (rc == 0)
> continue;
> - }
> -
> - pte_clear(&init_mm, addr, (pte_t *)pgd);
> - continue;
> + if (rc == 1) {
> + pud_base = (pud_t *)pgd_page_vaddr(*pgd);
> + remove_pud_table(pud_base, addr, end);
> + } else
> + return;
> }
>
> pud_base = (pud_t *)pgd_page_vaddr(*pgd);
> diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
> index 884f4b705b57..9bbeaef1ee9b 100644
> --- a/arch/powerpc/mm/tlb-radix.c
> +++ b/arch/powerpc/mm/tlb-radix.c
> @@ -323,6 +323,12 @@ void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end)
> }
> EXPORT_SYMBOL(radix__flush_tlb_kernel_range);
>
> +void radix__flush_tlb_local_kernel_range(unsigned long start, unsigned long end)
> +{
> + _tlbie_pid(0, RIC_FLUSH_ALL);
> +}
> +EXPORT_SYMBOL(radix__flush_tlb_local_kernel_range);
> +
> #define TLB_FLUSH_ALL -1UL
>
> /*
> --
> 2.13.6
>
+Bharata
Balbir Singh.
^ permalink raw reply
* Re: [PATCH v5 1/1] KVM: PPC: Book3S: Add MMIO emulation for VMX instructions
From: Paul Mackerras @ 2018-02-02 2:55 UTC (permalink / raw)
To: Jose Ricardo Ziviani; +Cc: linuxppc-dev, kvm-ppc, lvivier
In-Reply-To: <20180201181539.9650-2-joserz@linux.vnet.ibm.com>
On Thu, Feb 01, 2018 at 04:15:39PM -0200, Jose Ricardo Ziviani wrote:
> This patch provides the MMIO load/store vector indexed
> X-Form emulation.
>
> Instructions implemented:
> lvx: the quadword in storage addressed by the result of EA &
> 0xffff_ffff_ffff_fff0 is loaded into VRT.
>
> stvx: the contents of VRS are stored into the quadword in storage
> addressed by the result of EA & 0xffff_ffff_ffff_fff0.
>
> Reported-by: Gopesh Kumar Chaudhary <gopchaud@in.ibm.com>
> Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
> Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
> ---
> arch/powerpc/include/asm/kvm_host.h | 2 +
> arch/powerpc/include/asm/kvm_ppc.h | 4 +
> arch/powerpc/include/asm/ppc-opcode.h | 6 ++
> arch/powerpc/kvm/emulate_loadstore.c | 34 ++++++++
> arch/powerpc/kvm/powerpc.c | 153 +++++++++++++++++++++++++++++++++-
> 5 files changed, 198 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index 3aa5b577cd60..045acc843e98 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -690,6 +690,7 @@ struct kvm_vcpu_arch {
> u8 mmio_vsx_offset;
> u8 mmio_vsx_copy_type;
> u8 mmio_vsx_tx_sx_enabled;
> + u8 mmio_vmx_copy_nums;
> u8 osi_needed;
> u8 osi_enabled;
> u8 papr_enabled;
> @@ -800,6 +801,7 @@ struct kvm_vcpu_arch {
> #define KVM_MMIO_REG_QPR 0x0040
> #define KVM_MMIO_REG_FQPR 0x0060
> #define KVM_MMIO_REG_VSX 0x0080
> +#define KVM_MMIO_REG_VMX 0x00c0
>
> #define __KVM_HAVE_ARCH_WQP
> #define __KVM_HAVE_CREATE_DEVICE
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
> index 9db18287b5f4..7765a800ddae 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -81,6 +81,10 @@ extern int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
> extern int kvmppc_handle_vsx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> unsigned int rt, unsigned int bytes,
> int is_default_endian, int mmio_sign_extend);
> +extern int kvmppc_handle_load128_by2x64(struct kvm_run *run,
> + struct kvm_vcpu *vcpu, unsigned int rt, int is_default_endian);
> +extern int kvmppc_handle_store128_by2x64(struct kvm_run *run,
> + struct kvm_vcpu *vcpu, unsigned int rs, int is_default_endian);
> extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> u64 val, unsigned int bytes,
> int is_default_endian);
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> index ab5c1588b487..f1083bcf449c 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -156,6 +156,12 @@
> #define OP_31_XOP_LFDX 599
> #define OP_31_XOP_LFDUX 631
>
> +/* VMX Vector Load Instructions */
> +#define OP_31_XOP_LVX 103
> +
> +/* VMX Vector Store Instructions */
> +#define OP_31_XOP_STVX 231
> +
> #define OP_LWZ 32
> #define OP_STFS 52
> #define OP_STFSU 53
> diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
> index af833531af31..332b82eafd48 100644
> --- a/arch/powerpc/kvm/emulate_loadstore.c
> +++ b/arch/powerpc/kvm/emulate_loadstore.c
> @@ -58,6 +58,18 @@ static bool kvmppc_check_vsx_disabled(struct kvm_vcpu *vcpu)
> }
> #endif /* CONFIG_VSX */
>
> +#ifdef CONFIG_ALTIVEC
> +static bool kvmppc_check_altivec_disabled(struct kvm_vcpu *vcpu)
> +{
> + if (!(kvmppc_get_msr(vcpu) & MSR_VEC)) {
> + kvmppc_core_queue_vec_unavail(vcpu);
> + return true;
> + }
> +
> + return false;
> +}
> +#endif /* CONFIG_ALTIVEC */
> +
> /*
> * XXX to do:
> * lfiwax, lfiwzx
> @@ -98,6 +110,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
> vcpu->arch.mmio_vsx_copy_type = KVMPPC_VSX_COPY_NONE;
> vcpu->arch.mmio_sp64_extend = 0;
> vcpu->arch.mmio_sign_extend = 0;
> + vcpu->arch.mmio_vmx_copy_nums = 0;
>
> switch (get_op(inst)) {
> case 31:
> @@ -459,6 +472,27 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
> rs, 4, 1);
> break;
> #endif /* CONFIG_VSX */
> +
> +#ifdef CONFIG_ALTIVEC
> + case OP_31_XOP_LVX:
> + if (kvmppc_check_altivec_disabled(vcpu))
> + return EMULATE_DONE;
> + vcpu->arch.vaddr_accessed &= ~0xFULL;
> + vcpu->arch.mmio_vmx_copy_nums = 2;
> + emulated = kvmppc_handle_load128_by2x64(run, vcpu,
> + KVM_MMIO_REG_VMX|rt, 1);
> + break;
> +
> + case OP_31_XOP_STVX:
> + if (kvmppc_check_altivec_disabled(vcpu))
> + return EMULATE_DONE;
> + vcpu->arch.vaddr_accessed &= ~0xFULL;
> + vcpu->arch.mmio_vmx_copy_nums = 2;
> + emulated = kvmppc_handle_store128_by2x64(run, vcpu,
> + rs, 1);
> + break;
> +#endif /* CONFIG_ALTIVEC */
> +
> default:
> emulated = EMULATE_FAIL;
> break;
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 1915e86cef6f..a19f42120b38 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -832,7 +832,7 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
> kvm->arch.kvm_ops->irq_bypass_del_producer(cons, prod);
> }
>
> -#ifdef CONFIG_VSX
> +#ifdef CONFIG_ALTIVEC
> static inline int kvmppc_get_vsr_dword_offset(int index)
> {
> int offset;
> @@ -848,7 +848,9 @@ static inline int kvmppc_get_vsr_dword_offset(int index)
>
> return offset;
> }
> +#endif /* CONFIG_ALTIVEC */
>
> +#ifdef CONFIG_VSX
> static inline int kvmppc_get_vsr_word_offset(int index)
You make the dword version available with ALTIVEC && ~VSX, but in fact
it's the word version that you use below. However, I don't think we
actually want either of them (see below).
> {
> int offset;
> @@ -925,6 +927,31 @@ static inline void kvmppc_set_vsr_word(struct kvm_vcpu *vcpu,
> }
> #endif /* CONFIG_VSX */
>
> +#ifdef CONFIG_ALTIVEC
> +static inline void kvmppc_set_vmx_dword(struct kvm_vcpu *vcpu,
> + u64 gpr)
> +{
> + int index = vcpu->arch.io_gpr & KVM_MMIO_REG_MASK;
> + u32 hi, lo;
> +
> +#ifdef __BIG_ENDIAN
> + hi = gpr >> 32;
> + lo = gpr & 0xffffffff;
> +#else
> + lo = gpr >> 32;
> + hi = gpr & 0xffffffff;
> +#endif
> +
> + if (vcpu->arch.mmio_vmx_copy_nums == 1) {
> + VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(2)] = lo;
> + VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(3)] = hi;
> + } else if (vcpu->arch.mmio_vmx_copy_nums == 2) {
> + VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(0)] = lo;
> + VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(1)] = hi;
> + }
Since what we're doing is a 16-byte load, the main thing we have to do
here in handling a cross-endian situation is to swap the two 8-byte
halves. The byte-swapping within each 8-byte half has already been
handled more generically.
I suggest the following code. It is simpler and passes my test case.
static inline void kvmppc_set_vmx_dword(struct kvm_vcpu *vcpu,
u64 gpr)
{
int index = vcpu->arch.io_gpr & KVM_MMIO_REG_MASK;
u32 hi, lo;
u32 di;
#ifdef __BIG_ENDIAN
hi = gpr >> 32;
lo = gpr & 0xffffffff;
#else
lo = gpr >> 32;
hi = gpr & 0xffffffff;
#endif
di = 2 - vcpu->arch.mmio_vmx_copy_nums; /* doubleword index */
if (di > 1)
return;
if (vcpu->arch.mmio_host_swabbed)
di = 1 - di;
VCPU_VSX_VR(vcpu, index).u[di * 2] = hi;
VCPU_VSX_VR(vcpu, index).u[di * 2 + 1] = lo;
}
> +static inline int kvmppc_get_vmx_data(struct kvm_vcpu *vcpu, int rs, u64 *val)
> +{
> + vector128 vrs = VCPU_VSX_VR(vcpu, rs);
> +
> + if (vcpu->arch.mmio_vmx_copy_nums == 1) {
> +#ifdef __BIG_ENDIAN
> + *val = vrs.u[kvmppc_get_vsr_word_offset(3)];
> + *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(2)];
> +#else
> + *val = vrs.u[kvmppc_get_vsr_word_offset(2)];
> + *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(3)];
> +#endif
> + return 0;
> + } else if (vcpu->arch.mmio_vmx_copy_nums == 2) {
> +#ifdef __BIG_ENDIAN
> + *val = vrs.u[kvmppc_get_vsr_word_offset(1)];
> + *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(0)];
> +#else
> + *val = vrs.u[kvmppc_get_vsr_word_offset(0)];
> + *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(1)];
> +#endif
> + return 0;
> + }
> + return -1;
Once again the main thing is to swap the two halves. My suggested
code is:
static inline int kvmppc_get_vmx_data(struct kvm_vcpu *vcpu, int rs, u64 *val)
{
vector128 vrs = VCPU_VSX_VR(vcpu, rs);
u32 di;
u64 w0, w1;
di = 2 - vcpu->arch.mmio_vmx_copy_nums; /* doubleword index */
if (di > 1)
return -1;
if (vcpu->arch.mmio_host_swabbed)
di = 1 - di;
w0 = vrs.u[di * 2];
w1 = vrs.u[di * 2 + 1];
#ifdef __BIG_ENDIAN
*val = (w0 << 32) | w1;
#else
*val = (w1 << 32) | w0;
#endif
return 0;
}
Paul.
^ permalink raw reply
* Re: [PATCH v11 00/10] Application Data Integrity feature introduced by SPARC M7
From: Eric W. Biederman @ 2018-02-02 2:29 UTC (permalink / raw)
To: Khalid Aziz
Cc: davem, dave.hansen, aarcange, akpm, allen.pais, anthony.yznaga,
arnd, babu.moger, benh, bob.picco, bsingharora, corbet,
dan.j.williams, dave.jiang, david.j.aldridge, elena.reshetova,
glx, gregkh, hannes, hillf.zj, hpa, hughd, imbrenda, jack,
jag.raman, jane.chu, jglisse, jroedel, khalid, khandual,
kirill.shutemov, kstewart, ktkhai, liam.merwick, linux-arch,
linux-doc, linux-kernel, linux-mm, linuxppc-dev, linux, me,
mgorman, mgorman, mhocko, mike.kravetz, minchan, mingo, mingo,
mpe, nadav.amit, nagarathnam.muthusamy, nborisov, n-horiguchi,
nick.alcock, nitin.m.gupta, ombredanne, pasha.tatashin, paulus,
pombredanne, punit.agrawal, rob.gardner, ross.zwisler,
shannon.nelson, shli, sparclinux, steven.sistare, tglx,
thomas.tai, tklauser, tom.hromatka, vegard.nossum, vijay.ac.kumar,
willy, x86, zi.yan
In-Reply-To: <cover.1517497017.git.khalid.aziz@oracle.com>
Khalid Aziz <khalid.aziz@oracle.com> writes:
> V11 changes:
> This series is same as v10 and was simply rebased on 4.15 kernel. Can
> mm maintainers please review patches 2, 7, 8 and 9 which are arch
> independent, and include/linux/mm.h and mm/ksm.c changes in patch 10
> and ack these if everything looks good?
I am a bit puzzled how this differs from the pkey's that other
architectures are implementing to achieve a similar result.
I am a bit mystified why you don't store the tag in a vma
instead of inventing a new way to store data on page out.
Can you please use force_sig_fault to send these signals instead
of force_sig_info. Emperically I have found that it is very
error prone to generate siginfo's by hand, especially on code
paths where several different si_codes may apply. So it helps
to go through a helper function to ensure the fiddly bits are
all correct. AKA the unused bits all need to be set to zero before
struct siginfo is copied to userspace.
Eric
^ permalink raw reply
* Re: [PATCH v5 0/1] Implements MMIO emulation for lvx/stvx instructions
From: Paul Mackerras @ 2018-02-02 0:30 UTC (permalink / raw)
To: Jose Ricardo Ziviani; +Cc: linuxppc-dev, kvm-ppc, lvivier
In-Reply-To: <20180201181539.9650-1-joserz@linux.vnet.ibm.com>
On Thu, Feb 01, 2018 at 04:15:38PM -0200, Jose Ricardo Ziviani wrote:
> v5:
> - Fixed the mask off of the effective address
>
> v4:
> - Changed KVM_MMIO_REG_VMX to 0xc0 because there are 64 VSX registers
>
> v3:
> - Added Reported-by in the commit message
>
> v2:
> - kvmppc_get_vsr_word_offset() moved back to its original place
> - EA AND ~0xF, following ISA.
> - fixed BE/LE cases
>
> TESTS:
>
> For testing purposes I wrote a small program that performs stvx/lvx using the
> program's virtual memory and using MMIO. Load/Store into virtual memory is the
> model I use to check if MMIO results are correct (because only MMIO is emulated
> by KVM).
I'd be interested to see your test program because in my testing it's
still not right, unfortunately. Interestingly, it is right for the BE
guest on LE host case. However, with a LE guest on a LE host the two
halves are swapped, both for lvx and stvx:
error in lvx at byte 0
was: -> 62 69 70 77 7e 85 8c 93 2a 31 38 3f 46 4d 54 5b
ref: -> 2a 31 38 3f 46 4d 54 5b 62 69 70 77 7e 85 8c 93
error in stvx at byte 0
was: -> 49 50 57 5e 65 6c 73 7a 11 18 1f 26 2d 34 3b 42
ref: -> 11 18 1f 26 2d 34 3b 42 49 50 57 5e 65 6c 73 7a
The byte order within each 8-byte half is correct but the two halves
are swapped. ("was" is what was in memory and "ref" is the correct
value. For lvx it does lvx from emulated MMIO and stvx to ordinary
memory, and for stvx it does lvx from ordinary memory and stvx to
emulated MMIO. In both cases the checking is done with a byte by byte
comparison.)
Paul.
^ permalink raw reply
* Re: [PATCH] powerpc/tm: Remove struct thread_info param from tm_reclaim_thread()
From: Cyril Bur @ 2018-02-01 23:34 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: gromero
In-Reply-To: <87inbhe2q8.fsf@concordia.ellerman.id.au>
On Thu, 2018-02-01 at 15:46 +1100, Michael Ellerman wrote:
> Cyril Bur <cyrilbur@gmail.com> writes:
>
> > tm_reclaim_thread() doesn't use the parameter anymore, both callers have
> > to bother getting it as they have no need for a struct thread_info
> > either.
>
> In future please tell me why the parameter is unused and when it became
> unused.
>
Thanks, will do!
> In this case it was previously used but the last usage was removed in:
>
> dc3106690b20 ("powerpc: tm: Always use fp_state and vr_state to store live registers")
>
> cheers
>
> > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> > index bfdd783e3916..a47498da6562 100644
> > --- a/arch/powerpc/kernel/process.c
> > +++ b/arch/powerpc/kernel/process.c
> > @@ -853,8 +853,7 @@ static inline bool tm_enabled(struct task_struct *tsk)
> > return tsk && tsk->thread.regs && (tsk->thread.regs->msr & MSR_TM);
> > }
> >
> > -static void tm_reclaim_thread(struct thread_struct *thr,
> > - struct thread_info *ti, uint8_t cause)
> > +static void tm_reclaim_thread(struct thread_struct *thr, uint8_t cause)
> > {
> > /*
> > * Use the current MSR TM suspended bit to track if we have
> > @@ -901,7 +900,7 @@ static void tm_reclaim_thread(struct thread_struct *thr,
> > void tm_reclaim_current(uint8_t cause)
> > {
> > tm_enable();
> > - tm_reclaim_thread(¤t->thread, current_thread_info(), cause);
> > + tm_reclaim_thread(¤t->thread, cause);
> > }
> >
> > static inline void tm_reclaim_task(struct task_struct *tsk)
> > @@ -932,7 +931,7 @@ static inline void tm_reclaim_task(struct task_struct *tsk)
> > thr->regs->ccr, thr->regs->msr,
> > thr->regs->trap);
> >
> > - tm_reclaim_thread(thr, task_thread_info(tsk), TM_CAUSE_RESCHED);
> > + tm_reclaim_thread(thr, TM_CAUSE_RESCHED);
> >
> > TM_DEBUG("--- tm_reclaim on pid %d complete\n",
> > tsk->pid);
> > --
> > 2.16.1
^ permalink raw reply
* [PATCH] powerpc/hotplug/drcinfo: Fixes bug with hot-add of CPUs
From: Michael Bringmann @ 2018-02-01 21:59 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Michael Bringmann, nfont
This patch fixes a bug matching drc-indexes of CPUs that are
being hot-added to a system either individually or by count.
This patch inserts a couple of missing checks and parsing code
for the new representation of device-tree information provided
by the property "ibm,drc-info".
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Fixes: 3f38000eda48 ("powerpc/firmware: Add definitions for new drc-info firmwar
e feature" -- end of patch series applied to powerpc next)
---
arch/powerpc/platforms/pseries/hotplug-cpu.c | 117 +++++++++++++++++++++-----
1 file changed, 96 insertions(+), 21 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index a7d14aa7..4cc6b70 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -413,19 +413,52 @@ static bool valid_cpu_drc_index(struct device_node *parent, u32 drc_index)
bool found = false;
int rc, index;
- index = 0;
- while (!found) {
- u32 drc;
+ if (firmware_has_feature(FW_FEATURE_DRC_INFO)) {
+ struct property *info = NULL;
+ struct of_drc_info drc;
+ int j;
+ u32 num_set_entries;
+ const __be32 *value;
+
+ info = of_find_property(parent, "ibm,drc-info", NULL);
+ if (info == NULL)
+ goto end_out;
+
+ value = of_prop_next_u32(info, NULL, &num_set_entries);
+ if (!value)
+ goto end_out;
+ value++;
+
+ for (j = 0; j < num_set_entries; j++) {
+
+ of_read_drc_info_cell(&info, &value, &drc);
+ if (strncmp(drc.drc_type, "CPU", 3))
+ goto end_out;
+
+ if ((drc.drc_index_start <= drc_index) &&
+ (drc_index <= drc.last_drc_index)) {
+ found = true;
+ break;
+ }
+ }
- rc = of_property_read_u32_index(parent, "ibm,drc-indexes",
+ } else {
+ index = 0;
+ while (!found) {
+ u32 drc;
+
+ rc = of_property_read_u32_index(parent,
+ "ibm,drc-indexes",
index++, &drc);
- if (rc)
- break;
+ if (rc)
+ break;
- if (drc == drc_index)
- found = true;
+ if (drc == drc_index)
+ found = true;
+ }
}
+end_out:
return found;
}
@@ -731,26 +764,68 @@ static int find_dlpar_cpus_to_add(u32 *cpu_drcs, u32 cpus_to_add)
return -1;
}
- /* Search the ibm,drc-indexes array for possible CPU drcs to
- * add. Note that the format of the ibm,drc-indexes array is
- * the number of entries in the array followed by the array
- * of drc values so we start looking at index = 1.
+ /* Search the ibm,drc-indexes or ibm,drc-info array for
+ * possible CPU drcs to add. Note that the format of the
+ * ibm,drc-indexes array is the number of entries in the
+ * array followed by the array of drc values so we start
+ * looking at index = 1. The ibm,drc-info array is a more
+ * compact format for large numbers of CPUs, and the format
+ * is correspondingly more complex.
*/
- index = 1;
- while (cpus_found < cpus_to_add) {
- u32 drc;
+ if (firmware_has_feature(FW_FEATURE_DRC_INFO)) {
+ struct property *info = NULL;
+ struct of_drc_info drc;
+ int j;
+ u32 num_set_entries;
+ const __be32 *value;
+
+ info = of_find_property(parent, "ibm,drc-info", NULL);
+ if (info == NULL)
+ goto err_out;
+
+ value = of_prop_next_u32(info, NULL, &num_set_entries);
+ if (!value)
+ goto err_out;
+ value++;
+
+ for (j = 0; j < num_set_entries; j++) {
+ int k;
+
+ of_read_drc_info_cell(&info, &value, &drc);
+ if (strncmp(drc.drc_type, "CPU", 3))
+ goto err_out;
+
+ for (k = 0; (k < drc.num_sequential_elems) &&
+ (cpus_found < cpus_to_add); k++) {
+ u32 idrc = drc.drc_index_start +
+ (k * drc.sequential_inc);
+
+ if (dlpar_cpu_exists(parent, idrc))
+ continue;
+
+ cpu_drcs[cpus_found++] = idrc;
+ }
+ }
+
+ } else {
+ index = 1;
+ while (cpus_found < cpus_to_add) {
+ u32 drc;
- rc = of_property_read_u32_index(parent, "ibm,drc-indexes",
+ rc = of_property_read_u32_index(parent,
+ "ibm,drc-indexes",
index++, &drc);
- if (rc)
- break;
+ if (rc)
+ break;
- if (dlpar_cpu_exists(parent, drc))
- continue;
+ if (dlpar_cpu_exists(parent, drc))
+ continue;
- cpu_drcs[cpus_found++] = drc;
+ cpu_drcs[cpus_found++] = drc;
+ }
}
+err_out:
of_node_put(parent);
return cpus_found;
}
^ permalink raw reply related
* [PATCH] powerpc/hotplug/drcinfo: Fix bugs parsing ibm,drc-info structs
From: Michael Bringmann @ 2018-02-01 21:53 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Michael Bringmann, nfont
This patch fixes a memory parsing bug when using of_prop_next_u32
calls at the start of a structure. Depending upon the value of
"cur" memory pointer argument to of_prop_next_u32, it will or it
won't advance the value of the returned memory pointer by the
size of one u32. This patch corrects the code to deal with that
indexing feature when parsing the ibm,drc-info structs for CPUs.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Fixes: 3f38000eda48 ("powerpc/firmware: Add definitions for new drc-info firmware feature" -- end of patch series applied to powerpc next)
---
arch/powerpc/platforms/pseries/of_helpers.c | 4 +---
arch/powerpc/platforms/pseries/pseries_energy.c | 2 ++
drivers/pci/hotplug/rpaphp_core.c | 1 +
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/of_helpers.c b/arch/powerpc/platforms/pseries/of_helpers.c
index 6df192f..17b5938 100644
--- a/arch/powerpc/platforms/pseries/of_helpers.c
+++ b/arch/powerpc/platforms/pseries/of_helpers.c
@@ -65,9 +65,7 @@ int of_read_drc_info_cell(struct property **prop, const __be32 **curval,
/* Get drc-index-start:encode-int */
p2 = (const __be32 *)p;
- p2 = of_prop_next_u32(*prop, p2, &data->drc_index_start);
- if (!p2)
- return -EINVAL;
+ data->drc_index_start = of_read_number(p2, 1);
/* Get drc-name-suffix-start:encode-int */
p2 = of_prop_next_u32(*prop, p2, &data->drc_name_suffix_start);
diff --git a/arch/powerpc/platforms/pseries/pseries_energy.c b/arch/powerpc/platforms/pseries/pseries_energy.c
index 6ed2212..c7d84aa 100644
--- a/arch/powerpc/platforms/pseries/pseries_energy.c
+++ b/arch/powerpc/platforms/pseries/pseries_energy.c
@@ -64,6 +64,7 @@ static u32 cpu_to_drc_index(int cpu)
value = of_prop_next_u32(info, NULL, &num_set_entries);
if (!value)
goto err_of_node_put;
+ value++;
for (j = 0; j < num_set_entries; j++) {
@@ -126,6 +127,7 @@ static int drc_index_to_cpu(u32 drc_index)
value = of_prop_next_u32(info, NULL, &num_set_entries);
if (!value)
goto err_of_node_put;
+ value++;
for (j = 0; j < num_set_entries; j++) {
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 53902c7..477a21c 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -253,6 +253,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
value = of_prop_next_u32(info, NULL, &entries);
if (!value)
return -EINVAL;
+ value++;
for (j = 0; j < entries; j++) {
of_read_drc_info_cell(&info, &value, &drc);
^ permalink raw reply related
* Re: [PATCH, net] ibmvnic: fix firmware version when no firmware level has been provided by the VIOS server
From: Tyrel Datwyler @ 2018-02-01 21:02 UTC (permalink / raw)
To: Desnes Augusto Nunes do Rosario, netdev
Cc: tlfalcon, linuxppc-dev, nfont, jallen
In-Reply-To: <20180201180430.16950-1-desnesn@linux.vnet.ibm.com>
On 02/01/2018 10:04 AM, Desnes Augusto Nunes do Rosario wrote:
> Older versions of VIOS servers do not send the firmware level in the VPD
> buffer for the ibmvnic driver. Thus, not only the current message is mis-
> leading but the firmware version in the ethtool will be NULL. Therefore,
> this patch fixes the firmware string and its warning.
>
> Fixes: 4e6759be28e4 ("ibmvnic: Feature implementation of VPD for the ibmvnic driver")
>
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
> ---
> drivers/net/ethernet/ibm/ibmvnic.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index b65f5f3ac034..2b3e71b63a7a 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -3290,7 +3290,11 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
> */
> substr = strnstr(adapter->vpd->buff, "RM", adapter->vpd->len);
> if (!substr) {
> - dev_info(dev, "No FW level provided by VPD\n");
> + dev_info(dev, "Warning - No FW level has been provided in the VPD buffer by the VIOS Server\n");
> + ptr = strncpy((char *)adapter->fw_version, "N/A",
Is "N/A" the right thing to report? Would something like "Unknown" or "Unreported" be better?
> + 3 * sizeof(char));
> + if (!ptr)
> + dev_err(dev, "Failed to inform that firmware version is unavailable to the adapter\n");
The sentence structure here seems awkward. I would probably just get rid of this error and this one later in the function.
dev_err(dev, "Failed to isolate FW level string\n");
Instead just check and report if adapter->fw_version == NULL in the complete: label section.
-Tyrel
> goto complete;
> }
>
^ permalink raw reply
* [PATCH v11 00/10] Application Data Integrity feature introduced by SPARC M7
From: Khalid Aziz @ 2018-02-01 18:01 UTC (permalink / raw)
To: davem, dave.hansen
Cc: Khalid Aziz, aarcange, akpm, allen.pais, anthony.yznaga, arnd,
babu.moger, benh, bob.picco, bsingharora, corbet, dan.j.williams,
dave.jiang, david.j.aldridge, ebiederm, elena.reshetova, glx,
gregkh, hannes, hillf.zj, hpa, hughd, imbrenda, jack, jag.raman,
jane.chu, jglisse, jroedel, khalid, khandual, kirill.shutemov,
kstewart, ktkhai, liam.merwick, linux-arch, linux-doc,
linux-kernel, linux-mm, linuxppc-dev, linux, me, mgorman, mgorman,
mhocko, mike.kravetz, minchan, mingo, mingo, mpe, nadav.amit,
nagarathnam.muthusamy, nborisov, n-horiguchi, nick.alcock,
nitin.m.gupta, ombredanne, pasha.tatashin, paulus, pombredanne,
punit.agrawal, rob.gardner, ross.zwisler, shannon.nelson, shli,
sparclinux, steven.sistare, tglx, thomas.tai, tklauser,
tom.hromatka, vegard.nossum, vijay.ac.kumar, willy, x86, zi.yan
V11 changes:
This series is same as v10 and was simply rebased on 4.15 kernel. Can
mm maintainers please review patches 2, 7, 8 and 9 which are arch
independent, and include/linux/mm.h and mm/ksm.c changes in patch 10
and ack these if everything looks good?
SPARC M7 processor adds additional metadata for memory address space
that can be used to secure access to regions of memory. This additional
metadata is implemented as a 4-bit tag attached to each cacheline size
block of memory. A task can set a tag on any number of such blocks.
Access to such block is granted only if the virtual address used to
access that block of memory has the tag encoded in the uppermost 4 bits
of VA. Since sparc processor does not implement all 64 bits of VA, top 4
bits are available for ADI tags. Any mismatch between tag encoded in VA
and tag set on the memory block results in a trap. Tags are verified in
the VA presented to the MMU and tags are associated with the physical
page VA maps on to. If a memory page is swapped out and page frame gets
reused for another task, the tags are lost and hence must be saved when
swapping or migrating the page.
A userspace task enables ADI through mprotect(). This patch series adds
a page protection bit PROT_ADI and a corresponding VMA flag
VM_SPARC_ADI. VM_SPARC_ADI is used to trigger setting TTE.mcd bit in the
sparc pte that enables ADI checking on the corresponding page. MMU
validates the tag embedded in VA for every page that has TTE.mcd bit set
in its pte. After enabling ADI on a memory range, the userspace task can
set ADI version tags using stxa instruction with ASI_MCD_PRIMARY or
ASI_MCD_ST_BLKINIT_PRIMARY ASI.
Once userspace task calls mprotect() with PROT_ADI, kernel takes
following overall steps:
1. Find the VMAs covering the address range passed in to mprotect and
set VM_SPARC_ADI flag. If address range covers a subset of a VMA, the
VMA will be split.
2. When a page is allocated for a VA and the VMA covering this VA has
VM_SPARC_ADI flag set, set the TTE.mcd bit so MMU will check the
vwersion tag.
3. Userspace can now set version tags on the memory it has enabled ADI
on. Userspace accesses ADI enabled memory using a virtual address that
has the version tag embedded in the high bits. MMU validates this
version tag against the actual tag set on the memory. If tag matches,
MMU performs the VA->PA translation and access is granted. If there is a
mismatch, hypervisor sends a data access exception or precise memory
corruption detected exception depending upon whether precise exceptions
are enabled or not (controlled by MCDPERR register). Kernel sends
SIGSEGV to the task with appropriate si_code.
4. If a page is being swapped out or migrated, kernel must save any ADI
tags set on the page. Kernel maintains a page worth of tag storage
descriptors. Each descriptors pointsto a tag storage space and the
address range it covers. If the page being swapped out or migrated has
ADI enabled on it, kernel finds a tag storage descriptor that covers the
address range for the page or allocates a new descriptor if none of the
existing descriptors cover the address range. Kernel saves tags from the
page into the tag storage space descriptor points to.
5. When the page is swapped back in or reinstantiated after migration,
kernel restores the version tags on the new physical page by retrieving
the original tag from tag storage pointed to by a tag storage descriptor
for the virtual address range for new page.
User task can disable ADI by calling mprotect() again on the memory
range with PROT_ADI bit unset. Kernel clears the VM_SPARC_ADI flag in
VMAs, merges adjacent VMAs if necessary, and clears TTE.mcd bit in the
corresponding ptes.
IOMMU does not support ADI checking. Any version tags embedded in the
top bits of VA meant for IOMMU, are cleared and replaced with sign
extension of the first non-version tag bit (bit 59 for SPARC M7) for
IOMMU addresses.
This patch series adds support for this feature in 10 patches:
Patch 1/10
Tag mismatch on access by a task results in a trap from hypervisor as
data access exception or a precide memory corruption detected
exception. As part of handling these exceptions, kernel sends a
SIGSEGV to user process with special si_code to indicate which fault
occurred. This patch adds three new si_codes to differentiate between
various mismatch errors.
Patch 2/10
When a page is swapped or migrated, metadata associated with the page
must be saved so it can be restored later. This patch adds a new
function that saves/restores this metadata when updating pte upon a
swap/migration.
Patch 3/10
SPARC M7 processor adds new fields to control registers to support ADI
feature. It also adds a new exception for precise traps on tag
mismatch. This patch adds definitions for the new control register
fields, new ASIs for ADI and an exception handler for the precise trap
on tag mismatch.
Patch 4/10
New hypervisor fault types were added by sparc M7 processor to support
ADI feature. This patch adds code to handle these fault types for data
access exception handler.
Patch 5/10
When ADI is in use for a page and a tag mismatch occurs, processor
raises "Memory corruption Detected" trap. This patch adds a handler
for this trap.
Patch 6/10
ADI usage is governed by ADI properties on a platform. These
properties are provided to kernel by firmware. Thsi patch adds new
auxiliary vectors that provide these values to userpsace.
Patch 7/10
arch_validate_prot() is used to validate the new protection bits asked
for by the userspace app. Validating protection bits may need the
context of address space the bits are being applied to. One such
example is PROT_ADI bit on sparc processor that enables ADI protection
on an address range. ADI protection applies only to addresses covered
by physical RAM and not other PFN mapped addresses or device
addresses. This patch adds "address" to the parameters being passed to
arch_validate_prot() to provide that context.
Patch 8/10
When protection bits are changed on a page, kernel carries forward all
protection bits except for read/write/exec. Additional code was added
to allow kernel to clear PKEY bits on x86 but this requirement to
clear other bits is not unique to x86. This patch extends the existing
code to allow other architectures to clear any other protection bits
as well on protection bit change.
Patch 9/10
When a processor supports additional metadata on memory pages, that
additional metadata needs to be copied to new memory pages when those
pages are moved. This patch allows architecture specific code to
replace the default copy_highpage() routine with arch specific
version that copies the metadata as well besides the data on the page.
Patch 10/10
This patch adds support for a user space task to enable ADI and enable
tag checking for subsets of its address space. As part of enabling
this feature, this patch adds to support manipulation of precise
exception for memory corruption detection, adds code to save and
restore tags on page swap and migration, and adds code to handle ADI
tagged addresses for DMA.
Changelog v11:
- Rebased to 4.15
Changelog v10:
- Patch 1/10: Updated si_codes definitions for SEGV to match 4.14
- Patch 2/10: No changes
- Patch 3/10: Updated copyright
- Patch 4/10: No changes
- Patch 5/10: No changes
- Patch 6/10: Updated copyright
- Patch 7/10: No changes
- Patch 8/10: No changes
- Patch 9/10: No changes
- Patch 10/10: Added code to return from kernel path to set
PSTATE.mcde if kernel continues execution in another thread
(Suggested by Anthony)
Changelog v9:
- Patch 1/10: No changes
- Patch 2/10: No changes
- Patch 3/10: No changes
- Patch 4/10: No changes
- Patch 5/10: No changes
- Patch 6/10: No changes
- Patch 7/10: No changes
- Patch 8/10: No changes
- Patch 9/10: New patch
- Patch 10/10: Patch 9 from v8. Added code to copy ADI tags when
pages are migrated. Updated code to detect overflow and underflow
of addresses when allocating tag storage.
Changelog v8:
- Patch 1/9: No changes
- Patch 2/9: Fixed and erroneous "}"
- Patch 3/9: Minor print formatting change
- Patch 4/9: No changes
- Patch 5/9: No changes
- Patch 6/9: Added AT_ADI_UEONADI back
- Patch 7/9: Added addr parameter to powerpc arch_validate_prot()
- Patch 8/9: No changes
- Patch 9/9:
- Documentation updates
- Added an IPI on mprotect(...PROT_ADI...) call and
restore of TSTATE.MCDE on context switch
- Removed restriction on enabling ADI on read-only
memory
- Changed kzalloc() for tag storage to use GFP_NOWAIT
- Added code to handle overflow and underflow when
allocating tag storage
- Replaced sun_m7_patch_1insn_range() with
sun4v_patch_1insn_range()
- Added membar after restoring ADI tags in
copy_user_highpage()
Changelog v7:
- Patch 1/9: No changes
- Patch 2/9: Updated parameters to arch specific swap in/out
handlers
- Patch 3/9: No changes
- Patch 4/9: new patch split off from patch 4/4 in v6
- Patch 5/9: new patch split off from patch 4/4 in v6
- Patch 6/9: new patch split off from patch 4/4 in v6
- Patch 7/9: new patch
- Patch 8/9: new patch
- Patch 9/9:
- Enhanced arch_validate_prot() to enable ADI only on
writable addresses backed by physical RAM
- Added support for saving/restoring ADI tags for each
ADI block size address range on a page on swap in/out
- copy ADI tags on COW
- Updated values for auxiliary vectors to not conflict
with values on other architectures to avoid conflict
in glibc
- Disable same page merging on ADI enabled pages
- Enable ADI only on writable addresses backed by
physical RAM
- Split parts of patch off into separate patches
Changelog v6:
- Patch 1/4: No changes
- Patch 2/4: No changes
- Patch 3/4: Added missing nop in the delay slot in
sun4v_mcd_detect_precise
- Patch 4/4: Eliminated instructions to read and write PSTATE
as well as MCDPER and PMCDPER on every access to userspace
addresses by setting PSTATE and PMCDPER correctly upon entry
into kernel
Changelog v5:
- Patch 1/4: No changes
- Patch 2/4: Replaced set_swp_pte_at() with new architecture
functions arch_do_swap_page() and arch_unmap_one() that
suppoprt architecture specific actions to be taken on page
swap and migration
- Patch 3/4: Fixed indentation issues in assembly code
- Patch 4/4:
- Fixed indentation issues and instrcuctions in assembly
code
- Removed CONFIG_SPARC64 from mdesc.c
- Changed to maintain state of MCDPER register in thread
info flags as opposed to in mm context. MCDPER is a
per-thread state and belongs in thread info flag as
opposed to mm context which is shared across threads.
Added comments to clarify this is a lazily maintained
state and must be updated on context switch and
copy_process()
- Updated code to use the new arch_do_swap_page() and
arch_unmap_one() functions
Testing:
- All functionality was tested with 8K normal pages as well as hugepages
using malloc, mmap and shm.
- Multiple long duration stress tests were run using hugepages over 2+
months. Normal pages were tested with shorter duration stress tests.
- Tested swapping with malloc and shm by reducing max memory and
allocating three times the available system memory by active processes
using ADI on allocated memory. Ran through multiple hours long runs of
this test.
- Tested page migration with malloc and shm by migrating data pages of
active ADI test process using migratepages, back and forth between two
nodes every few seconds over an hour long run. Verified page migration
through /proc/<pid>/numa_maps.
- Tested COW support using test that forks children that read from
ADI enabled pages shared with parent and other children and write to
them as well forcing COW.
---------
Khalid Aziz (10):
signals, sparc: Add signal codes for ADI violations
mm, swap: Add infrastructure for saving page metadata on swap
sparc64: Add support for ADI register fields, ASIs and traps
sparc64: Add HV fault type handlers for ADI related faults
sparc64: Add handler for "Memory Corruption Detected" trap
sparc64: Add auxiliary vectors to report platform ADI properties
mm: Add address parameter to arch_validate_prot()
mm: Clear arch specific VM flags on protection change
mm: Allow arch code to override copy_highpage()
sparc64: Add support for ADI (Application Data Integrity)
Documentation/sparc/adi.txt | 278 ++++++++++++++++++++++
arch/powerpc/include/asm/mman.h | 4 +-
arch/powerpc/kernel/syscalls.c | 2 +-
arch/sparc/include/asm/adi.h | 6 +
arch/sparc/include/asm/adi_64.h | 47 ++++
arch/sparc/include/asm/elf_64.h | 5 +
arch/sparc/include/asm/hypervisor.h | 2 +
arch/sparc/include/asm/mman.h | 84 ++++++-
arch/sparc/include/asm/mmu_64.h | 17 ++
arch/sparc/include/asm/mmu_context_64.h | 50 ++++
arch/sparc/include/asm/page_64.h | 6 +
arch/sparc/include/asm/pgtable_64.h | 48 ++++
arch/sparc/include/asm/thread_info_64.h | 2 +-
arch/sparc/include/asm/trap_block.h | 2 +
arch/sparc/include/asm/ttable.h | 10 +
arch/sparc/include/uapi/asm/asi.h | 5 +
arch/sparc/include/uapi/asm/auxvec.h | 11 +
arch/sparc/include/uapi/asm/mman.h | 2 +
arch/sparc/include/uapi/asm/pstate.h | 10 +
arch/sparc/kernel/Makefile | 1 +
arch/sparc/kernel/adi_64.c | 397 ++++++++++++++++++++++++++++++++
arch/sparc/kernel/entry.h | 3 +
arch/sparc/kernel/etrap_64.S | 27 ++-
arch/sparc/kernel/head_64.S | 1 +
arch/sparc/kernel/mdesc.c | 2 +
arch/sparc/kernel/process_64.c | 25 ++
arch/sparc/kernel/rtrap_64.S | 33 ++-
arch/sparc/kernel/setup_64.c | 2 +
arch/sparc/kernel/sun4v_mcd.S | 18 ++
arch/sparc/kernel/traps_64.c | 142 +++++++++++-
arch/sparc/kernel/ttable_64.S | 6 +-
arch/sparc/kernel/urtt_fill.S | 7 +-
arch/sparc/kernel/vmlinux.lds.S | 5 +
arch/sparc/mm/gup.c | 37 +++
arch/sparc/mm/hugetlbpage.c | 14 +-
arch/sparc/mm/init_64.c | 69 ++++++
arch/sparc/mm/tsb.c | 21 ++
arch/x86/kernel/signal_compat.c | 2 +-
include/asm-generic/pgtable.h | 36 +++
include/linux/highmem.h | 4 +
include/linux/mm.h | 9 +
include/linux/mman.h | 2 +-
include/uapi/asm-generic/siginfo.h | 5 +-
mm/ksm.c | 4 +
mm/memory.c | 1 +
mm/mprotect.c | 4 +-
mm/rmap.c | 14 ++
47 files changed, 1461 insertions(+), 21 deletions(-)
create mode 100644 Documentation/sparc/adi.txt
create mode 100644 arch/sparc/include/asm/adi.h
create mode 100644 arch/sparc/include/asm/adi_64.h
create mode 100644 arch/sparc/kernel/adi_64.c
create mode 100644 arch/sparc/kernel/sun4v_mcd.S
--
2.11.0
^ permalink raw reply
* Re: [PATCH, net] ibmvnic: fix firmware version when no firmware level has been provided by the VIOS server
From: David Miller @ 2018-02-01 19:59 UTC (permalink / raw)
To: desnesn; +Cc: netdev, linuxppc-dev, tlfalcon, jallen, nfont
In-Reply-To: <20180201180430.16950-1-desnesn@linux.vnet.ibm.com>
From: Desnes Augusto Nunes do Rosario <desnesn@linux.vnet.ibm.com>
Date: Thu, 1 Feb 2018 16:04:30 -0200
> Older versions of VIOS servers do not send the firmware level in the VPD
> buffer for the ibmvnic driver. Thus, not only the current message is mis-
> leading but the firmware version in the ethtool will be NULL. Therefore,
> this patch fixes the firmware string and its warning.
>
> Fixes: 4e6759be28e4 ("ibmvnic: Feature implementation of VPD for the ibmvnic driver")
>
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
Applied.
Please do not put empty lines between Fixes: and Signed-off-by: and other
tags, all tags are equal and are placed together in an uninterrupted
sequences of consequetive lines.
Thank you.
^ permalink raw reply
* [PATCH v11 07/10] mm: Add address parameter to arch_validate_prot()
From: Khalid Aziz @ 2018-02-01 18:01 UTC (permalink / raw)
To: akpm, benh, paulus, mpe, davem, dave.hansen
Cc: Khalid Aziz, bsingharora, nborisov, aarcange, anthony.yznaga,
mgorman, kirill.shutemov, dan.j.williams, jack, ross.zwisler,
gregkh, tglx, mhocko, n-horiguchi, jglisse, khandual,
linuxppc-dev, linux-kernel, linux-mm, sparclinux, Khalid Aziz
In-Reply-To: <cover.1517497017.git.khalid.aziz@oracle.com>
A protection flag may not be valid across entire address space and
hence arch_validate_prot() might need the address a protection bit is
being set on to ensure it is a valid protection flag. For example, sparc
processors support memory corruption detection (as part of ADI feature)
flag on memory addresses mapped on to physical RAM but not on PFN mapped
pages or addresses mapped on to devices. This patch adds address to the
parameters being passed to arch_validate_prot() so protection bits can
be validated in the relevant context.
Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
Reviewed-by: Anthony Yznaga <anthony.yznaga@oracle.com>
---
v8:
- Added addr parameter to powerpc arch_validate_prot() (suggested
by Michael Ellerman)
v7:
- new patch
arch/powerpc/include/asm/mman.h | 4 ++--
arch/powerpc/kernel/syscalls.c | 2 +-
include/linux/mman.h | 2 +-
mm/mprotect.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
index 30922f699341..1d129f4521ac 100644
--- a/arch/powerpc/include/asm/mman.h
+++ b/arch/powerpc/include/asm/mman.h
@@ -32,7 +32,7 @@ static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
}
#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-static inline bool arch_validate_prot(unsigned long prot)
+static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
{
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
return false;
@@ -40,7 +40,7 @@ static inline bool arch_validate_prot(unsigned long prot)
return false;
return true;
}
-#define arch_validate_prot(prot) arch_validate_prot(prot)
+#define arch_validate_prot arch_validate_prot
#endif /* CONFIG_PPC64 */
#endif /* _ASM_POWERPC_MMAN_H */
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index a877bf8269fe..6d90ddbd2d11 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -48,7 +48,7 @@ static inline long do_mmap2(unsigned long addr, size_t len,
{
long ret = -EINVAL;
- if (!arch_validate_prot(prot))
+ if (!arch_validate_prot(prot, addr))
goto out;
if (shift) {
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 6a4d1caaff5c..4b08e9c9c538 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -92,7 +92,7 @@ static inline void vm_unacct_memory(long pages)
*
* Returns true if the prot flags are valid
*/
-static inline bool arch_validate_prot(unsigned long prot)
+static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
{
return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0;
}
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 58b629bb70de..80243e0166a7 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -412,7 +412,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
end = start + len;
if (end <= start)
return -ENOMEM;
- if (!arch_validate_prot(prot))
+ if (!arch_validate_prot(prot, start))
return -EINVAL;
reqprot = prot;
--
2.11.0
^ permalink raw reply related
* [RFC] powerpc/mm/pgtable: Split mappings on hot-unplug
From: Balbir Singh @ 2018-02-01 18:18 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david, aneesh.kumar, mpe, Balbir Singh
This patch splits the a linear mapping if the hot-unplug range
is smaller than the mapping size. The code detects if the mapping
needs to be split into a smaller size and if so, uses the stop
machine infrastructure to map the current linear mapping with
a smaller size mapping. Then the requested area is unmapped.
A new API to do a local TLB flush is introduced and exported.
This API is used in stop mapping after clearing the larger
mapping and before creating the smaller mapping. There is also
a check to ensure that we don't overlap with kernel text
(the region that is being split) as it could cause the executing
text to fault.
There are some caveats with this approach, as the unmapping can
cause reserved memory area to be freed up (memblock reserved
mappings and allocations as well), that can be a problem. There
could be a case where radix__map_kernel_page() may fault if the
area selected to unmap contains the process page table, this is
not a new problem created by the patch, but something to watch
out for while testing. The right approach to solving the hot-unplug
issue is to make the node/DIMM to be marked hotpluggable so that
all the memory in that is movable. Currently there is no method
of enforcing the hotpluggable property via libvirt or qemu.
I've tested these changes under a kvm guest with 2 vcpus, from
a split mapping point of view, some of the caveats mentioned
above applied to the testing I did.
TODOs
1. In addition of checking overlapping text, we should check for
reserved memory allocations in the unmapped region
2. The code has duplication across several remove_*pgtable
(pgd/pud/pmd), we could create helper functions to simplify
the functionality.
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
.../powerpc/include/asm/book3s/64/tlbflush-radix.h | 1 +
arch/powerpc/mm/pgtable-radix.c | 130 +++++++++++++++++----
arch/powerpc/mm/tlb-radix.c | 6 +
3 files changed, 116 insertions(+), 21 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
index 6a9e68003387..d1d4104e676d 100644
--- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
+++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
@@ -20,6 +20,7 @@ extern void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
extern void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end);
extern void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
+extern void radix__flush_tlb_local_kernel_range(unsigned long start, unsigned long end);
extern void radix__local_flush_tlb_mm(struct mm_struct *mm);
extern void radix__local_flush_all_mm(struct mm_struct *mm);
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index cfbbee941a76..10b6a1c433ff 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -17,6 +17,7 @@
#include <linux/of_fdt.h>
#include <linux/mm.h>
#include <linux/string_helpers.h>
+#include <linux/stop_machine.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
@@ -671,6 +672,35 @@ static void free_pmd_table(pmd_t *pmd_start, pud_t *pud)
pud_clear(pud);
}
+struct change_mapping_params {
+ pte_t *pte;
+ unsigned long start;
+ unsigned long end;
+ unsigned long size;
+ unsigned long aligned_start;
+ unsigned long aligned_end;
+};
+
+static int stop_machine_change_mapping(void *data)
+{
+ struct change_mapping_params *params =
+ (struct change_mapping_params *)data;
+ unsigned long addr;
+
+ if (!data)
+ return -1;
+
+ spin_unlock(&init_mm.page_table_lock);
+ pte_clear(&init_mm, params->aligned_start, params->pte);
+ radix__flush_tlb_local_kernel_range(params->aligned_start,
+ params->aligned_end);
+ for (addr = params->aligned_start; addr < params->aligned_end;
+ addr += params->size)
+ create_physical_mapping(addr, addr + params->size);
+ spin_lock(&init_mm.page_table_lock);
+ return 0;
+}
+
static void remove_pte_table(pte_t *pte_start, unsigned long addr,
unsigned long end)
{
@@ -699,12 +729,65 @@ static void remove_pte_table(pte_t *pte_start, unsigned long addr,
}
}
+/*
+ * clear the pte and potentially split the mapping helper
+ * Return values are as follows
+ *
+ * 0: pte cleared, no changes required
+ * 1: pte cleared and mapping split
+ * -1: We can't clear this pte range
+ */
+static int clear_and_maybe_split_kernel_mapping(unsigned long addr,
+ unsigned long end, unsigned long size, unsigned long prev_size,
+ pte_t *pte)
+{
+ unsigned long mask = ~(size - 1);
+ unsigned long aligned_start = addr & mask;
+ unsigned long aligned_end = addr + size;
+ struct change_mapping_params params;
+ bool split_region = false;
+
+ if ((end - addr) < size) {
+ /*
+ * We're going to clear the PTE, but not flushed
+ * the mapping, time to remap and flush. The
+ * effects if visible outside the processor or
+ * if we are running in code close to the
+ * mapping we cleared, we are in trouble.
+ */
+ if (overlaps_kernel_text(aligned_start, addr) ||
+ overlaps_kernel_text(end, aligned_end)) {
+ /*
+ * Hack, just return, don't pte_clear
+ */
+ return -1;
+ }
+ split_region = true;
+ }
+
+ if (split_region) {
+ params.pte = pte;
+ params.start = addr;
+ params.end = end;
+ params.size = prev_size;
+ params.aligned_end = aligned_end;
+ params.aligned_end = min_t(unsigned long, aligned_end,
+ (unsigned long)__va(memblock_end_of_DRAM()));
+ stop_machine(stop_machine_change_mapping, ¶ms, NULL);
+ return 1;
+ }
+
+ pte_clear(&init_mm, addr, pte);
+ return 0;
+}
+
static void remove_pmd_table(pmd_t *pmd_start, unsigned long addr,
unsigned long end)
{
unsigned long next;
pte_t *pte_base;
pmd_t *pmd;
+ int rc = 0;
pmd = pmd_start + pmd_index(addr);
for (; addr < end; addr = next, pmd++) {
@@ -714,14 +797,15 @@ static void remove_pmd_table(pmd_t *pmd_start, unsigned long addr,
continue;
if (pmd_huge(*pmd)) {
- if (!IS_ALIGNED(addr, PMD_SIZE) ||
- !IS_ALIGNED(next, PMD_SIZE)) {
- WARN_ONCE(1, "%s: unaligned range\n", __func__);
+ rc = clear_and_maybe_split_kernel_mapping(addr, end,
+ PMD_SIZE, PAGE_SIZE, (pte_t *)pmd);
+ if (rc == 0)
continue;
- }
-
- pte_clear(&init_mm, addr, (pte_t *)pmd);
- continue;
+ if (rc == 1) {
+ pte_base = (pte_t *)pmd_page_vaddr(*pmd);
+ remove_pte_table(pte_base, addr, end);
+ } else
+ return;
}
pte_base = (pte_t *)pmd_page_vaddr(*pmd);
@@ -736,6 +820,7 @@ static void remove_pud_table(pud_t *pud_start, unsigned long addr,
unsigned long next;
pmd_t *pmd_base;
pud_t *pud;
+ int rc = 0;
pud = pud_start + pud_index(addr);
for (; addr < end; addr = next, pud++) {
@@ -745,14 +830,15 @@ static void remove_pud_table(pud_t *pud_start, unsigned long addr,
continue;
if (pud_huge(*pud)) {
- if (!IS_ALIGNED(addr, PUD_SIZE) ||
- !IS_ALIGNED(next, PUD_SIZE)) {
- WARN_ONCE(1, "%s: unaligned range\n", __func__);
+ rc = clear_and_maybe_split_kernel_mapping(addr, end,
+ PUD_SIZE, PMD_SIZE, (pte_t *)pud);
+ if (rc == 0)
continue;
- }
-
- pte_clear(&init_mm, addr, (pte_t *)pud);
- continue;
+ if (rc == 1) {
+ pmd_base = (pmd_t *)pud_page_vaddr(*pud);
+ remove_pmd_table(pmd_base, addr, end);
+ } else
+ return;
}
pmd_base = (pmd_t *)pud_page_vaddr(*pud);
@@ -766,6 +852,7 @@ static void remove_pagetable(unsigned long start, unsigned long end)
unsigned long addr, next;
pud_t *pud_base;
pgd_t *pgd;
+ int rc = 0;
spin_lock(&init_mm.page_table_lock);
@@ -777,14 +864,15 @@ static void remove_pagetable(unsigned long start, unsigned long end)
continue;
if (pgd_huge(*pgd)) {
- if (!IS_ALIGNED(addr, PGDIR_SIZE) ||
- !IS_ALIGNED(next, PGDIR_SIZE)) {
- WARN_ONCE(1, "%s: unaligned range\n", __func__);
+ rc = clear_and_maybe_split_kernel_mapping(addr, end,
+ PGD_SIZE, PUD_SIZE, (pte_t *)pgd);
+ if (rc == 0)
continue;
- }
-
- pte_clear(&init_mm, addr, (pte_t *)pgd);
- continue;
+ if (rc == 1) {
+ pud_base = (pud_t *)pgd_page_vaddr(*pgd);
+ remove_pud_table(pud_base, addr, end);
+ } else
+ return;
}
pud_base = (pud_t *)pgd_page_vaddr(*pgd);
diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
index 884f4b705b57..9bbeaef1ee9b 100644
--- a/arch/powerpc/mm/tlb-radix.c
+++ b/arch/powerpc/mm/tlb-radix.c
@@ -323,6 +323,12 @@ void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end)
}
EXPORT_SYMBOL(radix__flush_tlb_kernel_range);
+void radix__flush_tlb_local_kernel_range(unsigned long start, unsigned long end)
+{
+ _tlbie_pid(0, RIC_FLUSH_ALL);
+}
+EXPORT_SYMBOL(radix__flush_tlb_local_kernel_range);
+
#define TLB_FLUSH_ALL -1UL
/*
--
2.13.6
^ permalink raw reply related
* [PATCH v5 1/1] KVM: PPC: Book3S: Add MMIO emulation for VMX instructions
From: Jose Ricardo Ziviani @ 2018-02-01 18:15 UTC (permalink / raw)
To: linuxppc-dev; +Cc: kvm-ppc, paulus, lvivier
In-Reply-To: <20180201181539.9650-1-joserz@linux.vnet.ibm.com>
This patch provides the MMIO load/store vector indexed
X-Form emulation.
Instructions implemented:
lvx: the quadword in storage addressed by the result of EA &
0xffff_ffff_ffff_fff0 is loaded into VRT.
stvx: the contents of VRS are stored into the quadword in storage
addressed by the result of EA & 0xffff_ffff_ffff_fff0.
Reported-by: Gopesh Kumar Chaudhary <gopchaud@in.ibm.com>
Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_host.h | 2 +
arch/powerpc/include/asm/kvm_ppc.h | 4 +
arch/powerpc/include/asm/ppc-opcode.h | 6 ++
arch/powerpc/kvm/emulate_loadstore.c | 34 ++++++++
arch/powerpc/kvm/powerpc.c | 153 +++++++++++++++++++++++++++++++++-
5 files changed, 198 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 3aa5b577cd60..045acc843e98 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -690,6 +690,7 @@ struct kvm_vcpu_arch {
u8 mmio_vsx_offset;
u8 mmio_vsx_copy_type;
u8 mmio_vsx_tx_sx_enabled;
+ u8 mmio_vmx_copy_nums;
u8 osi_needed;
u8 osi_enabled;
u8 papr_enabled;
@@ -800,6 +801,7 @@ struct kvm_vcpu_arch {
#define KVM_MMIO_REG_QPR 0x0040
#define KVM_MMIO_REG_FQPR 0x0060
#define KVM_MMIO_REG_VSX 0x0080
+#define KVM_MMIO_REG_VMX 0x00c0
#define __KVM_HAVE_ARCH_WQP
#define __KVM_HAVE_CREATE_DEVICE
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 9db18287b5f4..7765a800ddae 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -81,6 +81,10 @@ extern int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
extern int kvmppc_handle_vsx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
unsigned int rt, unsigned int bytes,
int is_default_endian, int mmio_sign_extend);
+extern int kvmppc_handle_load128_by2x64(struct kvm_run *run,
+ struct kvm_vcpu *vcpu, unsigned int rt, int is_default_endian);
+extern int kvmppc_handle_store128_by2x64(struct kvm_run *run,
+ struct kvm_vcpu *vcpu, unsigned int rs, int is_default_endian);
extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
u64 val, unsigned int bytes,
int is_default_endian);
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index ab5c1588b487..f1083bcf449c 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -156,6 +156,12 @@
#define OP_31_XOP_LFDX 599
#define OP_31_XOP_LFDUX 631
+/* VMX Vector Load Instructions */
+#define OP_31_XOP_LVX 103
+
+/* VMX Vector Store Instructions */
+#define OP_31_XOP_STVX 231
+
#define OP_LWZ 32
#define OP_STFS 52
#define OP_STFSU 53
diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
index af833531af31..332b82eafd48 100644
--- a/arch/powerpc/kvm/emulate_loadstore.c
+++ b/arch/powerpc/kvm/emulate_loadstore.c
@@ -58,6 +58,18 @@ static bool kvmppc_check_vsx_disabled(struct kvm_vcpu *vcpu)
}
#endif /* CONFIG_VSX */
+#ifdef CONFIG_ALTIVEC
+static bool kvmppc_check_altivec_disabled(struct kvm_vcpu *vcpu)
+{
+ if (!(kvmppc_get_msr(vcpu) & MSR_VEC)) {
+ kvmppc_core_queue_vec_unavail(vcpu);
+ return true;
+ }
+
+ return false;
+}
+#endif /* CONFIG_ALTIVEC */
+
/*
* XXX to do:
* lfiwax, lfiwzx
@@ -98,6 +110,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
vcpu->arch.mmio_vsx_copy_type = KVMPPC_VSX_COPY_NONE;
vcpu->arch.mmio_sp64_extend = 0;
vcpu->arch.mmio_sign_extend = 0;
+ vcpu->arch.mmio_vmx_copy_nums = 0;
switch (get_op(inst)) {
case 31:
@@ -459,6 +472,27 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
rs, 4, 1);
break;
#endif /* CONFIG_VSX */
+
+#ifdef CONFIG_ALTIVEC
+ case OP_31_XOP_LVX:
+ if (kvmppc_check_altivec_disabled(vcpu))
+ return EMULATE_DONE;
+ vcpu->arch.vaddr_accessed &= ~0xFULL;
+ vcpu->arch.mmio_vmx_copy_nums = 2;
+ emulated = kvmppc_handle_load128_by2x64(run, vcpu,
+ KVM_MMIO_REG_VMX|rt, 1);
+ break;
+
+ case OP_31_XOP_STVX:
+ if (kvmppc_check_altivec_disabled(vcpu))
+ return EMULATE_DONE;
+ vcpu->arch.vaddr_accessed &= ~0xFULL;
+ vcpu->arch.mmio_vmx_copy_nums = 2;
+ emulated = kvmppc_handle_store128_by2x64(run, vcpu,
+ rs, 1);
+ break;
+#endif /* CONFIG_ALTIVEC */
+
default:
emulated = EMULATE_FAIL;
break;
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 1915e86cef6f..a19f42120b38 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -832,7 +832,7 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
kvm->arch.kvm_ops->irq_bypass_del_producer(cons, prod);
}
-#ifdef CONFIG_VSX
+#ifdef CONFIG_ALTIVEC
static inline int kvmppc_get_vsr_dword_offset(int index)
{
int offset;
@@ -848,7 +848,9 @@ static inline int kvmppc_get_vsr_dword_offset(int index)
return offset;
}
+#endif /* CONFIG_ALTIVEC */
+#ifdef CONFIG_VSX
static inline int kvmppc_get_vsr_word_offset(int index)
{
int offset;
@@ -925,6 +927,31 @@ static inline void kvmppc_set_vsr_word(struct kvm_vcpu *vcpu,
}
#endif /* CONFIG_VSX */
+#ifdef CONFIG_ALTIVEC
+static inline void kvmppc_set_vmx_dword(struct kvm_vcpu *vcpu,
+ u64 gpr)
+{
+ int index = vcpu->arch.io_gpr & KVM_MMIO_REG_MASK;
+ u32 hi, lo;
+
+#ifdef __BIG_ENDIAN
+ hi = gpr >> 32;
+ lo = gpr & 0xffffffff;
+#else
+ lo = gpr >> 32;
+ hi = gpr & 0xffffffff;
+#endif
+
+ if (vcpu->arch.mmio_vmx_copy_nums == 1) {
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(2)] = lo;
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(3)] = hi;
+ } else if (vcpu->arch.mmio_vmx_copy_nums == 2) {
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(0)] = lo;
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(1)] = hi;
+ }
+}
+#endif /* CONFIG_ALTIVEC */
+
#ifdef CONFIG_PPC_FPU
static inline u64 sp_to_dp(u32 fprs)
{
@@ -1027,6 +1054,11 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
KVMPPC_VSX_COPY_DWORD_LOAD_DUMP)
kvmppc_set_vsr_dword_dump(vcpu, gpr);
break;
+#endif
+#ifdef CONFIG_ALTIVEC
+ case KVM_MMIO_REG_VMX:
+ kvmppc_set_vmx_dword(vcpu, gpr);
+ break;
#endif
default:
BUG();
@@ -1307,6 +1339,113 @@ static int kvmppc_emulate_mmio_vsx_loadstore(struct kvm_vcpu *vcpu,
}
#endif /* CONFIG_VSX */
+#ifdef CONFIG_ALTIVEC
+/* handle quadword load access in two halves */
+int kvmppc_handle_load128_by2x64(struct kvm_run *run, struct kvm_vcpu *vcpu,
+ unsigned int rt, int is_default_endian)
+{
+ enum emulation_result emulated;
+
+ while (vcpu->arch.mmio_vmx_copy_nums) {
+ emulated = __kvmppc_handle_load(run, vcpu, rt, 8,
+ is_default_endian, 0);
+
+ if (emulated != EMULATE_DONE)
+ break;
+
+ vcpu->arch.paddr_accessed += run->mmio.len;
+ vcpu->arch.mmio_vmx_copy_nums--;
+ }
+
+ return emulated;
+}
+
+static inline int kvmppc_get_vmx_data(struct kvm_vcpu *vcpu, int rs, u64 *val)
+{
+ vector128 vrs = VCPU_VSX_VR(vcpu, rs);
+
+ if (vcpu->arch.mmio_vmx_copy_nums == 1) {
+#ifdef __BIG_ENDIAN
+ *val = vrs.u[kvmppc_get_vsr_word_offset(3)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(2)];
+#else
+ *val = vrs.u[kvmppc_get_vsr_word_offset(2)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(3)];
+#endif
+ return 0;
+ } else if (vcpu->arch.mmio_vmx_copy_nums == 2) {
+#ifdef __BIG_ENDIAN
+ *val = vrs.u[kvmppc_get_vsr_word_offset(1)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(0)];
+#else
+ *val = vrs.u[kvmppc_get_vsr_word_offset(0)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(1)];
+#endif
+ return 0;
+ }
+ return -1;
+}
+
+/* handle quadword store in two halves */
+int kvmppc_handle_store128_by2x64(struct kvm_run *run, struct kvm_vcpu *vcpu,
+ unsigned int rs, int is_default_endian)
+{
+ u64 val = 0;
+ enum emulation_result emulated = EMULATE_DONE;
+
+ vcpu->arch.io_gpr = rs;
+
+ while (vcpu->arch.mmio_vmx_copy_nums) {
+ if (kvmppc_get_vmx_data(vcpu, rs, &val) == -1)
+ return EMULATE_FAIL;
+
+ emulated = kvmppc_handle_store(run, vcpu, val, 8,
+ is_default_endian);
+ if (emulated != EMULATE_DONE)
+ break;
+
+ vcpu->arch.paddr_accessed += run->mmio.len;
+ vcpu->arch.mmio_vmx_copy_nums--;
+ }
+
+ return emulated;
+}
+
+static int kvmppc_emulate_mmio_vmx_loadstore(struct kvm_vcpu *vcpu,
+ struct kvm_run *run)
+{
+ enum emulation_result emulated = EMULATE_FAIL;
+ int r;
+
+ vcpu->arch.paddr_accessed += run->mmio.len;
+
+ if (!vcpu->mmio_is_write) {
+ emulated = kvmppc_handle_load128_by2x64(run, vcpu,
+ vcpu->arch.io_gpr, 1);
+ } else {
+ emulated = kvmppc_handle_store128_by2x64(run, vcpu,
+ vcpu->arch.io_gpr, 1);
+ }
+
+ switch (emulated) {
+ case EMULATE_DO_MMIO:
+ run->exit_reason = KVM_EXIT_MMIO;
+ r = RESUME_HOST;
+ break;
+ case EMULATE_FAIL:
+ pr_info("KVM: MMIO emulation failed (VMX repeat)\n");
+ run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
+ run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
+ r = RESUME_HOST;
+ break;
+ default:
+ r = RESUME_GUEST;
+ break;
+ }
+ return r;
+}
+#endif /* CONFIG_ALTIVEC */
+
int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
{
int r = 0;
@@ -1425,6 +1564,18 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
return r;
}
}
+#endif
+#ifdef CONFIG_ALTIVEC
+ if (vcpu->arch.mmio_vmx_copy_nums > 0)
+ vcpu->arch.mmio_vmx_copy_nums--;
+
+ if (vcpu->arch.mmio_vmx_copy_nums > 0) {
+ r = kvmppc_emulate_mmio_vmx_loadstore(vcpu, run);
+ if (r == RESUME_HOST) {
+ vcpu->mmio_needed = 1;
+ return r;
+ }
+ }
#endif
} else if (vcpu->arch.osi_needed) {
u64 *gprs = run->osi.gprs;
--
2.14.3
^ permalink raw reply related
* [PATCH v5 0/1] Implements MMIO emulation for lvx/stvx instructions
From: Jose Ricardo Ziviani @ 2018-02-01 18:15 UTC (permalink / raw)
To: linuxppc-dev; +Cc: kvm-ppc, paulus, lvivier
v5:
- Fixed the mask off of the effective address
v4:
- Changed KVM_MMIO_REG_VMX to 0xc0 because there are 64 VSX registers
v3:
- Added Reported-by in the commit message
v2:
- kvmppc_get_vsr_word_offset() moved back to its original place
- EA AND ~0xF, following ISA.
- fixed BE/LE cases
TESTS:
For testing purposes I wrote a small program that performs stvx/lvx using the
program's virtual memory and using MMIO. Load/Store into virtual memory is the
model I use to check if MMIO results are correct (because only MMIO is emulated
by KVM).
Results:
HOST LE - GUEST BE
address: 0x10034850010
0x21436587bbbbaaaa4444555578563412
io_address: 0x3fff89a20000
0x21436587bbbbaaaa4444555578563412
HOST LE - GUEST LE
address: 0x10033a20010
0x1234567855554444aaaabbbb87654321
io_address: 0x3fffb5380000
0x1234567855554444aaaabbbb87654321
HOST BE - GUEST BE
address: 0x1002c4a0010
0x21436587bbbbaaaa4444555578563412
io_address: 0x3ffface40000
0x21436587bbbbaaaa4444555578563412
HOST BR - GUEST LE
address: 0x100225e0010
0x1234567855554444aaaabbbb87654321
io_address: 0x3fff7fcb0000
0x1234567855554444aaaabbbb87654321
This patch implements MMIO emulation for two instructions: lvx and stvx.
Jose Ricardo Ziviani (1):
KVM: PPC: Book3S: Add MMIO emulation for VMX instructions
arch/powerpc/include/asm/kvm_host.h | 2 +
arch/powerpc/include/asm/kvm_ppc.h | 4 +
arch/powerpc/include/asm/ppc-opcode.h | 6 ++
arch/powerpc/kvm/emulate_loadstore.c | 34 ++++++++
arch/powerpc/kvm/powerpc.c | 153 +++++++++++++++++++++++++++++++++-
5 files changed, 198 insertions(+), 1 deletion(-)
--
2.14.3
^ permalink raw reply
* [PATCH, net] ibmvnic: fix firmware version when no firmware level has been provided by the VIOS server
From: Desnes Augusto Nunes do Rosario @ 2018-02-01 18:04 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, tlfalcon, jallen, nfont
Older versions of VIOS servers do not send the firmware level in the VPD
buffer for the ibmvnic driver. Thus, not only the current message is mis-
leading but the firmware version in the ethtool will be NULL. Therefore,
this patch fixes the firmware string and its warning.
Fixes: 4e6759be28e4 ("ibmvnic: Feature implementation of VPD for the ibmvnic driver")
Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index b65f5f3ac034..2b3e71b63a7a 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3290,7 +3290,11 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
*/
substr = strnstr(adapter->vpd->buff, "RM", adapter->vpd->len);
if (!substr) {
- dev_info(dev, "No FW level provided by VPD\n");
+ dev_info(dev, "Warning - No FW level has been provided in the VPD buffer by the VIOS Server\n");
+ ptr = strncpy((char *)adapter->fw_version, "N/A",
+ 3 * sizeof(char));
+ if (!ptr)
+ dev_err(dev, "Failed to inform that firmware version is unavailable to the adapter\n");
goto complete;
}
--
2.14.3
^ permalink raw reply related
* [PATCH v2] powerpc: pseries: use of_irq_get helper in request_event_sources_irqs
From: Rob Herring @ 2018-02-01 17:59 UTC (permalink / raw)
To: Michael Ellerman
Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev
Instead of calling both of_irq_parse_one and irq_create_of_mapping, call
of_irq_get instead which does essentially the same thing. of_irq_get
also calls irq_find_host for deferred probe support, but this should be
fine as irq_create_of_mapping also calls that internally. This gets us
closer to making the former 2 functions static.
In the process of simplifying request_event_sources_irqs, combine the
the pr_err and WARN_ON calls to just a WARN().
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
v2:
- Fix infinite loop
- Use of_irq_get instead to irq_of_parse_and_map to preserve handling of
errors
- Combine pr_err and WARN_ON calls to single WARN
arch/powerpc/platforms/pseries/event_sources.c | 40 +++++++++-----------------
1 file changed, 13 insertions(+), 27 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/event_sources.c b/arch/powerpc/platforms/pseries/event_sources.c
index 6eeb0d4bab61..446ef104fb3a 100644
--- a/arch/powerpc/platforms/pseries/event_sources.c
+++ b/arch/powerpc/platforms/pseries/event_sources.c
@@ -16,7 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <asm/prom.h>
+#include <linux/interrupt.h>
+#include <linux/of_irq.h>
#include "pseries.h"
@@ -24,34 +25,19 @@ void request_event_sources_irqs(struct device_node *np,
irq_handler_t handler,
const char *name)
{
- int i, index, count = 0;
- struct of_phandle_args oirq;
- unsigned int virqs[16];
+ int i, virq, rc;
- /* First try to do a proper OF tree parsing */
- for (index = 0; of_irq_parse_one(np, index, &oirq) == 0;
- index++) {
- if (count > 15)
- break;
- virqs[count] = irq_create_of_mapping(&oirq);
- if (!virqs[count]) {
- pr_err("event-sources: Unable to allocate "
- "interrupt number for %pOF\n",
- np);
- WARN_ON(1);
- } else {
- count++;
- }
- }
+ for (i = 0; i < 16; i++) {
+ virq = of_irq_get(np, i);
+ if (virq < 0)
+ return;
+ if (WARN(!virq, "event-sources: Unable to allocate "
+ "interrupt number for %pOF\n", np))
+ continue;
- /* Now request them */
- for (i = 0; i < count; i++) {
- if (request_irq(virqs[i], handler, 0, name, NULL)) {
- pr_err("event-sources: Unable to request interrupt "
- "%d for %pOF\n", virqs[i], np);
- WARN_ON(1);
+ rc = request_irq(virq, handler, 0, name, NULL);
+ if (WARN(rc, "event-sources: Unable to request interrupt %d for %pOF\n",
+ virq, np))
return;
- }
}
}
-
--
2.14.1
^ permalink raw reply related
* [PATCH v4 1/1] KVM: PPC: Book3S: Add MMIO emulation for VMX instructions
From: Jose Ricardo Ziviani @ 2018-02-01 17:34 UTC (permalink / raw)
To: linuxppc-dev; +Cc: kvm-ppc, paulus, lvivier
In-Reply-To: <20180201173410.4625-1-joserz@linux.vnet.ibm.com>
This patch provides the MMIO load/store vector indexed
X-Form emulation.
Instructions implemented:
lvx: the quadword in storage addressed by the result of EA &
0xffff_ffff_ffff_fff0 is loaded into VRT.
stvx: the contents of VRS are stored into the quadword in storage
addressed by the result of EA & 0xffff_ffff_ffff_fff0.
Reported-by: Gopesh Kumar Chaudhary <gopchaud@in.ibm.com>
Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_host.h | 2 +
arch/powerpc/include/asm/kvm_ppc.h | 4 +
arch/powerpc/include/asm/ppc-opcode.h | 6 ++
arch/powerpc/kvm/emulate_loadstore.c | 34 ++++++++
arch/powerpc/kvm/powerpc.c | 153 +++++++++++++++++++++++++++++++++-
5 files changed, 198 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 3aa5b577cd60..045acc843e98 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -690,6 +690,7 @@ struct kvm_vcpu_arch {
u8 mmio_vsx_offset;
u8 mmio_vsx_copy_type;
u8 mmio_vsx_tx_sx_enabled;
+ u8 mmio_vmx_copy_nums;
u8 osi_needed;
u8 osi_enabled;
u8 papr_enabled;
@@ -800,6 +801,7 @@ struct kvm_vcpu_arch {
#define KVM_MMIO_REG_QPR 0x0040
#define KVM_MMIO_REG_FQPR 0x0060
#define KVM_MMIO_REG_VSX 0x0080
+#define KVM_MMIO_REG_VMX 0x00c0
#define __KVM_HAVE_ARCH_WQP
#define __KVM_HAVE_CREATE_DEVICE
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 9db18287b5f4..7765a800ddae 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -81,6 +81,10 @@ extern int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
extern int kvmppc_handle_vsx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
unsigned int rt, unsigned int bytes,
int is_default_endian, int mmio_sign_extend);
+extern int kvmppc_handle_load128_by2x64(struct kvm_run *run,
+ struct kvm_vcpu *vcpu, unsigned int rt, int is_default_endian);
+extern int kvmppc_handle_store128_by2x64(struct kvm_run *run,
+ struct kvm_vcpu *vcpu, unsigned int rs, int is_default_endian);
extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
u64 val, unsigned int bytes,
int is_default_endian);
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index ab5c1588b487..f1083bcf449c 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -156,6 +156,12 @@
#define OP_31_XOP_LFDX 599
#define OP_31_XOP_LFDUX 631
+/* VMX Vector Load Instructions */
+#define OP_31_XOP_LVX 103
+
+/* VMX Vector Store Instructions */
+#define OP_31_XOP_STVX 231
+
#define OP_LWZ 32
#define OP_STFS 52
#define OP_STFSU 53
diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
index af833531af31..7c92b6867f3e 100644
--- a/arch/powerpc/kvm/emulate_loadstore.c
+++ b/arch/powerpc/kvm/emulate_loadstore.c
@@ -58,6 +58,18 @@ static bool kvmppc_check_vsx_disabled(struct kvm_vcpu *vcpu)
}
#endif /* CONFIG_VSX */
+#ifdef CONFIG_ALTIVEC
+static bool kvmppc_check_altivec_disabled(struct kvm_vcpu *vcpu)
+{
+ if (!(kvmppc_get_msr(vcpu) & MSR_VEC)) {
+ kvmppc_core_queue_vec_unavail(vcpu);
+ return true;
+ }
+
+ return false;
+}
+#endif /* CONFIG_ALTIVEC */
+
/*
* XXX to do:
* lfiwax, lfiwzx
@@ -98,6 +110,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
vcpu->arch.mmio_vsx_copy_type = KVMPPC_VSX_COPY_NONE;
vcpu->arch.mmio_sp64_extend = 0;
vcpu->arch.mmio_sign_extend = 0;
+ vcpu->arch.mmio_vmx_copy_nums = 0;
switch (get_op(inst)) {
case 31:
@@ -459,6 +472,27 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
rs, 4, 1);
break;
#endif /* CONFIG_VSX */
+
+#ifdef CONFIG_ALTIVEC
+ case OP_31_XOP_LVX:
+ if (kvmppc_check_altivec_disabled(vcpu))
+ return EMULATE_DONE;
+ vcpu->arch.vaddr_accessed = ~0xFULL;
+ vcpu->arch.mmio_vmx_copy_nums = 2;
+ emulated = kvmppc_handle_load128_by2x64(run, vcpu,
+ KVM_MMIO_REG_VMX|rt, 1);
+ break;
+
+ case OP_31_XOP_STVX:
+ if (kvmppc_check_altivec_disabled(vcpu))
+ return EMULATE_DONE;
+ vcpu->arch.vaddr_accessed = ~0xFULL;
+ vcpu->arch.mmio_vmx_copy_nums = 2;
+ emulated = kvmppc_handle_store128_by2x64(run, vcpu,
+ rs, 1);
+ break;
+#endif /* CONFIG_ALTIVEC */
+
default:
emulated = EMULATE_FAIL;
break;
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 1915e86cef6f..a19f42120b38 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -832,7 +832,7 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
kvm->arch.kvm_ops->irq_bypass_del_producer(cons, prod);
}
-#ifdef CONFIG_VSX
+#ifdef CONFIG_ALTIVEC
static inline int kvmppc_get_vsr_dword_offset(int index)
{
int offset;
@@ -848,7 +848,9 @@ static inline int kvmppc_get_vsr_dword_offset(int index)
return offset;
}
+#endif /* CONFIG_ALTIVEC */
+#ifdef CONFIG_VSX
static inline int kvmppc_get_vsr_word_offset(int index)
{
int offset;
@@ -925,6 +927,31 @@ static inline void kvmppc_set_vsr_word(struct kvm_vcpu *vcpu,
}
#endif /* CONFIG_VSX */
+#ifdef CONFIG_ALTIVEC
+static inline void kvmppc_set_vmx_dword(struct kvm_vcpu *vcpu,
+ u64 gpr)
+{
+ int index = vcpu->arch.io_gpr & KVM_MMIO_REG_MASK;
+ u32 hi, lo;
+
+#ifdef __BIG_ENDIAN
+ hi = gpr >> 32;
+ lo = gpr & 0xffffffff;
+#else
+ lo = gpr >> 32;
+ hi = gpr & 0xffffffff;
+#endif
+
+ if (vcpu->arch.mmio_vmx_copy_nums == 1) {
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(2)] = lo;
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(3)] = hi;
+ } else if (vcpu->arch.mmio_vmx_copy_nums == 2) {
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(0)] = lo;
+ VCPU_VSX_VR(vcpu, index).u[kvmppc_get_vsr_word_offset(1)] = hi;
+ }
+}
+#endif /* CONFIG_ALTIVEC */
+
#ifdef CONFIG_PPC_FPU
static inline u64 sp_to_dp(u32 fprs)
{
@@ -1027,6 +1054,11 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
KVMPPC_VSX_COPY_DWORD_LOAD_DUMP)
kvmppc_set_vsr_dword_dump(vcpu, gpr);
break;
+#endif
+#ifdef CONFIG_ALTIVEC
+ case KVM_MMIO_REG_VMX:
+ kvmppc_set_vmx_dword(vcpu, gpr);
+ break;
#endif
default:
BUG();
@@ -1307,6 +1339,113 @@ static int kvmppc_emulate_mmio_vsx_loadstore(struct kvm_vcpu *vcpu,
}
#endif /* CONFIG_VSX */
+#ifdef CONFIG_ALTIVEC
+/* handle quadword load access in two halves */
+int kvmppc_handle_load128_by2x64(struct kvm_run *run, struct kvm_vcpu *vcpu,
+ unsigned int rt, int is_default_endian)
+{
+ enum emulation_result emulated;
+
+ while (vcpu->arch.mmio_vmx_copy_nums) {
+ emulated = __kvmppc_handle_load(run, vcpu, rt, 8,
+ is_default_endian, 0);
+
+ if (emulated != EMULATE_DONE)
+ break;
+
+ vcpu->arch.paddr_accessed += run->mmio.len;
+ vcpu->arch.mmio_vmx_copy_nums--;
+ }
+
+ return emulated;
+}
+
+static inline int kvmppc_get_vmx_data(struct kvm_vcpu *vcpu, int rs, u64 *val)
+{
+ vector128 vrs = VCPU_VSX_VR(vcpu, rs);
+
+ if (vcpu->arch.mmio_vmx_copy_nums == 1) {
+#ifdef __BIG_ENDIAN
+ *val = vrs.u[kvmppc_get_vsr_word_offset(3)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(2)];
+#else
+ *val = vrs.u[kvmppc_get_vsr_word_offset(2)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(3)];
+#endif
+ return 0;
+ } else if (vcpu->arch.mmio_vmx_copy_nums == 2) {
+#ifdef __BIG_ENDIAN
+ *val = vrs.u[kvmppc_get_vsr_word_offset(1)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(0)];
+#else
+ *val = vrs.u[kvmppc_get_vsr_word_offset(0)];
+ *val = (*val << 32) | vrs.u[kvmppc_get_vsr_word_offset(1)];
+#endif
+ return 0;
+ }
+ return -1;
+}
+
+/* handle quadword store in two halves */
+int kvmppc_handle_store128_by2x64(struct kvm_run *run, struct kvm_vcpu *vcpu,
+ unsigned int rs, int is_default_endian)
+{
+ u64 val = 0;
+ enum emulation_result emulated = EMULATE_DONE;
+
+ vcpu->arch.io_gpr = rs;
+
+ while (vcpu->arch.mmio_vmx_copy_nums) {
+ if (kvmppc_get_vmx_data(vcpu, rs, &val) == -1)
+ return EMULATE_FAIL;
+
+ emulated = kvmppc_handle_store(run, vcpu, val, 8,
+ is_default_endian);
+ if (emulated != EMULATE_DONE)
+ break;
+
+ vcpu->arch.paddr_accessed += run->mmio.len;
+ vcpu->arch.mmio_vmx_copy_nums--;
+ }
+
+ return emulated;
+}
+
+static int kvmppc_emulate_mmio_vmx_loadstore(struct kvm_vcpu *vcpu,
+ struct kvm_run *run)
+{
+ enum emulation_result emulated = EMULATE_FAIL;
+ int r;
+
+ vcpu->arch.paddr_accessed += run->mmio.len;
+
+ if (!vcpu->mmio_is_write) {
+ emulated = kvmppc_handle_load128_by2x64(run, vcpu,
+ vcpu->arch.io_gpr, 1);
+ } else {
+ emulated = kvmppc_handle_store128_by2x64(run, vcpu,
+ vcpu->arch.io_gpr, 1);
+ }
+
+ switch (emulated) {
+ case EMULATE_DO_MMIO:
+ run->exit_reason = KVM_EXIT_MMIO;
+ r = RESUME_HOST;
+ break;
+ case EMULATE_FAIL:
+ pr_info("KVM: MMIO emulation failed (VMX repeat)\n");
+ run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
+ run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
+ r = RESUME_HOST;
+ break;
+ default:
+ r = RESUME_GUEST;
+ break;
+ }
+ return r;
+}
+#endif /* CONFIG_ALTIVEC */
+
int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
{
int r = 0;
@@ -1425,6 +1564,18 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
return r;
}
}
+#endif
+#ifdef CONFIG_ALTIVEC
+ if (vcpu->arch.mmio_vmx_copy_nums > 0)
+ vcpu->arch.mmio_vmx_copy_nums--;
+
+ if (vcpu->arch.mmio_vmx_copy_nums > 0) {
+ r = kvmppc_emulate_mmio_vmx_loadstore(vcpu, run);
+ if (r == RESUME_HOST) {
+ vcpu->mmio_needed = 1;
+ return r;
+ }
+ }
#endif
} else if (vcpu->arch.osi_needed) {
u64 *gprs = run->osi.gprs;
--
2.14.3
^ permalink raw reply related
* [PATCH v4 0/1] Implements MMIO emulation for lvx/stvx instructions
From: Jose Ricardo Ziviani @ 2018-02-01 17:34 UTC (permalink / raw)
To: linuxppc-dev; +Cc: kvm-ppc, paulus, lvivier
v4:
- Changed KVM_MMIO_REG_VMX to 0xc0 because there are 64 VSX registers
v3:
- Added Reported-by in the commit message
v2:
- kvmppc_get_vsr_word_offset() moved back to its original place
- EA AND ~0xF, following ISA.
- fixed BE/LE cases
TESTS:
For testing purposes I wrote a small program that performs stvx/lvx using the
program's virtual memory and using MMIO. Load/Store into virtual memory is the
model I use to check if MMIO results are correct (because only MMIO is emulated
by KVM).
Results:
HOST LE - GUEST BE
address: 0x10034850010
0x21436587bbbbaaaa4444555578563412
io_address: 0x3fff89a20000
0x21436587bbbbaaaa4444555578563412
HOST LE - GUEST LE
address: 0x10033a20010
0x1234567855554444aaaabbbb87654321
io_address: 0x3fffb5380000
0x1234567855554444aaaabbbb87654321
HOST BE - GUEST BE
address: 0x1002c4a0010
0x21436587bbbbaaaa4444555578563412
io_address: 0x3ffface40000
0x21436587bbbbaaaa4444555578563412
HOST BR - GUEST LE
address: 0x100225e0010
0x1234567855554444aaaabbbb87654321
io_address: 0x3fff7fcb0000
0x1234567855554444aaaabbbb87654321
This patch implements MMIO emulation for two instructions: lvx and stvx.
Jose Ricardo Ziviani (1):
KVM: PPC: Book3S: Add MMIO emulation for VMX instructions
arch/powerpc/include/asm/kvm_host.h | 2 +
arch/powerpc/include/asm/kvm_ppc.h | 4 +
arch/powerpc/include/asm/ppc-opcode.h | 6 ++
arch/powerpc/kvm/emulate_loadstore.c | 34 ++++++++
arch/powerpc/kvm/powerpc.c | 153 +++++++++++++++++++++++++++++++++-
5 files changed, 198 insertions(+), 1 deletion(-)
--
2.14.3
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox