Re: [PATCH v3] hwmon: Add support for MAX31785 intelligent fan controller

2017-06-07 Thread Andrew Jeffery
On Tue, 2017-06-06 at 06:33 -0700, Guenter Roeck wrote: > On 06/06/2017 12:02 AM, Andrew Jeffery wrote: > > Add a basic driver for the MAX31785, focusing on the fan control > > features but ignoring the temperature and voltage monitoring > > features of the device. > > > > This driver supports all

Re: [PATCH 04/17] Documentation: atomic_ops.txt is core-api/atomic_ops.rst

2017-06-07 Thread Geert Uytterhoeven
CC doc folks On Wed, Jun 7, 2017 at 12:59 AM, Palmer Dabbelt wrote: > I was reading the memory barries documentation in order to make sure the > RISC-V barries were correct, and I found a broken link to the atomic > operations documentation. > > Signed-off-by: Palmer Dabbelt > --- > Documentati

Re: [PATCH 1/3] include: linux: visorbus: Add visorbus to include/linux directory

2017-06-07 Thread Christoph Hellwig
Please don't send any move patches but the actual code added to the kernel proper. And based on what's in linux-next I don't think this giant pile of junk is anywhere near mergeable. -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.

Re: [PATCH 0/3] move visorbus out of staging to drivers/virt/visorbus

2017-06-07 Thread Christoph Hellwig
On Tue, Jun 06, 2017 at 04:49:09PM +0200, Greg KH wrote: > On Mon, Jun 05, 2017 at 04:07:29PM -0400, David Kershner wrote: > > This patchset moves drivers/staging/unisys/include to > > include/linux/visorbus, and moves drivers/staging/unisys/visorbus to > > drivers/virt/visorbus. > > Um, are you t

Re: [PATCH v3] hwmon: Add support for MAX31785 intelligent fan controller

2017-06-07 Thread Guenter Roeck
On Tue, Jun 06, 2017 at 04:32:30PM +0930, Andrew Jeffery wrote: > Add a basic driver for the MAX31785, focusing on the fan control > features but ignoring the temperature and voltage monitoring > features of the device. > > This driver supports all fan control modes and tachometer / PWM > readback

Re: [PATCH v3] hwmon: Add support for MAX31785 intelligent fan controller

2017-06-07 Thread Guenter Roeck
On Wed, Jun 07, 2017 at 04:15:06PM +0930, Andrew Jeffery wrote: > On Wed, 2017-06-07 at 12:18 +0930, Joel Stanley wrote: > > On Wed, Jun 7, 2017 at 1:50 AM, Matthew Barth > > > wrote: > > > > > > On 06/06/17 8:33 AM, Guenter Roeck wrote: > > > > > > > > On 06/06/2017 12:02 AM, Andrew Jeffery wro

Re: [PATCH 03/20] asm-generic: Drop getrlimit and setrlimit syscalls from default list

2017-06-07 Thread Yury Norov
On Mon, Jun 05, 2017 at 03:44:06PM +0100, James Hogan wrote: > Hi Yury, > > On Sun, Jun 04, 2017 at 02:59:52PM +0300, Yury Norov wrote: > > The newer prlimit64 syscall provides all the functionality provided by > > the getrlimit and setrlimit syscalls and adds the pid of target process, > > so fut

[PATCH v6 00/34] x86: Secure Memory Encryption (AMD)

2017-06-07 Thread Tom Lendacky
This patch series provides support for AMD's new Secure Memory Encryption (SME) feature. SME can be used to mark individual pages of memory as encrypted through the page tables. A page of memory that is marked encrypted will be automatically decrypted when read from DRAM and will be automatically

[PATCH v6 03/34] x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use memremap for RAM mappings

2017-06-07 Thread Tom Lendacky
The ioremap() function is intended for mapping MMIO. For RAM, the memremap() function should be used. Convert calls from ioremap() to memremap() when re-mapping RAM. This will be used later by SME to control how the encryption mask is applied to memory mappings, with certain memory locations being

[PATCH v6 01/34] x86: Document AMD Secure Memory Encryption (SME)

2017-06-07 Thread Tom Lendacky
Create a Documentation entry to describe the AMD Secure Memory Encryption (SME) feature and add documentation for the mem_encrypt= kernel parameter. Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- Documentation/admin-guide/kernel-parameters.txt | 11 Documentation/x86/amd-me

[PATCH v6 11/34] x86/mm: Provide general kernel support for memory encryption

2017-06-07 Thread Tom Lendacky
Changes to the existing page table macros will allow the SME support to be enabled in a simple fashion with minimal changes to files that use these macros. Since the memory encryption mask will now be part of the regular pagetable macros, we introduce two new macros (_PAGE_TABLE_NOENC and _KERNPG_

[PATCH v6 14/34] x86/mm: Insure that boot memory areas are mapped properly

2017-06-07 Thread Tom Lendacky
The boot data and command line data are present in memory in a decrypted state and are copied early in the boot process. The early page fault support will map these areas as encrypted, so before attempting to copy them, add decrypted mappings so the data is accessed properly when copied. For the

[PATCH v6 24/34] x86, swiotlb: Add memory encryption support

2017-06-07 Thread Tom Lendacky
Since DMA addresses will effectively look like 48-bit addresses when the memory encryption mask is set, SWIOTLB is needed if the DMA mask of the device performing the DMA does not support 48-bits. SWIOTLB will be initialized to create decrypted bounce buffers for use by these devices. Signed-off-b

[PATCH v6 22/34] x86/mm: Add support for changing the memory encryption attribute

2017-06-07 Thread Tom Lendacky
Add support for changing the memory encryption attribute for one or more memory pages. This will be useful when we have to change the AP trampoline area to not be encrypted. Or when we need to change the SWIOTLB area to not be encrypted in support of devices that can't support the encryption mask r

[PATCH v6 34/34] x86/mm: Add support to make use of Secure Memory Encryption

2017-06-07 Thread Tom Lendacky
Add support to check if SME has been enabled and if memory encryption should be activated (checking of command line option based on the configuration of the default state). If memory encryption is to be activated, then the encryption mask is set and the kernel is encrypted "in place." Signed-off-

[PATCH v6 33/34] x86/boot: Add early cmdline parsing for options with arguments

2017-06-07 Thread Tom Lendacky
Add a cmdline_find_option() function to look for cmdline options that take arguments. The argument is returned in a supplied buffer and the argument length (regardless of whether it fits in the supplied buffer) is returned, with -1 indicating not found. Signed-off-by: Tom Lendacky --- arch/x86/i

[PATCH v6 31/34] x86/mm: Use proper encryption attributes with /dev/mem

2017-06-07 Thread Tom Lendacky
When accessing memory using /dev/mem (or /dev/kmem) use the proper encryption attributes when mapping the memory. To insure the proper attributes are applied when reading or writing /dev/mem, update the xlate_dev_mem_ptr() function to use memremap() which will essentially perform the same steps of

[PATCH v6 32/34] x86/mm: Add support to encrypt the kernel in-place

2017-06-07 Thread Tom Lendacky
Add the support to encrypt the kernel in-place. This is done by creating new page mappings for the kernel - a decrypted write-protected mapping and an encrypted mapping. The kernel is encrypted by copying it through a temporary buffer. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/mem_enc

[PATCH v6 30/34] x86/mm, kexec: Allow kexec to be used with SME

2017-06-07 Thread Tom Lendacky
Provide support so that kexec can be used to boot a kernel when SME is enabled. Support is needed to allocate pages for kexec without encryption. This is needed in order to be able to reboot in the kernel in the same manner as originally booted. Additionally, when shutting down all of the CPUs w

[PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-07 Thread Tom Lendacky
The IOMMU is programmed with physical addresses for the various tables and buffers that are used to communicate between the device and the driver. When the driver allocates this memory it is encrypted. In order for the IOMMU to access the memory as encrypted the encryption mask needs to be included

[PATCH v6 28/34] x86, drm, fbdev: Do not specify encrypted memory for video mappings

2017-06-07 Thread Tom Lendacky
Since video memory needs to be accessed decrypted, be sure that the memory encryption mask is not set for the video ranges. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/vga.h | 14 +- arch/x86/mm/pageattr.c |2 ++ drivers/gpu/drm/drm_gem.c|2

[PATCH v6 29/34] kvm: x86: svm: Support Secure Memory Encryption within KVM

2017-06-07 Thread Tom Lendacky
Update the KVM support to work with SME. The VMCB has a number of fields where physical addresses are used and these addresses must contain the memory encryption mask in order to properly access the encrypted memory. Also, use the memory encryption mask when creating and using the nested page table

[PATCH v6 27/34] x86, realmode: Check for memory encryption on the APs

2017-06-07 Thread Tom Lendacky
Add support to check if memory encryption is active in the kernel and that it has been enabled on the AP. If memory encryption is active in the kernel but has not been enabled on the AP, then set the memory encryption bit (bit 23) of MSR_K8_SYSCFG to enable memory encryption on that AP and allow th

[PATCH v6 25/34] swiotlb: Add warnings for use of bounce buffers with SME

2017-06-07 Thread Tom Lendacky
Add warnings to let the user know when bounce buffers are being used for DMA when SME is active. Since the bounce buffers are not in encrypted memory, these notifications are to allow the user to determine some appropriate action - if necessary. Signed-off-by: Tom Lendacky --- arch/x86/include/

[PATCH v6 23/34] x86, realmode: Decrypt trampoline area if memory encryption is active

2017-06-07 Thread Tom Lendacky
When Secure Memory Encryption is enabled, the trampoline area must not be encrypted. A CPU running in real mode will not be able to decrypt memory that has been encrypted because it will not be able to use addresses with the memory encryption mask. A recent change that added a new system_state val

[PATCH v6 21/34] x86/mm: Add support to access persistent memory in the clear

2017-06-07 Thread Tom Lendacky
Persistent memory is expected to persist across reboots. The encryption key used by SME will change across reboots which will result in corrupted persistent memory. Persistent memory is handed out by block devices through memory remapping functions, so be sure not to map this memory as encrypted.

[PATCH v6 19/34] x86/mm: Add support to access boot related data in the clear

2017-06-07 Thread Tom Lendacky
Boot data (such as EFI related data) is not encrypted when the system is booted because UEFI/BIOS does not run with SME active. In order to access this data properly it needs to be mapped decrypted. Update early_memremap() to provide an arch specific routine to modify the pagetable protection attr

[PATCH v6 18/34] x86/efi: Update EFI pagetable creation to work with SME

2017-06-07 Thread Tom Lendacky
When SME is active, pagetable entries created for EFI need to have the encryption mask set as necessary. When the new pagetable pages are allocated they are mapped encrypted. So, update the efi_pgt value that will be used in cr3 to include the encryption mask so that the PGD table can be read succ

[PATCH v6 17/34] efi: Update efi_mem_type() to return an error rather than 0

2017-06-07 Thread Tom Lendacky
The efi_mem_type() function currently returns a 0, which maps to EFI_RESERVED_TYPE, if the function is unable to find a memmap entry for the supplied physical address. Returning EFI_RESERVED_TYPE implies that a memmap entry exists, when it doesn't. Instead of returning 0, change the function to re

[PATCH v6 16/34] efi: Add an EFI table address match function

2017-06-07 Thread Tom Lendacky
Add a function that will determine if a supplied physical address matches the address of an EFI table. Signed-off-by: Tom Lendacky --- drivers/firmware/efi/efi.c | 33 + include/linux/efi.h|7 +++ 2 files changed, 40 insertions(+) diff --git a/d

[PATCH v6 15/34] x86/boot/e820: Add support to determine the E820 type of an address

2017-06-07 Thread Tom Lendacky
Add a function that will return the E820 type associated with an address range. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/e820/api.h |2 ++ arch/x86/kernel/e820.c | 26 +++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/x86/i

[PATCH v6 13/34] x86/mm: Add support for early encrypt/decrypt of memory

2017-06-07 Thread Tom Lendacky
Add support to be able to either encrypt or decrypt data in place during the early stages of booting the kernel. This does not change the memory encryption attribute - it is used for ensuring that data present in either an encrypted or decrypted memory area is in the proper state (for example the i

[PATCH v6 12/34] x86/mm: Extend early_memremap() support with additional attrs

2017-06-07 Thread Tom Lendacky
Add early_memremap() support to be able to specify encrypted and decrypted mappings with and without write-protection. The use of write-protection is necessary when encrypting data "in place". The write-protect attribute is considered cacheable for loads, but not stores. This implies that the hardw

[PATCH v6 08/34] x86/mm: Add support to enable SME in early boot processing

2017-06-07 Thread Tom Lendacky
Add support to the early boot code to use Secure Memory Encryption (SME). Since the kernel has been loaded into memory in a decrypted state, encrypt the kernel in place and update the early pagetables with the memory encryption mask so that new pagetable entries will use memory encryption. The rou

[PATCH v6 10/34] x86, x86/mm, x86/xen, olpc: Use __va() against just the physical address in cr3

2017-06-07 Thread Tom Lendacky
The cr3 register entry can contain the SME encryption bit that indicates the PGD is encrypted. The encryption bit should not be used when creating a virtual address for the PGD table. Create a new function, read_cr3_pa(), that will extract the physical address from the cr3 register. This function

[PATCH v6 05/34] x86/CPU/AMD: Handle SME reduction in physical address size

2017-06-07 Thread Tom Lendacky
When System Memory Encryption (SME) is enabled, the physical address space is reduced. Adjust the x86_phys_bits value to reflect this reduction. Signed-off-by: Tom Lendacky --- arch/x86/kernel/cpu/amd.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/x86/ker

[PATCH v6 09/34] x86/mm: Simplify p[gum]d_page() macros

2017-06-07 Thread Tom Lendacky
Create a pgd_pfn() macro similar to the p[um]d_pfn() macros and then use the p[gum]d_pfn() macros in the p[gum]d_page() macros instead of duplicating the code. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/pgtable.h | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-)

[PATCH v6 07/34] x86/mm: Don't use phys_to_virt in ioremap() if SME is active

2017-06-07 Thread Tom Lendacky
Currently there is a check if the address being mapped is in the ISA range (is_ISA_range()), and if it is then phys_to_virt() is used to perform the mapping. When SME is active, however, this will result in the mapping having the encryption bit set when it is expected that an ioremap() should not

[PATCH v6 06/34] x86/mm: Add Secure Memory Encryption (SME) support

2017-06-07 Thread Tom Lendacky
Add support for Secure Memory Encryption (SME). This initial support provides a Kconfig entry to build the SME support into the kernel and defines the memory encryption mask that will be used in subsequent patches to mark pages as encrypted. Signed-off-by: Tom Lendacky --- arch/x86/Kconfig

[PATCH v6 04/34] x86/CPU/AMD: Add the Secure Memory Encryption CPU feature

2017-06-07 Thread Tom Lendacky
Update the CPU features to include identifying and reporting on the Secure Memory Encryption (SME) feature. SME is identified by CPUID 0x801f, but requires BIOS support to enable it (set bit 23 of MSR_K8_SYSCFG). Only show the SME feature as available if reported by CPUID and enabled by BIOS.

[PATCH v6 02/34] x86/mm/pat: Set write-protect cache mode for full PAT support

2017-06-07 Thread Tom Lendacky
For processors that support PAT, set the write-protect cache mode (_PAGE_CACHE_MODE_WP) entry to the actual write-protect value (x05). Acked-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/mm/pat.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x8

[PATCH v6 20/34] x86, mpparse: Use memremap to map the mpf and mpc data

2017-06-07 Thread Tom Lendacky
The SMP MP-table is built by UEFI and placed in memory in a decrypted state. These tables are accessed using a mix of early_memremap(), early_memunmap(), phys_to_virt() and virt_to_phys(). Change all accesses to use early_memremap()/early_memunmap(). This allows for proper setting of the encryption

[PATCH 1/3] mm: add vm_insert_mixed_mkwrite()

2017-06-07 Thread Ross Zwisler
To be able to use the common 4k zero page in DAX we need to have our PTE fault path look more like our PMD fault path where a PTE entry can be marked as dirty and writeable as it is first inserted, rather than waiting for a follow-up dax_pfn_mkwrite() => finish_mkwrite_fault() call. Right now we c

[PATCH 2/3] dax: relocate dax_load_hole()

2017-06-07 Thread Ross Zwisler
dax_load_hole() will soon need to call dax_insert_mapping_entry(), so it needs to be moved lower in dax.c so the definition exists. Signed-off-by: Ross Zwisler --- fs/dax.c | 88 1 file changed, 44 insertions(+), 44 deletions(-) d

[PATCH 3/3] dax: use common 4k zero page for dax mmap reads

2017-06-07 Thread Ross Zwisler
When servicing mmap() reads from file holes the current DAX code allocates a page cache page of all zeroes and places the struct page pointer in the mapping->page_tree radix tree. This has two major drawbacks: 1) It consumes memory unnecessarily. For every 4k page that is read via a DAX mmap() o

Re: [PATCH v6 10/34] x86, x86/mm, x86/xen, olpc: Use __va() against just the physical address in cr3

2017-06-07 Thread Boris Ostrovsky
On 06/07/2017 03:14 PM, Tom Lendacky wrote: > The cr3 register entry can contain the SME encryption bit that indicates > the PGD is encrypted. The encryption bit should not be used when creating > a virtual address for the PGD table. > > Create a new function, read_cr3_pa(), that will extract the

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-07 Thread Nick Sarnie
On Wed, Jun 7, 2017 at 3:17 PM, Tom Lendacky wrote: > The IOMMU is programmed with physical addresses for the various tables > and buffers that are used to communicate between the device and the > driver. When the driver allocates this memory it is encrypted. In order > for the IOMMU to access the

Re: [PATCH v6 00/34] x86: Secure Memory Encryption (AMD)

2017-06-07 Thread Nick Sarnie
On Wed, Jun 7, 2017 at 3:13 PM, Tom Lendacky wrote: > This patch series provides support for AMD's new Secure Memory Encryption > (SME) > feature. > > SME can be used to mark individual pages of memory as encrypted through the > page tables. A page of memory that is marked encrypted will be autom

Re: [PATCH v6 19/34] x86/mm: Add support to access boot related data in the clear

2017-06-07 Thread kbuild test robot
Hi Tom, [auto build test ERROR on linus/master] [also build test ERROR on v4.12-rc4 next-20170607] [cannot apply to tip/x86/core] [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/Tom-Lendacky/x86

Re: [PATCH v6 25/34] swiotlb: Add warnings for use of bounce buffers with SME

2017-06-07 Thread kbuild test robot
Hi Tom, [auto build test ERROR on linus/master] [also build test ERROR on v4.12-rc4 next-20170607] [cannot apply to tip/x86/core] [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/Tom-Lendacky/x86

Re: [PATCH v6 10/34] x86, x86/mm, x86/xen, olpc: Use __va() against just the physical address in cr3

2017-06-07 Thread Andy Lutomirski
On Wed, Jun 7, 2017 at 12:14 PM, Tom Lendacky wrote: > The cr3 register entry can contain the SME encryption bit that indicates > the PGD is encrypted. The encryption bit should not be used when creating > a virtual address for the PGD table. > > Create a new function, read_cr3_pa(), that will ex

Re: [PATCH v3] hwmon: Add support for MAX31785 intelligent fan controller

2017-06-07 Thread Andrew Jeffery
On Wed, 2017-06-07 at 10:37 -0700, Guenter Roeck wrote: > On Wed, Jun 07, 2017 at 04:15:06PM +0930, Andrew Jeffery wrote: > > On Wed, 2017-06-07 at 12:18 +0930, Joel Stanley wrote: > > > On Wed, Jun 7, 2017 at 1:50 AM, Matthew Barth > > > > > > > > wrote: > > > > > > > > On 06/06/17 8:33 AM, Guen