Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread David Hildenbrand
On 23.08.2017 08:06, Paul Mackerras wrote: > On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote: >>> On 22.08.2017 17:15, David Hildenbrand wrote: On 22.08.2017 16:28, nixiaoming wrote: > miss kfree(stt) when anon_inode_getfd return fail so add check > anon_inode_getfd return

Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread David Hildenbrand
>>> + mutex_unlock(&kvm->lock); >>> + kvm_put_kvm(kvm); >>> + goto fail; >>> + } >>> + return ret; > > of simply > > if (!ret) if (ret >= 0) return ret; is of course what I meant :) > return 0; > > mutex_lock(&kvm->lock); >

Re: [PATCH RFC 2/7] powerpc: Change analyse_instr so it doesn't modify *regs

2017-08-23 Thread Michael Neuling
On Wed, 2017-08-23 at 09:47 +1000, Paul Mackerras wrote: > The analyse_instr function currently doesn't just work out what an > instruction does, it also executes those instructions whose effect > is only to update CPU registers that are stored in struct pt_regs. > This is undesirable because optpr

Re: [PATCH RFC 0/7] powerpc: Beef up single-stepping/instruction emulation infrastructure

2017-08-23 Thread Michael Neuling
Paulus, > This patch series extends the code in arch/powerpc/lib/sstep.c so that > it handles almost all load and store instructions -- all except the > atomic memory operations (lwat, stwat, etc.).  It also makes sure that > we use the largest possible aligned accesses to access memory and that

答复: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread Nixiaoming
>On 23.08.2017 08:06, Paul Mackerras wrote: >> On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote: On 22.08.2017 17:15, David Hildenbrand wrote: > On 22.08.2017 16:28, nixiaoming wrote: >> miss kfree(stt) when anon_inode_getfd return fail so add check >> anon_inode_getfd r

[PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Alexey Kardashevskiy
Here are few patches to get rid of some cached pointers across EEH and powernv code as I was struggling to figure out about lifetime of structures and so on. This is based on sha1 98b9f8a45499 Linus Torvalds Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso

[PATCH kernel 2/5] powerpc/eeh: Reduce to one the number of places where edev is allocated

2017-08-23 Thread Alexey Kardashevskiy
arch/powerpc/kernel/eeh_dev.c:57 is the only legit place where edev is allocated; other 2 places allocate it on stack and in the heap for a very short period of time to use eeh_pe_get() as takes edev. This changes eeh_pe_get() to receive required parameters explicitly. This removes unnecessary te

[PATCH kernel 3/5] powerpc/eeh: Remove unnecessary pointer to phb from eeh_dev

2017-08-23 Thread Alexey Kardashevskiy
The eeh_dev struct already holds a pointer to pci_dn which it does not exist without and pci_dn itself holds the very same pointer so just use it. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/eeh.h | 1 - arch/powerpc/kernel/eeh.c| 7 +++---

[PATCH kernel 4/5] powerpc/eeh: Remove unnecessary config_addr from eeh_dev

2017-08-23 Thread Alexey Kardashevskiy
The eeh_dev struct hold a config space address of an associated node and the very same address is also stored in the pci_dn struct which is always present during the eeh_dev lifetime. This uses bus:devfn directly from pci_dn instead of cached and packed config_addr. Since config_addr is made from

[PATCH kernel 5/5] powerpc/eeh: Remove unnecessary node from pci_dn

2017-08-23 Thread Alexey Kardashevskiy
The pci_dn struct caches a OF device node pointer in order to access the "ibm,loc-code" property when EEH is recovering. However, when this happens in eeh_dev_check_failure(), we also have a pci_dev pointer which should have a valid pointer to the device node when pci_dn has one (both pointers are

[PATCH kernel 1/5] powerpc/pci: Remove unused parameter from add_one_dev_pci_data()

2017-08-23 Thread Alexey Kardashevskiy
pdev is always NULL, remove it. To make checkpatch.pl happy, this also removes the "out of memory" message. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/pci_dn.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kernel/pci_dn.c b/arc

Re: [PATCH 1/2] powerpc/workqueue: update list of possible CPUs

2017-08-23 Thread Michael Ellerman
Hi Tejun, Tejun Heo writes: > Hello, Michael. > > On Tue, Aug 22, 2017 at 11:41:41AM +1000, Michael Ellerman wrote: >> > This is something powerpc needs to fix. >> >> There is no way for us to fix it. > > I don't think that's true. The CPU id used in kernel doesn't have to > match the physical

Re: [PATCH 1/2] powerpc/workqueue: update list of possible CPUs

2017-08-23 Thread Laurent Vivier
On 23/08/2017 13:00, Michael Ellerman wrote: > Hi Tejun, > > Tejun Heo writes: >> Hello, Michael. >> >> On Tue, Aug 22, 2017 at 11:41:41AM +1000, Michael Ellerman wrote: This is something powerpc needs to fix. >>> >>> There is no way for us to fix it. >> >> I don't think that's true. The CP

Re: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for operations

2017-08-23 Thread Michael Ellerman
Michael Bringmann writes: > To: linuxppc-dev@lists.ozlabs.org > > From: Michael Bringmann > > To: linux-ker...@vger.kernel.org > Cc: Michael Ellerman > Cc: Michael Bringmann > Cc: John Allen > Cc: Nathan Fontenot > Subject: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for > opera

Re: [PATCH V9 1/2] powerpc/numa: Update CPU topology when VPHN enabled

2017-08-23 Thread Michael Ellerman
Michael Bringmann writes: > powerpc/numa: Correct the currently broken capability to set the > topology for shared CPUs in LPARs. At boot time for shared CPU > lpars, the topology for each shared CPU is set to node zero, however, > this is now updated correctly using the Virtual Processor Home N

Re: [PATCH RFC 0/7] powerpc: Beef up single-stepping/instruction emulation infrastructure

2017-08-23 Thread Michael Ellerman
Michael Neuling writes: > Paulus, > >> This patch series extends the code in arch/powerpc/lib/sstep.c so that >> it handles almost all load and store instructions -- all except the >> atomic memory operations (lwat, stwat, etc.).  It also makes sure that >> we use the largest possible aligned ac

Re: [3/6] powerpc/mm: Ensure cpumask update is ordered

2017-08-23 Thread Michael Ellerman
On Mon, 2017-07-24 at 04:28:00 UTC, Benjamin Herrenschmidt wrote: > There is no guarantee that the various isync's involved with > the context switch will order the update of the CPU mask with > the first TLB entry for the new context being loaded by the HW. > > Be safe here and add a memory barri

Re: [PATCH 1/2] powerpc/workqueue: update list of possible CPUs

2017-08-23 Thread Tejun Heo
Hello, Michael. On Wed, Aug 23, 2017 at 09:00:39PM +1000, Michael Ellerman wrote: > > I don't think that's true. The CPU id used in kernel doesn't have to > > match the physical one and arch code should be able to pre-map CPU IDs > > to nodes and use the matching one when hotplugging CPUs. I'm n

Re: [PATCH v2 1/1] Split VGA default device handler out of VGA arbiter

2017-08-23 Thread Ard Biesheuvel
On 22 August 2017 at 23:19, Bjorn Helgaas wrote: > On Mon, Aug 21, 2017 at 11:53:01AM +0100, Lorenzo Pieralisi wrote: >> On Thu, Aug 17, 2017 at 09:30:28PM +1000, Daniel Axtens wrote: >> > A system without PCI legacy resources (e.g. ARM64) may find that no >> > default/boot VGA device has been mar

[PATCH 1/5] powerpc/oops: Fix the oops markers to use pr_cont()

2017-08-23 Thread Michael Ellerman
When we oops we print a few markers for significant config options such as PREEMPT, SMP etc. Currently these appear on separate lines because we're not using pr_cont() properly. Fix it. Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/traps.c | 10 +- 1 file changed, 5 insertions(

[PATCH 2/5] powerpc/oops: Print the kernel's endian in the oops

2017-08-23 Thread Michael Ellerman
Although the MSR tells you what endian you're in it's possible that isn't the same endian the kernel was built for, and if that happens you're usually having a very bad day. So print a marker to make it 100% clear which endian the kernel was built for. Signed-off-by: Michael Ellerman --- arch/po

[PATCH 3/5] powerpc/oops: Use IS_ENABLED() for oops markers

2017-08-23 Thread Michael Ellerman
Just because it looks less gross. Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/traps.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 5a54a6f54f70..f77d954f6622 100644 --- a/arch/

[PATCH 5/5] powerpc/oops: Line up NIP & MSR with other rows

2017-08-23 Thread Michael Ellerman
This is purely cosmetic, but does look nicer IMHO: Before: task: c1453400 task.stack: c1c6c000 NIP: c0a0fbfc LR: c0a0fbf4 CTR: c0ba6220 REGS: c001fffef820 TRAP: 0300 Not tainted (4.13.0-rc6-gcc-6.3.1-00234-g423af27f7d81) MSR: 8000903

[PATCH 4/5] powerpc/oops: Print CR/XER on same line as MSR

2017-08-23 Thread Michael Ellerman
Somehow we missed this when the pr_cont() changes went in. Fix CR/XER to go on the same line as MSR, as they have historically, eg: MSR: 80009032 CR: 4804408a XER: 2000 Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 d

Re: [PATCH v2 1/1] Split VGA default device handler out of VGA arbiter

2017-08-23 Thread Bjorn Helgaas
On Wed, Aug 23, 2017 at 02:48:42PM +0100, Ard Biesheuvel wrote: > On 22 August 2017 at 23:19, Bjorn Helgaas wrote: > > On Mon, Aug 21, 2017 at 11:53:01AM +0100, Lorenzo Pieralisi wrote: > >> On Thu, Aug 17, 2017 at 09:30:28PM +1000, Daniel Axtens wrote: > >> > A system without PCI legacy resources

Re: [PATCH] tpm: vtpm: constify vio_device_id

2017-08-23 Thread Michael Ellerman
Jarkko Sakkinen writes: > On Fri, Aug 18, 2017 at 02:31:56PM -0600, Jason Gunthorpe wrote: >> On Fri, Aug 18, 2017 at 09:32:46PM +1000, Michael Ellerman wrote: >> >> > >> drivers/char/tpm/tpm_ibmvtpm.c | 2 +- >> > >> > Who merges changes for this driver? I assume it's Jarkko? >> >> Yes >> >>

Re: [PATCH V9 1/2] powerpc/numa: Update CPU topology when VPHN enabled

2017-08-23 Thread Nathan Fontenot
On 08/23/2017 06:41 AM, Michael Ellerman wrote: > Michael Bringmann writes: > >> powerpc/numa: Correct the currently broken capability to set the >> topology for shared CPUs in LPARs. At boot time for shared CPU >> lpars, the topology for each shared CPU is set to node zero, however, >> this is

Re: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for operations

2017-08-23 Thread Nathan Fontenot
On 08/21/2017 04:44 PM, Michael Bringmann wrote: > To: linuxppc-dev@lists.ozlabs.org > > From: Michael Bringmann > > To: linux-ker...@vger.kernel.org > Cc: Michael Ellerman > Cc: Michael Bringmann > Cc: John Allen > Cc: Nathan Fontenot > Subject: [PATCH V9 2/2] powerpc/nodes: Ensure enough n

[PATCH 0/4] powerpc/32: memset() optimisations

2017-08-23 Thread Christophe Leroy
This serie provide small optimisation of memset() for PPC32. Christophe Leroy (4): powerpc/32: add memset16() powerpc: fix location of two EXPORT_SYMBOL powerpc/32: optimise memset() powerpc/32: remove a NOP from memset() arch/powerpc/include/asm/string.h | 4 +++- arch/powerpc/kernel/s

[PATCH 1/4] powerpc/32: add memset16()

2017-08-23 Thread Christophe Leroy
Commit 694fc88ce271f ("powerpc/string: Implement optimized memset variants") added memset16(), memset32() and memset64() for the 64 bits PPC. On 32 bits, memset64() is not relevant, and as shown below, the generic version of memset32() gives a good code, so only memset16() is candidate for an opti

[PATCH 2/4] powerpc: fix location of two EXPORT_SYMBOL

2017-08-23 Thread Christophe Leroy
Commit 9445aa1a3062a ("ppc: move exports to definitions") added EXPORT_SYMBOL() for memset() and flush_hash_pages() in the middle of the functions. This patch moves them at the end of the two functions. Signed-off-by: Christophe Leroy --- arch/powerpc/lib/copy_32.S| 2 +- arch/powerpc/mm/ha

[PATCH 3/4] powerpc/32: optimise memset()

2017-08-23 Thread Christophe Leroy
There is no need to extend the set value to an int when the length is lower than 4 as in that case we only do byte stores. We can therefore immediately branch to the part handling it. By separating it from the normal case, we are able to eliminate a few actions on the destination pointer. Signed-o

[PATCH 4/4] powerpc/32: remove a NOP from memset()

2017-08-23 Thread Christophe Leroy
memset() is patched after initialisation to activate the optimised part which uses cache instructions. Today we have a 'b 2f' to skip the optimised patch, which then gets replaced by a NOP, implying a useless cycle consumption. As we have a 'bne 2f' just before, we could use that instruction for t

[PATCH] cxl: Add support for POWER9 DD2

2017-08-23 Thread Christophe Lombard
The PSL initialization sequence has been updated to DD2. This patch adapts to the changes, retaining compatibility with DD1. Tests performed on some of the new hardware. Signed-off-by: Christophe Lombard --- drivers/misc/cxl/cxl.h | 2 ++ drivers/misc/cxl/pci.c | 57 +++

Re: [RFC Part1 PATCH v3 14/17] x86/boot: Add early boot support when running with SEV active

2017-08-23 Thread Borislav Petkov
On Mon, Jul 24, 2017 at 02:07:54PM -0500, Brijesh Singh wrote: > From: Tom Lendacky > > Early in the boot process, add checks to determine if the kernel is > running with Secure Encrypted Virtualization (SEV) active. > > Checking for SEV requires checking that the kernel is running under a > hyp

Re: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for operations

2017-08-23 Thread kbuild test robot
Hi Michael, [auto build test ERROR on powerpc/next] [also build test ERROR on v4.13-rc6 next-20170823] [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/Michael-Bringmann/powerpc-numa-Update-CPU

[PATCH] powerpc/pseries: Don't attempt to acquire drc during memory hot add for assigned lmbs

2017-08-23 Thread John Allen
Check if an LMB is assigned before attempting to call dlpar_acquire_drc in order to avoid any unnecessary rtas calls. This substantially reduces the running time of memory hot add on lpars with large amounts of memory. Signed-off-by: John Allen --- diff --git a/arch/powerpc/platforms/pseries/hotp

Re: [PATCH] powerpc/pseries: Don't attempt to acquire drc during memory hot add for assigned lmbs

2017-08-23 Thread Nathan Fontenot
On 08/23/2017 12:18 PM, John Allen wrote: > Check if an LMB is assigned before attempting to call dlpar_acquire_drc in > order to avoid any unnecessary rtas calls. This substantially reduces the > running time of memory hot add on lpars with large amounts of memory. > > Signed-off-by: John Allen

[PATCH] powerpc/powernv/idle: Round up latency and residency values

2017-08-23 Thread Vaidyanathan Srinivasan
On PowerNV platforms, firmware provides exit latency and target residency for each of the idle states in nano seconds. Cpuidle framework expects the values in micro seconds. Round up to nearest micro seconds to avoid errors in cases where the values are defined as fractional micro seconds. Defau

Re: [PATCH 06/11] ASoC: pxa: make snd_soc_platform_driver const

2017-08-23 Thread Robert Jarzmik
Bhumika Goyal writes: > Make these const as they are only passed as the 2nd argument to the > function devm_snd_soc_register_platform, which is of type const. > Done using Coccinelle. > > Signed-off-by: Bhumika Goyal > --- > sound/soc/pxa/mmp-pcm.c| 2 +- > sound/soc/pxa/pxa2xx-pcm.c | 2 +-

Re: [PATCH v2 1/1] Split VGA default device handler out of VGA arbiter

2017-08-23 Thread Dave Airlie
> Yeah, maybe it's time to disconnect the "default display device" idea > from the VGA arbiter. I have no idea what (if any) dependencies X has > on the legacy VGA resources. I assume X works fine on power, where it > sounds like those resources are rarely or never available. The question on non

Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread Nixiaoming
>On 23.08.2017 08:06, Paul Mackerras wrote: >> On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote: On 22.08.2017 17:15, David Hildenbrand wrote: > On 22.08.2017 16:28, nixiaoming wrote: >> miss kfree(stt) when anon_inode_getfd return fail so add check >> anon_inode_getfd r

Re: [PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Russell Currey
On Wed, 2017-08-23 at 20:18 +1000, Alexey Kardashevskiy wrote: > Here are few patches to get rid of some cached pointers across EEH and > powernv code as I was struggling to figure out about lifetime of > structures and so on. Thanks for the patches. For the whole series: Acked-by: Russell Curre

Re: [PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Alexey Kardashevskiy
On 24/08/17 11:13, Russell Currey wrote: > On Wed, 2017-08-23 at 20:18 +1000, Alexey Kardashevskiy wrote: >> Here are few patches to get rid of some cached pointers across EEH and >> powernv code as I was struggling to figure out about lifetime of >> structures and so on. > > Thanks for the patche

[PATCH] KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()

2017-08-23 Thread Paul Mackerras
Nixiaoming pointed out that there is a memory leak in kvm_vm_ioctl_create_spapr_tce() if the call to anon_inode_getfd() fails; the memory allocated for the kvmppc_spapr_tce_table struct is not freed, and nor are the pages allocated for the iommu tables. In addition, we have already incremented the

Re: [PATCH] KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()

2017-08-23 Thread David Gibson
On Thu, Aug 24, 2017 at 01:40:08PM +1000, Paul Mackerras wrote: > Nixiaoming pointed out that there is a memory leak in > kvm_vm_ioctl_create_spapr_tce() if the call to anon_inode_getfd() > fails; the memory allocated for the kvmppc_spapr_tce_table struct > is not freed, and nor are the pages alloc

Re: [PATCH kernel 1/5] powerpc/pci: Remove unused parameter from add_one_dev_pci_data()

2017-08-23 Thread Andrew Donnellan
On 23/08/17 20:18, Alexey Kardashevskiy wrote: pdev is always NULL, remove it. To make checkpatch.pl happy, this also removes the "out of memory" message. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Andrew Donnellan --- arch/powerpc/kernel/pci_dn.c | 14 ++ 1 file chan

Re: [PATCH kernel 2/5] powerpc/eeh: Reduce to one the number of places where edev is allocated

2017-08-23 Thread Andrew Donnellan
On 23/08/17 20:18, Alexey Kardashevskiy wrote: arch/powerpc/kernel/eeh_dev.c:57 is the only legit place where edev is allocated; other 2 places allocate it on stack and in the heap for a very short period of time to use eeh_pe_get() as takes edev. This changes eeh_pe_get() to receive required pa

Re: [PATCH] powerpc/powernv/idle: Round up latency and residency values

2017-08-23 Thread Gautham R Shenoy
Hi Vaidy, On Thu, Aug 24, 2017 at 12:28:41AM +0530, Vaidyanathan Srinivasan wrote: Cc'ing Rafael and linux-pm list. > On PowerNV platforms, firmware provides exit latency and > target residency for each of the idle states in nano > seconds. Cpuidle framework expects the values in micro > seconds

Re: [PATCH kernel 3/5] powerpc/eeh: Remove unnecessary pointer to phb from eeh_dev

2017-08-23 Thread Andrew Donnellan
On 23/08/17 20:18, Alexey Kardashevskiy wrote: The eeh_dev struct already holds a pointer to pci_dn which it does not exist without and pci_dn itself holds the very same pointer so just use it. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Andrew Donnellan --- arch/powerpc/include/asm

Re: [PATCH kernel 4/5] powerpc/eeh: Remove unnecessary config_addr from eeh_dev

2017-08-23 Thread Andrew Donnellan
On 23/08/17 20:19, Alexey Kardashevskiy wrote: The eeh_dev struct hold a config space address of an associated node and the very same address is also stored in the pci_dn struct which is always present during the eeh_dev lifetime. This uses bus:devfn directly from pci_dn instead of cached and pa

Re: [PATCH kernel 5/5] powerpc/eeh: Remove unnecessary node from pci_dn

2017-08-23 Thread Andrew Donnellan
On 23/08/17 20:19, Alexey Kardashevskiy wrote: The pci_dn struct caches a OF device node pointer in order to access the "ibm,loc-code" property when EEH is recovering. However, when this happens in eeh_dev_check_failure(), we also have a pci_dev pointer which should have a valid pointer to the d

Re: [PATCH] cxl: Add support for POWER9 DD2

2017-08-23 Thread Andrew Donnellan
On 24/08/17 00:58, Christophe Lombard wrote: The PSL initialization sequence has been updated to DD2. This patch adapts to the changes, retaining compatibility with DD1. Tests performed on some of the new hardware. If we're retaining compatibility with DD1 I assume it's been tested on some of

Re: [PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Andrew Donnellan
On 24/08/17 12:19, Alexey Kardashevskiy wrote: On 24/08/17 11:13, Russell Currey wrote: On Wed, 2017-08-23 at 20:18 +1000, Alexey Kardashevskiy wrote: Here are few patches to get rid of some cached pointers across EEH and powernv code as I was struggling to figure out about lifetime of structur

[PATCH] powerpc/xive: Fix the size of the cpumask used in xive_find_target_in_mask()

2017-08-23 Thread Michael Ellerman
From: Cédric Le Goater When called from xive_irq_startup(), the size of the cpumask can be larger than nr_cpu_ids. This can result in a WARN_ON such as: WARNING: CPU: 10 PID: 1 at ../arch/powerpc/sysdev/xive/common.c:476 xive_find_target_in_mask+0x110/0x2f0 ... NIP [c008a310] xive

Re: [PATCH 10/10] powerpc/xive: fix the size of the cpumask used in xive_find_target_in_mask()

2017-08-23 Thread Michael Ellerman
Michael Ellerman writes: > Cédric Le Goater writes: >> When called from xive_irq_startup(), the size of the cpumask can be >> larger than nr_cpu_ids. Most of time, its value is NR_CPUS (2048). ... > > I guess this patch is a good fix, I'll expand the change log a bit. Actually this got lost, be

[PATCH v7 00/12] Enable VAS

2017-08-23 Thread Sukadev Bhattiprolu
Power9 introduces a hardware subsystem referred to as the Virtual Accelerator Switchboard (VAS). VAS allows kernel subsystems and user space processes to directly access the Nest Accelerator (NX) engines which implement compression and encryption algorithms in the hardware. NX has been in Power pr

[PATCH v7 01/12] powerpc/vas: Define macros, register fields and structures

2017-08-23 Thread Sukadev Bhattiprolu
Define macros for the VAS hardware registers and bit-fields as well as couple of data structures needed by the VAS driver. Signed-off-by: Sukadev Bhattiprolu --- Changelog[v7] - Move the threshold control macros from uapi/asm/vas.h to asm/vas.h for now. When we actually have an

[PATCH v7 02/12] Move GET_FIELD/SET_FIELD to vas.h

2017-08-23 Thread Sukadev Bhattiprolu
Move the GET_FIELD and SET_FIELD macros to vas.h as VAS and other users of VAS, including NX-842 can use those macros. There is a lot of related code between the VAS/NX kernel drivers and skiboot. For consistency, switch the order of parameters in SET_FIELD to match the order in skiboot. Signed-o

[PATCH v7 03/12] powerpc/vas: Define vas_init() and vas_exit()

2017-08-23 Thread Sukadev Bhattiprolu
Implement vas_init() and vas_exit() functions for a new VAS module. This VAS module is essentially a library for other device drivers and kernel users of the NX coprocessors like NX-842 and NX-GZIP. In the future this will be extended to add support for user space to access the NX coprocessors. VA

[PATCH v7 04/12] powerpc/vas: Define helpers to access MMIO regions

2017-08-23 Thread Sukadev Bhattiprolu
Define some helper functions to access the MMIO regions. We use these in follow-on patches to read/write VAS hardware registers. They are also used to later issue 'paste' instructions to submit requests to the NX hardware engines. Signed-off-by: Sukadev Bhattiprolu --- Changelog [v6]: - M

[PATCH v7 05/12] powerpc/vas: Define helpers to init window context

2017-08-23 Thread Sukadev Bhattiprolu
Define helpers to initialize window context registers of the VAS hardware. These will be used in follow-on patches when opening/closing VAS windows. Signed-off-by: Sukadev Bhattiprolu --- Changelog[v6] - Add support for FTW windows and drop the fault window id code since it is n

[PATCH v7 06/12] powerpc/vas: Define helpers to alloc/free windows

2017-08-23 Thread Sukadev Bhattiprolu
Define helpers to allocate/free VAS window objects. These will be used in follow-on patches when opening/closing windows. Signed-off-by: Sukadev Bhattiprolu --- arch/powerpc/platforms/powernv/vas-window.c | 70 + 1 file changed, 70 insertions(+) diff --git a/arch/pow

[PATCH v7 07/12] powerpc/vas: Define vas_win_paste_addr()

2017-08-23 Thread Sukadev Bhattiprolu
Define an interface that the NX drivers can use to find the physical paste address of a send window. This interface is expected to be used with the mmap() operation of the NX driver's device. i.e the user space process can use driver's mmap() operation to map the send window's paste address into th

[PATCH v7 08/12] powerpc/vas: Define vas_win_id()

2017-08-23 Thread Sukadev Bhattiprolu
Define an interface to return a system-wide unique id for a given VAS window. The vas_win_id() will be used in a follow-on patch to generate an unique handle for a user space receive window. Applications can use this handle to pair send and receive windows for fast thread-wakeup. The hardware ref

[PATCH v7 09/12] powerpc/vas: Define vas_rx_win_open() interface

2017-08-23 Thread Sukadev Bhattiprolu
Define the vas_rx_win_open() interface. This interface is intended to be used by the Nest Accelerator (NX) driver(s) to setup receive windows for one or more NX engines (which implement compression/encryption algorithms in the hardware). Follow-on patches will provide an interface to close the win

[PATCH v7 10/12] powerpc/vas: Define vas_win_close() interface

2017-08-23 Thread Sukadev Bhattiprolu
Define the vas_win_close() interface which should be used to close a send or receive windows. While the hardware configurations required to open send and receive windows differ, the configuration to close a window is the same for both. So we use a single interface to close the window. Signed-off-

[PATCH v7 11/12] powerpc/vas: Define vas_tx_win_open()

2017-08-23 Thread Sukadev Bhattiprolu
Define an interface to open a VAS send window. This interface is intended to be used the Nest Accelerator (NX) driver(s) to open a send window and use it to submit compression/encryption requests to a VAS receive window. The receive window, identified by the [vasid, cop] parameters, must already b

[PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces

2017-08-23 Thread Sukadev Bhattiprolu
Define interfaces (wrappers) to the 'copy' and 'paste' instructions (which are new in PowerISA 3.0). These are intended to be used to by NX driver(s) to submit Coprocessor Request Blocks (CRBs) to the NX hardware engines. Signed-off-by: Sukadev Bhattiprolu --- Changelog[v4] - Export symb