* Re: [alsa-devel] [PATCH 05/10] ASoC: fsl_sai: Add support to enable multiple data lines
From: Daniel Baluta @ 2019-07-24 8:58 UTC (permalink / raw)
To: Lucas Stach
Cc: Linux-ALSA, Fabio Estevam, Pengutronix Kernel Team, Timur Tabi,
Xiubo Li, linuxppc-dev, S.j. Wang, Angus Ainslie (Purism),
Takashi Iwai, Linux Kernel Mailing List, Nicolin Chen, Mark Brown,
dl-linux-imx, Viorel Suman, Daniel Baluta
In-Reply-To: <1563800148.2311.9.camel@pengutronix.de>
On Mon, Jul 22, 2019 at 3:58 PM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Am Montag, den 22.07.2019, 15:48 +0300 schrieb Daniel Baluta:
> > SAI supports up to 8 Rx/Tx data lines which can be enabled
> > using TCE/RCE bits of TCR3/RCR3 registers.
> >
> > Data lines to be enabled are read from DT fsl,dl_mask property.
> > By default (if no DT entry is provided) only data line 0 is enabled.
> >
> > Note:
> > We can only enable consecutive data lines starting with data line #0.
>
> Why is the property a bitmask then? To me this sounds like we want to
> have the number of lanes in the DT and convert to the bitmask inside
> the driver.
Actually my comment might be wrong. I have read the documentation again
and it seems that: We can only enable consecutive data lines
*ONLY* if combine mode is enabled.
Thus, if combine mode is disabled we can independently enable any data
line. I will clarify this with IP owner and correct the patch accordingly.
>
> > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > ---
> > sound/soc/fsl/fsl_sai.c | 10 +++++++++-
> > sound/soc/fsl/fsl_sai.h | 6 ++++--
> > 2 files changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> > index 768341608695..d0fa02188b7c 100644
> > --- a/sound/soc/fsl/fsl_sai.c
> > +++ b/sound/soc/fsl/fsl_sai.c
> > @@ -601,7 +601,7 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream,
> >
> > > regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx),
> > > FSL_SAI_CR3_TRCE_MASK,
> > > - FSL_SAI_CR3_TRCE);
> > > + FSL_SAI_CR3_TRCE(sai->soc_data->dl_mask[tx]);
> >
> > > ret = snd_pcm_hw_constraint_list(substream->runtime, 0,
> > > SNDRV_PCM_HW_PARAM_RATE, &fsl_sai_rate_constraints);
> > @@ -887,6 +887,14 @@ static int fsl_sai_probe(struct platform_device *pdev)
> > > }
> > > }
> >
> > > + /* active data lines mask for TX/RX, defaults to 1 (only the first
> > > + * data line is enabled
> > + */
>
> Comment style not in line with Linux coding style.
Will fix. Thanks Lucas for review.
Should be like this, right?
/*
* comment
*/
checkpatch.pl warned me only about the end of the comment :).
^ permalink raw reply
* Re: [DOC][PATCH v5 1/4] powerpc: Document some HCalls for Storage Class Memory
From: Laurent Dufour @ 2019-07-24 9:08 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev
Cc: Oliver O'Halloran, Aneesh Kumar K . V, David Gibson
In-Reply-To: <20190723161357.26718-2-vaibhav@linux.ibm.com>
Le 23/07/2019 à 18:13, Vaibhav Jain a écrit :
> This doc patch provides an initial description of the HCall op-codes
> that are used by Linux kernel running as a guest operating
> system (LPAR) on top of PowerVM or any other sPAPR compliant
> hyper-visor (e.g qemu).
>
> Apart from documenting the HCalls the doc-patch also provides a
> rudimentary overview of how Hcalls are implemented inside the Linux
> kernel and how information flows between kernel and PowerVM/KVM.
Hi Vaibhav,
That's a good idea to introduce such a documentation.
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
> Change-log:
>
> v5
> * First patch in this patchset.
> ---
> Documentation/powerpc/hcalls.txt | 140 +++++++++++++++++++++++++++++++
> 1 file changed, 140 insertions(+)
> create mode 100644 Documentation/powerpc/hcalls.txt
>
> diff --git a/Documentation/powerpc/hcalls.txt b/Documentation/powerpc/hcalls.txt
> new file mode 100644
> index 000000000000..cc9dd872cecd
> --- /dev/null
> +++ b/Documentation/powerpc/hcalls.txt
> @@ -0,0 +1,140 @@
> +Hyper-visor Call Op-codes (HCALLS)
> +====================================
> +
> +Overview
> +=========
> +
> +Virtualization on PPC64 arch is based on the PAPR specification[1] which
> +describes run-time environment for a guest operating system and how it should
> +interact with the hyper-visor for privileged operations. Currently there are two
> +PAPR compliant hypervisors (PHYP):
> +
> +IBM PowerVM: IBM's proprietary hyper-visor that supports AIX, IBM-i and Linux as
> + supported guests (termed as Logical Partitions or LPARS).
> +
> +Qemu/KVM: Supports PPC64 linux guests running on a PPC64 linux host.
> +
> +On PPC64 arch a virtualized guest kernel runs in a non-privileged mode (HV=0).
> +Hence to perform a privileged operations the guest issues a Hyper-visor
> +Call (HCALL) with necessary input operands. PHYP after performing the privilege
> +operation returns a status code and output operands back to the guest.
> +
> +HCALL ABI
> +=========
> +The ABI specification for a HCall between guest os kernel and PHYP is
> +described in [1]. The Opcode for Hcall is set in R3 and subsequent in-arguments
> +for the Hcall are provided in registers R4-R12. On return from 'HVCS'
> +instruction the status code of HCall is available in R3 an the output parameters
> +are returned in registers R4-R12.
Would it be good to mention that values passed through the memory must be
stored in Big Endian format ?
> +Powerpc arch code provides convenient wrappers named plpar_hcall_xxx defined in
> +header 'hvcall.h' to issue HCalls from the linux kernel running as guest.
> +
> +
> +DRC & DRC Indexes
> +=================
> +
> + PAPR Guest
> + DR1 Hypervisor OS
> + +--+ +----------+ +---------+
> + | |<------>| | | User |
> + +--+ DRC1 | | DRC | Space |
> + | | Index +---------+
> + DR2 | | | |
> + +--+ | |<------->| Kernel |
> + | |<----- >| | HCall | |
> + +--+ DRC2 +----------+ +---------+
> +
> +PHYP terms shared hardware resources like PCI devices, NVDimms etc available for
> +use by LPARs as Dynamic Resource (DR). When a DR is allocated to an LPAR, PHYP
> +creates a data-structure called Dynamic Resource Connector (DRC) to manage LPAR
> +access. An LPAR refers to a DRC via an opaque 32-bit number called DRC-Index.
> +The DRC-index value is provided to the LPAR via device-tree where its present
> +as an attribute in the device tree node associated with the DR.
Should you use the term 'Hypervisor' instead of 'PHYP' which is not usually
designing only the proprietary one ?
Thanks,
Laurent.
> +
> +HCALL Op-codes
> +==============
> +
> +Below is a partial of of HCALLs that are supported by PHYP. For the
> +corresponding opcode values please look into the header
> +'arch/powerpc/include/asm/hvcall.h' :
> +
> +* H_SCM_READ_METADATA:
> + Input: drcIndex, offset, buffer-address, numBytesToRead
> + Out: None
> + Description:
> + Given a DRC Index of an NVDimm, read N-bytes from the the meta data area
> + associated with it, at a specified offset and copy it to provided buffer.
> + The metadata area stores configuration information such as label information,
> + bad-blocks etc. The metadata area is located out-of-band of NVDimm storage
> + area hence a separate access semantics is provided.
> +
> +* H_SCM_WRITE_METADATA:
> + Input: drcIndex, offset, data, numBytesToWrite
> + Out: None
> + Description:
> + Given a DRC Index of an NVDimm, write N-bytes from provided buffer at the
> + given offset to the the meta data area associated with the NVDimm.
> +
> +
> +* H_SCM_BIND_MEM:
> + Input: drcIndex, startingScmBlockIndex, numScmBlocksToBind, targetAddress
> + Out: guestMappedAddress, numScmBlockBound
> + Description:
> + Given a DRC-Index of an NVDimm, maps the SCM (Storage Class Memory) blocks to
> + continuous logical addresses in guest physical address space. The HCALL
> + arguments can be used to map partial range of SCM blocks instead of entire
> + NVDimm range to the LPAR.
> +
> +* H_SCM_UNBIND_MEM:
> + Input: drcIndex, startingScmLogicalMemoryAddress, numScmBlocksToUnbind
> + Out: numScmBlocksUnbound
> + Description:
> + Given a DRC-Index of an NVDimm, unmap one or more the SCM blocks from guest
> + physical address space. The HCALL can fail if the Guest has an active PTE
> + entry to the SCM block being unbinded.
> +
> +* H_SCM_QUERY_BLOCK_MEM_BINDING:
> + Input: drcIndex, scmBlockIndex
> + Out: Guest-Physical-Address
> + Description:
> + Given a DRC-Index and an SCM Block index return the guest physical address to
> + which the SCM block is mapped to.
> +
> +* H_SCM_QUERY_LOGICAL_MEM_BINDING:
> + Input: Guest-Physical-Address
> + Out: drcIndex, scmBlockIndex
> + Description:
> + Given a guest physical address return which DRC Index and SCM block is mapped
> + to that address.
> +
> +* H_SCM_UNBIND_ALL:
> + Input: scmTargetScope, drcIndex
> + Out: None
> + Description:
> + Depending on the Target scope unmap all scm blocks belonging to all NVDimms
> + or all scm blocks belonging to a single NVDimm identified by its drcIndex
> + from the LPAR memory.
> +
> +* H_SCM_HEALTH:
> + Input: drcIndex
> + Output: health-bitmap, health-bit-valid-bitmap
> + Description:
> + Given a DRC Index return the info on predictive failure and over all health of
> + the NVDimm. The asserted bits in the health-bitmap indicate a single predictive
> + failure and health-bit-valid-bitmap indicate which bits in health-bitmap are
> + valid.
> +
> +
> +* H_SCM_PERFORMANCE_STATS:
> + Input: drcIndex, resultBuffer Addr
> + Out: None
> + Description:
> + Given a DRC Index collect the performance statistics for NVDimm and copy them
> + to the resultBuffer.
> +
> +
> +References
> +==========
> +[1]: "Linux on Power Architecture Platform Reference"
> + https://members.openpowerfoundation.org/document/dl/469
>
^ permalink raw reply
* Re: [PATCH v5 4/4] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
From: Laurent Dufour @ 2019-07-24 9:17 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev
Cc: Oliver O'Halloran, Aneesh Kumar K . V, David Gibson
In-Reply-To: <20190723161357.26718-5-vaibhav@linux.ibm.com>
Le 23/07/2019 à 18:13, Vaibhav Jain a écrit :
> In some cases initial bind of scm memory for an lpar can fail if
> previously it wasn't released using a scm-unbind hcall. This situation
> can arise due to panic of the previous kernel or forced lpar
> fadump. In such cases the H_SCM_BIND_MEM return a H_OVERLAP error.
>
> To mitigate such cases the patch updates papr_scm_probe() to force a
> call to drc_pmem_unbind() in case the initial bind of scm memory fails
> with EBUSY error. In case scm-bind operation again fails after the
> forced scm-unbind then we follow the existing error path. We also
> update drc_pmem_bind() to handle the H_OVERLAP error returned by phyp
> and indicate it as a EBUSY error back to the caller.
>
> Suggested-by: "Oliver O'Halloran" <oohall@gmail.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
> ---
> Change-log:
>
> v5:
> * None. Re-spinning the patchset.
>
> v4:
> * None. Re-spinning the patchset.
>
> v3:
> * Minor update to a code comment. [Oliver]
>
> v2:
> * Moved the retry code from drc_pmem_bind() to papr_scm_probe()
> [Oliver]
> * Changed the type of variable 'rc' in drc_pmem_bind() to
> int64_t. [Oliver]
> ---
> arch/powerpc/platforms/pseries/papr_scm.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
> index 82568a7e0a7c..2c07908359b2 100644
> --- a/arch/powerpc/platforms/pseries/papr_scm.c
> +++ b/arch/powerpc/platforms/pseries/papr_scm.c
> @@ -44,8 +44,9 @@ struct papr_scm_priv {
> static int drc_pmem_bind(struct papr_scm_priv *p)
> {
> unsigned long ret[PLPAR_HCALL_BUFSIZE];
> - uint64_t rc, token;
> uint64_t saved = 0;
> + uint64_t token;
> + int64_t rc;
>
> /*
> * When the hypervisor cannot map all the requested memory in a single
> @@ -65,6 +66,10 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
> } while (rc == H_BUSY);
>
> if (rc) {
> + /* H_OVERLAP needs a separate error path */
> + if (rc == H_OVERLAP)
> + return -EBUSY;
> +
> dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
> return -ENXIO;
> }
> @@ -404,6 +409,14 @@ static int papr_scm_probe(struct platform_device *pdev)
>
> /* request the hypervisor to bind this region to somewhere in memory */
> rc = drc_pmem_bind(p);
> +
> + /* If phyp says drc memory still bound then force unbound and retry */
> + if (rc == -EBUSY) {
> + dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
> + drc_pmem_unbind(p);
> + rc = drc_pmem_bind(p);
In the unlikely case where H_SCM_BIND_MEM is returning H_OVERLAP once the
unbinding has been done, the error would be silently processed. That sounds
really unlikely, but should an error message be displayed in this
particular case ?
> + }
> +
> if (rc)
> goto err;
>
^ permalink raw reply
* Re: [PATCH v5 4/4] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
From: Oliver O'Halloran @ 2019-07-24 9:24 UTC (permalink / raw)
To: Laurent Dufour
Cc: Vaibhav Jain, David Gibson, linuxppc-dev, Aneesh Kumar K . V
In-Reply-To: <fa75968e-1417-ef02-4f5e-5ba34c778377@linux.vnet.ibm.com>
On Wed, Jul 24, 2019 at 7:17 PM Laurent Dufour
<ldufour@linux.vnet.ibm.com> wrote:
>
> Le 23/07/2019 à 18:13, Vaibhav Jain a écrit :
> > *snip*
> > @@ -404,6 +409,14 @@ static int papr_scm_probe(struct platform_device *pdev)
> >
> > /* request the hypervisor to bind this region to somewhere in memory */
> > rc = drc_pmem_bind(p);
> > +
> > + /* If phyp says drc memory still bound then force unbound and retry */
> > + if (rc == -EBUSY) {
> > + dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
> > + drc_pmem_unbind(p);
> > + rc = drc_pmem_bind(p);
>
> In the unlikely case where H_SCM_BIND_MEM is returning H_OVERLAP once the
> unbinding has been done, the error would be silently processed. That sounds
> really unlikely, but should an error message be displayed in this
> particular case ?
drc_pmem_bind() prints the h-call error code if we get one, so it's not silent
^ permalink raw reply
* Re: [PATCH v3 9/9] powerpc/eeh: Convert log messages to eeh_edev_* macros
From: kbuild test robot @ 2019-07-24 9:23 UTC (permalink / raw)
To: Sam Bobroff; +Cc: aik, oohall, linuxppc-dev, kbuild-all, tyreld
In-Reply-To: <d5bbb2e9a39da905d656524bdf9e1b6705fd526a.1563853440.git.sbobroff@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3776 bytes --]
Hi Sam,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.3-rc1 next-20190724]
[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/Sam-Bobroff/powerpc-64-Adjust-order-in-pcibios_init/20190724-134001
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arch/powerpc/kernel/eeh_driver.c: In function 'eeh_add_virt_device':
>> arch/powerpc/kernel/eeh_driver.c:459:17: error: unused variable 'pdn' [-Werror=unused-variable]
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
^~~
cc1: all warnings being treated as errors
vim +/pdn +459 arch/powerpc/kernel/eeh_driver.c
77bd7415 arch/powerpc/platforms/pseries/eeh_driver.c Linas Vepstas 2005-11-03 454
bf773df9 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-09-12 455 static void *eeh_add_virt_device(struct eeh_dev *edev)
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 456 {
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 457 struct pci_driver *driver;
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 458 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 @459 struct pci_dn *pdn = eeh_dev_to_pdn(edev);
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 460
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 461 if (!(edev->physfn)) {
6dad7bbd arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2019-07-23 462 eeh_edev_warn(edev, "Not for VF\n");
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 463 return NULL;
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 464 }
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 465
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 466 driver = eeh_pcid_get(dev);
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 467 if (driver) {
46d4be41 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-05-25 468 if (driver->err_handler) {
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 469 eeh_pcid_put(dev);
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 470 return NULL;
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 471 }
46d4be41 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-05-25 472 eeh_pcid_put(dev);
46d4be41 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-05-25 473 }
67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 474
:::::: The code at line 459 was first introduced by commit
:::::: 67086e32b56481531ab1292b284e074b1a8d764c powerpc/eeh: powerpc/eeh: Support error recovery for VF PE
:::::: TO: Wei Yang <weiyang@linux.vnet.ibm.com>
:::::: CC: Michael Ellerman <mpe@ellerman.id.au>
---
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: 25333 bytes --]
^ permalink raw reply
* Re: [PATCH v5 4/4] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
From: Laurent Dufour @ 2019-07-24 9:27 UTC (permalink / raw)
To: Oliver O'Halloran
Cc: Vaibhav Jain, David Gibson, linuxppc-dev, Aneesh Kumar K . V
In-Reply-To: <CAOSf1CFA14eRY66J0gHAvNnWGzFTFmb3-RKQ3+XjrqdG0jxk6g@mail.gmail.com>
Le 24/07/2019 à 11:24, Oliver O'Halloran a écrit :
> On Wed, Jul 24, 2019 at 7:17 PM Laurent Dufour
> <ldufour@linux.vnet.ibm.com> wrote:
>>
>> Le 23/07/2019 à 18:13, Vaibhav Jain a écrit :
>>> *snip*
>>> @@ -404,6 +409,14 @@ static int papr_scm_probe(struct platform_device *pdev)
>>>
>>> /* request the hypervisor to bind this region to somewhere in memory */
>>> rc = drc_pmem_bind(p);
>>> +
>>> + /* If phyp says drc memory still bound then force unbound and retry */
>>> + if (rc == -EBUSY) {
>>> + dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
>>> + drc_pmem_unbind(p);
>>> + rc = drc_pmem_bind(p);
>>
>> In the unlikely case where H_SCM_BIND_MEM is returning H_OVERLAP once the
>> unbinding has been done, the error would be silently processed. That sounds
>> really unlikely, but should an error message be displayed in this
>> particular case ?
>
> drc_pmem_bind() prints the h-call error code if we get one, so it's not silent
That's no more the case whith this patch, H_OVERLAP is handled before
writing the error message, which would make sense for the first try.
For the record, the patch introduces:
@@ -65,6 +66,10 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
} while (rc == H_BUSY);
if (rc) {
+ /* H_OVERLAP needs a separate error path */
+ if (rc == H_OVERLAP)
+ return -EBUSY;
+
dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
return -ENXIO;
}
^ permalink raw reply
* Re: [PATCH] powerpc: Wire up clone3 syscall
From: Christian Brauner @ 2019-07-24 9:31 UTC (permalink / raw)
To: Arseny Solokha; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <87ftmwknr9.fsf@kb.kras.ru>
On Wed, Jul 24, 2019 at 12:25:14PM +0700, Arseny Solokha wrote:
> Hi,
>
> may I also ask to provide ppc_clone3 symbol also for 32-bit powerpc? Otherwise
> Michael's patch breaks build for me:
Makes sense. Michael, are you planning on picking this up? :)
Christian
>
> powerpc-e500v2-linux-gnuspe-ld: arch/powerpc/kernel/systbl.o: in function `sys_call_table':
> (.rodata+0x6cc): undefined reference to `ppc_clone3'
> make: *** [Makefile:1060: vmlinux] Error 1
>
> The patch was tested using Christian's program on a real e500 machine.
>
> --- a/arch/powerpc/kernel/entry_32.S
> +++ b/arch/powerpc/kernel/entry_32.S
> @@ -597,6 +597,14 @@ ppc_clone:
> stw r0,_TRAP(r1) /* register set saved */
> b sys_clone
>
> + .globl ppc_clone3
> +ppc_clone3:
> + SAVE_NVGPRS(r1)
> + lwz r0,_TRAP(r1)
> + rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
> + stw r0,_TRAP(r1) /* register set saved */
> + b sys_clone3
> +
> .globl ppc_swapcontext
> ppc_swapcontext:
> SAVE_NVGPRS(r1)
>
> I don't think this trivial hunk deserves a separate patch submission.
>
> Thanks,
> Arseny
^ permalink raw reply
* Re: [PATCH v5 4/4] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
From: Oliver O'Halloran @ 2019-07-24 9:45 UTC (permalink / raw)
To: Laurent Dufour
Cc: Vaibhav Jain, David Gibson, linuxppc-dev, Aneesh Kumar K . V
In-Reply-To: <ee9b6b91-3e43-9436-6e3a-b0dc73179dd1@linux.vnet.ibm.com>
On Wed, Jul 24, 2019 at 7:27 PM Laurent Dufour
<ldufour@linux.vnet.ibm.com> wrote:
>
> Le 24/07/2019 à 11:24, Oliver O'Halloran a écrit :
> > On Wed, Jul 24, 2019 at 7:17 PM Laurent Dufour
> > <ldufour@linux.vnet.ibm.com> wrote:
> >>
> >> Le 23/07/2019 à 18:13, Vaibhav Jain a écrit :
> >>> *snip*
> >>> @@ -404,6 +409,14 @@ static int papr_scm_probe(struct platform_device *pdev)
> >>>
> >>> /* request the hypervisor to bind this region to somewhere in memory */
> >>> rc = drc_pmem_bind(p);
> >>> +
> >>> + /* If phyp says drc memory still bound then force unbound and retry */
> >>> + if (rc == -EBUSY) {
> >>> + dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
> >>> + drc_pmem_unbind(p);
> >>> + rc = drc_pmem_bind(p);
> >>
> >> In the unlikely case where H_SCM_BIND_MEM is returning H_OVERLAP once the
> >> unbinding has been done, the error would be silently processed. That sounds
> >> really unlikely, but should an error message be displayed in this
> >> particular case ?
> >
> > drc_pmem_bind() prints the h-call error code if we get one, so it's not silent
>
> That's no more the case whith this patch, H_OVERLAP is handled before
> writing the error message, which would make sense for the first try.
>
> For the record, the patch introduces:
>
> @@ -65,6 +66,10 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
> } while (rc == H_BUSY);
>
> if (rc) {
> + /* H_OVERLAP needs a separate error path */
> + if (rc == H_OVERLAP)
> + return -EBUSY;
> +
> dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
> return -ENXIO;
> }
Ah, good point. Getting H_OVERLAP is still an error case so I think
it's reasonable to still print the message in that case.
^ permalink raw reply
* Re: [PATCH v3 9/9] powerpc/eeh: Convert log messages to eeh_edev_* macros
From: Oliver O'Halloran @ 2019-07-24 9:47 UTC (permalink / raw)
To: kbuild test robot
Cc: Sam Bobroff, Alexey Kardashevskiy, linuxppc-dev, kbuild-all,
Tyrel Datwyler
In-Reply-To: <201907241746.mKIx06OX%lkp@intel.com>
On Wed, Jul 24, 2019 at 7:24 PM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Sam,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v5.3-rc1 next-20190724]
> [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/Sam-Bobroff/powerpc-64-Adjust-order-in-pcibios_init/20190724-134001
> config: powerpc-defconfig (attached as .config)
> compiler: powerpc64-linux-gcc (GCC) 7.4.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=7.4.0 make.cross ARCH=powerpc
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
> arch/powerpc/kernel/eeh_driver.c: In function 'eeh_add_virt_device':
> >> arch/powerpc/kernel/eeh_driver.c:459:17: error: unused variable 'pdn' [-Werror=unused-variable]
> struct pci_dn *pdn = eeh_dev_to_pdn(edev);
FYI this happens when CONFIG_IOV isn't set. Adding a __maybe_unused
annotation fixes it.
> ^~~
> cc1: all warnings being treated as errors
>
> vim +/pdn +459 arch/powerpc/kernel/eeh_driver.c
>
> 77bd7415 arch/powerpc/platforms/pseries/eeh_driver.c Linas Vepstas 2005-11-03 454
> bf773df9 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-09-12 455 static void *eeh_add_virt_device(struct eeh_dev *edev)
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 456 {
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 457 struct pci_driver *driver;
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 458 struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 @459 struct pci_dn *pdn = eeh_dev_to_pdn(edev);
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 460
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 461 if (!(edev->physfn)) {
> 6dad7bbd arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2019-07-23 462 eeh_edev_warn(edev, "Not for VF\n");
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 463 return NULL;
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 464 }
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 465
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 466 driver = eeh_pcid_get(dev);
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 467 if (driver) {
> 46d4be41 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-05-25 468 if (driver->err_handler) {
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 469 eeh_pcid_put(dev);
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 470 return NULL;
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 471 }
> 46d4be41 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-05-25 472 eeh_pcid_put(dev);
> 46d4be41 arch/powerpc/kernel/eeh_driver.c Sam Bobroff 2018-05-25 473 }
> 67086e32 arch/powerpc/kernel/eeh_driver.c Wei Yang 2016-03-04 474
>
> :::::: The code at line 459 was first introduced by commit
> :::::: 67086e32b56481531ab1292b284e074b1a8d764c powerpc/eeh: powerpc/eeh: Support error recovery for VF PE
>
> :::::: TO: Wei Yang <weiyang@linux.vnet.ibm.com>
> :::::: CC: Michael Ellerman <mpe@ellerman.id.au>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* Re: [PATCH 2/2] powerpc: expose secure variables via sysfs
From: Oliver O'Halloran @ 2019-07-24 9:52 UTC (permalink / raw)
To: Nayna
Cc: linux-efi, Ard Biesheuvel, Eric Ricther, Nayna Jain,
Linux Kernel Mailing List, Mimi Zohar, Claudio Carvalho,
Matthew Garret, linuxppc-dev, Greg Kroah-Hartman, Paul Mackerras,
Jeremy Kerr, Elaine Palmer, linux-integrity, George Wilson
In-Reply-To: <6d2988c1-9b89-448b-4537-c3c6673b6dd1@linux.vnet.ibm.com>
On Wed, Jul 24, 2019 at 12:35 AM Nayna <nayna@linux.vnet.ibm.com> wrote:
>
> On 07/05/2019 02:05 AM, Michael Ellerman wrote:
> > Hi Nayna,
>
> Hi Michael, Oliver,
>
> > Nayna Jain <nayna@linux.ibm.com> writes:
> >> As part of PowerNV secure boot support, OS verification keys are stored
> >> and controlled by OPAL as secure variables. These need to be exposed to
> >> the userspace so that sysadmins can perform key management tasks.
> >>
> >> This patch adds the support to expose secure variables via a sysfs
> >> interface It reuses the the existing efi defined hooks and backend in
> >> order to maintain the compatibility with the userspace tools.
> > Which tools? Can you include a log demonstrating how they're used, ie.
> > so that I can test the sequence of commands.
> >
> >> Though it reuses a great deal of efi, POWER platforms do not use EFI.
> >> A new config, POWER_SECVAR_SYSFS, is defined to enable this new sysfs
> >> interface.
> > Sorry I haven't been able to keep up with all the discussions, but I
> > thought the consensus was that pretending to be EFI-like was a bad idea,
> > because we don't have actual EFI and we're not implementing an entirely
> > compatible scheme to EFI anyway.
My read is the consensus was that pretending to be EFI is a bad idea
unless we're going to behave like EFI.
> > Greg suggested just putting the variables in sysfs, why does that not
> > work? Matthew mentioned "complex semantics around variable deletion and
> > immutability" but do we have to emulate those semantics on powerpc?
>
> Sorry for the delay in the response.
>
> Yes, I agree. The purpose of the v2 version of the patchset was to try
> and quickly address Matthew's concerns. This version of the patchset:
> * is based on Greg's suggestion to use sysfs
As far as I can tell Greg made that suggestion here:
https://lwn.net/ml/linux-fsdevel/20190603072916.GA7545@kroah.com/
Then walked back on that suggestion after Matthew pointed out that
efivars is separate because of the immutability requirement and the
odd update semantics:
https://lwn.net/ml/linux-fsdevel/20190605081301.GA23180@kroah.com/
Considering the whole point of this is to present the same user-facing
interface so shouldn't you be dealing with all the problems that
interface creates?
> * is not using any EFI configs
That's true, but...
> * is not exposing secure variables via efivarfs
> * is STILL using some of the existing EFI code, that is used by EFI to
> expose its variables via sysfs, to avoid code duplication.
We avoid some of the potential problems of selecting CONFIG_EFI and we
gain a bunch of other potential problems since you've hacked the
makefiles to build code that's normally CONFIG_EFI only.
> * is using efivar hooks to expose secure variables for tool compatibility
Here's the real problem. For compatibility with the existing userspace
tooling, which expects UEFI, you need to present the same interface
with the same semantics. Trying to not use efivarfs means you've
already lost since you no longer have the same interface. So how is
this an improvement? I think the options here are to either:
1) Come up with a new interface, implement it, and adapt the user
tooling to deal with the new API.
*or*
2) Use efivarsfs and fix the based i-cant-believe-its-not-efi variable
backend so it behaves *exactly* like the UEFI get/setVariable APIs.
This means that you need to validate the update certificates at
runtime. I don't think this is a huge strech since you're already
implementing the validator.
1) gives you the flexibility to change the key hierarchy and whatnot,
while 2) means we've got less weird powerpc crap for users to deal
with. I have no strong opinions about which you choose to do, but
don't do this.
Oliver
^ permalink raw reply
* Re: [PATCH 1/5] powerpc/64s/radix: Fix memory hotplug section page table creation
From: Aneesh Kumar K.V @ 2019-07-24 9:54 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
Cc: Anju T Sudhakar, Madhavan Srinivasan, Reza Arbab, Nicholas Piggin
In-Reply-To: <20190724084638.24982-1-npiggin@gmail.com>
Nicholas Piggin <npiggin@gmail.com> writes:
> create_physical_mapping expects physical addresses, but creating and
> splitting these mappings after boot is supplying virtual (effective)
> addresses. This can be irritated by booting with mem= to limit memory
> then probing an unused physical memory range:
>
> echo <addr> > /sys/devices/system/memory/probe
>
> This mostly works by accident, firstly because __va(__va(x)) == __va(x)
> so the virtual address does not get corrupted. Secondly because pfn_pte
> masks out the upper bits of the pfn beyond the physical address limit,
> so a pfn constructed with a 0xc000000000000000 virtual linear address
> will be masked back to the correct physical address in the pte.
>
Good catch. Did this result in any error?
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Cc: Reza Arbab <arbab@linux.vnet.ibm.com>
> Fixes: 6cc27341b21a8 ("powerpc/mm: add radix__create_section_mapping()")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
> index b4ca9e95e678..c5cc16ab1954 100644
> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
> @@ -902,7 +902,7 @@ int __meminit radix__create_section_mapping(unsigned long start, unsigned long e
> return -1;
> }
>
> - return create_physical_mapping(start, end, nid);
> + return create_physical_mapping(__pa(start), __pa(end), nid);
While we are here, should we change the prototype to take phys_addr_t ?
> }
>
> int __meminit radix__remove_section_mapping(unsigned long start, unsigned long end)
> --
> 2.22.0
^ permalink raw reply
* Re: [PATCH 2/5] powerpc/64s/radix: Fix memory hot-unplug page table split
From: Aneesh Kumar K.V @ 2019-07-24 9:55 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
Cc: Anju T Sudhakar, Madhavan Srinivasan, Reza Arbab, Nicholas Piggin
In-Reply-To: <20190724084638.24982-2-npiggin@gmail.com>
Nicholas Piggin <npiggin@gmail.com> writes:
> create_physical_mapping expects physical addresses, but splitting
> these mapping on hot unplug is supplying virtual (effective)
> addresses.
>
> [I'm not sure how to test this one]
>
Memory hot unplug with kvm?
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Cc: Balbir Singh <bsingharora@gmail.com>
> Fixes: 4dd5f8a99e791 ("powerpc/mm/radix: Split linear mapping on hot-unplug")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
> index c5cc16ab1954..2204d8eeb784 100644
> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
> @@ -737,8 +737,8 @@ static int __meminit stop_machine_change_mapping(void *data)
>
> spin_unlock(&init_mm.page_table_lock);
> pte_clear(&init_mm, params->aligned_start, params->pte);
> - create_physical_mapping(params->aligned_start, params->start, -1);
> - create_physical_mapping(params->end, params->aligned_end, -1);
> + create_physical_mapping(__pa(params->aligned_start), __pa(params->start), -1);
> + create_physical_mapping(__pa(params->end), __pa(params->aligned_end), -1);
> spin_lock(&init_mm.page_table_lock);
> return 0;
> }
> --
> 2.22.0
^ permalink raw reply
* Re: [PATCH 3/5] powerpc/perf: fix imc allocation failure handling
From: Aneesh Kumar K.V @ 2019-07-24 9:58 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
Cc: Anju T Sudhakar, Madhavan Srinivasan, Reza Arbab, Nicholas Piggin
In-Reply-To: <20190724084638.24982-3-npiggin@gmail.com>
Nicholas Piggin <npiggin@gmail.com> writes:
> The alloc_pages_node return value should be tested for failure
> before being passed to page_address.
>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
This need Fixes: tag? It fix a real crash unlike the other patch in this
series?
> Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
> Tested-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/perf/imc-pmu.c | 29 ++++++++++++++++++-----------
> 1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
> index dea243185ea4..cb50a9e1fd2d 100644
> --- a/arch/powerpc/perf/imc-pmu.c
> +++ b/arch/powerpc/perf/imc-pmu.c
> @@ -577,6 +577,7 @@ static int core_imc_mem_init(int cpu, int size)
> {
> int nid, rc = 0, core_id = (cpu / threads_per_core);
> struct imc_mem_info *mem_info;
> + struct page *page;
>
> /*
> * alloc_pages_node() will allocate memory for core in the
> @@ -587,11 +588,12 @@ static int core_imc_mem_init(int cpu, int size)
> mem_info->id = core_id;
>
> /* We need only vbase for core counters */
> - mem_info->vbase = page_address(alloc_pages_node(nid,
> - GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE |
> - __GFP_NOWARN, get_order(size)));
> - if (!mem_info->vbase)
> + page = alloc_pages_node(nid,
> + GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE |
> + __GFP_NOWARN, get_order(size));
> + if (!page)
> return -ENOMEM;
> + mem_info->vbase = page_address(page);
>
> /* Init the mutex */
> core_imc_refc[core_id].id = core_id;
> @@ -849,15 +851,17 @@ static int thread_imc_mem_alloc(int cpu_id, int size)
> int nid = cpu_to_node(cpu_id);
>
> if (!local_mem) {
> + struct page *page;
> /*
> * This case could happen only once at start, since we dont
> * free the memory in cpu offline path.
> */
> - local_mem = page_address(alloc_pages_node(nid,
> + page = alloc_pages_node(nid,
> GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE |
> - __GFP_NOWARN, get_order(size)));
> - if (!local_mem)
> + __GFP_NOWARN, get_order(size));
> + if (!page)
> return -ENOMEM;
> + local_mem = page_address(page);
>
> per_cpu(thread_imc_mem, cpu_id) = local_mem;
> }
> @@ -1095,11 +1099,14 @@ static int trace_imc_mem_alloc(int cpu_id, int size)
> int core_id = (cpu_id / threads_per_core);
>
> if (!local_mem) {
> - local_mem = page_address(alloc_pages_node(phys_id,
> - GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE |
> - __GFP_NOWARN, get_order(size)));
> - if (!local_mem)
> + struct page *page;
> +
> + page = alloc_pages_node(phys_id,
> + GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE |
> + __GFP_NOWARN, get_order(size));
> + if (!page)
> return -ENOMEM;
> + local_mem = page_address(page);
> per_cpu(trace_imc_mem, cpu_id) = local_mem;
>
> /* Initialise the counters for trace mode */
> --
> 2.22.0
^ permalink raw reply
* Re: [PATCH 4/5] powerpc/64: Add VIRTUAL_BUG_ON checks for __va and __pa addresses
From: Aneesh Kumar K.V @ 2019-07-24 9:59 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
Cc: Anju T Sudhakar, Madhavan Srinivasan, Reza Arbab, Nicholas Piggin
In-Reply-To: <20190724084638.24982-4-npiggin@gmail.com>
Nicholas Piggin <npiggin@gmail.com> writes:
> Ensure __va is given a physical address below PAGE_OFFSET, and __pa is
> given a virtual address above PAGE_OFFSET.
>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/include/asm/page.h | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
> index 0d52f57fca04..c8bb14ff4713 100644
> --- a/arch/powerpc/include/asm/page.h
> +++ b/arch/powerpc/include/asm/page.h
> @@ -215,9 +215,19 @@ static inline bool pfn_valid(unsigned long pfn)
> /*
> * gcc miscompiles (unsigned long)(&static_var) - PAGE_OFFSET
> * with -mcmodel=medium, so we use & and | instead of - and + on 64-bit.
> + * This also results in better code generation.
> */
> -#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) | PAGE_OFFSET))
> -#define __pa(x) ((unsigned long)(x) & 0x0fffffffffffffffUL)
> +#define __va(x) \
> +({ \
> + VIRTUAL_BUG_ON((unsigned long)(x) >= PAGE_OFFSET); \
> + (void *)(unsigned long)((phys_addr_t)(x) | PAGE_OFFSET); \
> +})
Can we make that static inline? Is there a need for __pa and __va to be
#define like we do #ifndef anywhere?
> +
> +#define __pa(x) \
> +({ \
> + VIRTUAL_BUG_ON((unsigned long)(x) < PAGE_OFFSET); \
> + (unsigned long)(x) & 0x0fffffffffffffffUL; \
> +})
>
> #else /* 32-bit, non book E */
> #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + PAGE_OFFSET - MEMORY_START))
> --
> 2.22.0
^ permalink raw reply
* Re: [PATCH 5/5] powerpc/64s/radix: Remove redundant pfn_pte bitop, add VM_BUG_ON
From: Aneesh Kumar K.V @ 2019-07-24 9:59 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
Cc: Anju T Sudhakar, Madhavan Srinivasan, Reza Arbab, Nicholas Piggin
In-Reply-To: <20190724084638.24982-5-npiggin@gmail.com>
Nicholas Piggin <npiggin@gmail.com> writes:
> pfn_pte is never given a pte above the addressable physical memory
> limit, so the masking is redundant. In case of a software bug, it
> is not obviously better to silently truncate the pfn than to corrupt
> the pte (either one will result in memory corruption or crashes),
> so there is no reason to add this to the fast path.
>
> Add VM_BUG_ON to catch cases where the pfn is invalid. These would
> catch the create_section_mapping bug fixed by a previous commit.
>
> [16885.256466] ------------[ cut here ]------------
> [16885.256492] kernel BUG at arch/powerpc/include/asm/book3s/64/pgtable.h:612!
> cpu 0x0: Vector: 700 (Program Check) at [c0000000ee0a36d0]
> pc: c000000000080738: __map_kernel_page+0x248/0x6f0
> lr: c000000000080ac0: __map_kernel_page+0x5d0/0x6f0
> sp: c0000000ee0a3960
> msr: 9000000000029033
> current = 0xc0000000ec63b400
> paca = 0xc0000000017f0000 irqmask: 0x03 irq_happened: 0x01
> pid = 85, comm = sh
> kernel BUG at arch/powerpc/include/asm/book3s/64/pgtable.h:612!
> Linux version 5.3.0-rc1-00001-g0fe93e5f3394
> enter ? for help
> [c0000000ee0a3a00] c000000000d37378 create_physical_mapping+0x260/0x360
> [c0000000ee0a3b10] c000000000d370bc create_section_mapping+0x1c/0x3c
> [c0000000ee0a3b30] c000000000071f54 arch_add_memory+0x74/0x130
>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/include/asm/book3s/64/pgtable.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
> index 8308f32e9782..8e47fb85dfa6 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
> @@ -608,8 +608,10 @@ static inline bool pte_access_permitted(pte_t pte, bool write)
> */
> static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
> {
> - return __pte((((pte_basic_t)(pfn) << PAGE_SHIFT) & PTE_RPN_MASK) |
> - pgprot_val(pgprot));
> + VM_BUG_ON(pfn >> (64 - PAGE_SHIFT));
> + VM_BUG_ON((pfn << PAGE_SHIFT) & ~PTE_RPN_MASK);
> +
> + return __pte(((pte_basic_t)pfn << PAGE_SHIFT) | pgprot_val(pgprot));
> }
>
> static inline unsigned long pte_pfn(pte_t pte)
> --
> 2.22.0
^ permalink raw reply
* Re: [PATCH v5 0/4] powerpc/papr_scm: Workaround for failure of drc bind after kexec
From: Aneesh Kumar K.V @ 2019-07-24 10:04 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev
Cc: Laurent Dufour, Vaibhav Jain, David Gibson, Oliver O'Halloran
In-Reply-To: <20190723161357.26718-1-vaibhav@linux.ibm.com>
Vaibhav Jain <vaibhav@linux.ibm.com> writes:
> Presently an error is returned in response to hcall H_SCM_BIND_MEM when a
> new kernel boots on lpar via kexec. This prevents papr_scm from registering
> drc memory regions with nvdimm. The error reported is of the form below:
>
> "papr_scm ibm,persistent-memory:ibm,pmemory@44100002: bind err: -68"
>
> On investigation it was revealed that phyp returns this error as previous
> kernel did not completely release bindings for drc scm-memory blocks and
> hence phyp rejected request for re-binding these block to lpar with error
> H_OVERLAP. Also support for a new H_SCM_UNBIND_ALL is recently added which
> is better suited for releasing all the bound scm-memory block from an lpar.
>
> So leveraging new hcall H_SCM_UNBIND_ALL, we can workaround H_OVERLAP issue
> during kexec by forcing an unbind of all drm scm-memory blocks and issuing
> H_SCM_BIND_MEM to re-bind the drc scm-memory blocks to lpar. This sequence
> will also be needed when a new kernel boot on lpar after previous kernel
> panicked and it never got an opportunity to call H_SCM_UNBIND_MEM/ALL.
>
> Hence this patch-set implements following changes to papr_scm module:
>
> * Update hvcall.h to include opcodes for new hcall H_SCM_UNBIND_ALL.
>
> * Update it to use H_SCM_UNBIND_ALL instead of H_SCM_UNBIND_MEM
>
> * In case hcall H_SCM_BIND_MEM fails with error H_OVERLAP, force
> H_SCM_UNBIND_ALL and retry the bind operation again.
>
You can add for the series.
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
^ permalink raw reply
* Re: [DOC][PATCH v5 1/4] powerpc: Document some HCalls for Storage Class Memory
From: Michal Suchánek @ 2019-07-24 12:59 UTC (permalink / raw)
To: Laurent Dufour
Cc: Vaibhav Jain, Oliver O'Halloran, David Gibson, linuxppc-dev,
Aneesh Kumar K . V
In-Reply-To: <a8277da0-ad26-d491-ed6b-61bf5ea18dbb@linux.vnet.ibm.com>
On Wed, 24 Jul 2019 11:08:58 +0200
Laurent Dufour <ldufour@linux.vnet.ibm.com> wrote:
> Le 23/07/2019 à 18:13, Vaibhav Jain a écrit :
> > This doc patch provides an initial description of the HCall op-codes
> > that are used by Linux kernel running as a guest operating
> > system (LPAR) on top of PowerVM or any other sPAPR compliant
> > hyper-visor (e.g qemu).
> >
> > Apart from documenting the HCalls the doc-patch also provides a
> > rudimentary overview of how Hcalls are implemented inside the Linux
> > kernel and how information flows between kernel and PowerVM/KVM.
>
> Hi Vaibhav,
>
> That's a good idea to introduce such a documentation.
>
> > Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> > ---
> > Change-log:
> >
> > v5
> > * First patch in this patchset.
> > ---
> > Documentation/powerpc/hcalls.txt | 140 +++++++++++++++++++++++++++++++
> > 1 file changed, 140 insertions(+)
> > create mode 100644 Documentation/powerpc/hcalls.txt
> >
> > diff --git a/Documentation/powerpc/hcalls.txt b/Documentation/powerpc/hcalls.txt
> > new file mode 100644
> > index 000000000000..cc9dd872cecd
> > --- /dev/null
> > +++ b/Documentation/powerpc/hcalls.txt
> > @@ -0,0 +1,140 @@
> > +Hyper-visor Call Op-codes (HCALLS)
> > +====================================
> > +
> > +Overview
> > +=========
> > +
> > +Virtualization on PPC64 arch is based on the PAPR specification[1] which
> > +describes run-time environment for a guest operating system and how it should
> > +interact with the hyper-visor for privileged operations. Currently there are two
> > +PAPR compliant hypervisors (PHYP):
> > +
> > +IBM PowerVM: IBM's proprietary hyper-visor that supports AIX, IBM-i and Linux as
> > + supported guests (termed as Logical Partitions or LPARS).
> > +
> > +Qemu/KVM: Supports PPC64 linux guests running on a PPC64 linux host.
> > +
> > +On PPC64 arch a virtualized guest kernel runs in a non-privileged mode (HV=0).
> > +Hence to perform a privileged operations the guest issues a Hyper-visor
> > +Call (HCALL) with necessary input operands. PHYP after performing the privilege
> > +operation returns a status code and output operands back to the guest.
> > +
> > +HCALL ABI
> > +=========
> > +The ABI specification for a HCall between guest os kernel and PHYP is
> > +described in [1]. The Opcode for Hcall is set in R3 and subsequent in-arguments
> > +for the Hcall are provided in registers R4-R12. On return from 'HVCS'
> > +instruction the status code of HCall is available in R3 an the output parameters
> > +are returned in registers R4-R12.
>
> Would it be good to mention that values passed through the memory must be
> stored in Big Endian format ?
>
> > +Powerpc arch code provides convenient wrappers named plpar_hcall_xxx defined in
> > +header 'hvcall.h' to issue HCalls from the linux kernel running as guest.
> > +
> > +
> > +DRC & DRC Indexes
> > +=================
> > +
> > + PAPR Guest
> > + DR1 Hypervisor OS
> > + +--+ +----------+ +---------+
> > + | |<------>| | | User |
> > + +--+ DRC1 | | DRC | Space |
> > + | | Index +---------+
> > + DR2 | | | |
> > + +--+ | |<------->| Kernel |
> > + | |<----- >| | HCall | |
> > + +--+ DRC2 +----------+ +---------+
> > +
> > +PHYP terms shared hardware resources like PCI devices, NVDimms etc available for
> > +use by LPARs as Dynamic Resource (DR). When a DR is allocated to an LPAR, PHYP
> > +creates a data-structure called Dynamic Resource Connector (DRC) to manage LPAR
> > +access. An LPAR refers to a DRC via an opaque 32-bit number called DRC-Index.
> > +The DRC-index value is provided to the LPAR via device-tree where its present
> > +as an attribute in the device tree node associated with the DR.
>
> Should you use the term 'Hypervisor' instead of 'PHYP' which is not usually
> designing only the proprietary one ?
>
> Thanks,
> Laurent.
>
> > +
> > +HCALL Op-codes
> > +==============
> > +
> > +Below is a partial of of HCALLs that are supported by PHYP. For the
^^ list?
Thanks
Michal
> > +corresponding opcode values please look into the header
> > +'arch/powerpc/include/asm/hvcall.h' :
> > +
> > +* H_SCM_READ_METADATA:
> > + Input: drcIndex, offset, buffer-address, numBytesToRead
> > + Out: None
> > + Description:
> > + Given a DRC Index of an NVDimm, read N-bytes from the the meta data area
> > + associated with it, at a specified offset and copy it to provided buffer.
> > + The metadata area stores configuration information such as label information,
> > + bad-blocks etc. The metadata area is located out-of-band of NVDimm storage
> > + area hence a separate access semantics is provided.
> > +
> > +* H_SCM_WRITE_METADATA:
> > + Input: drcIndex, offset, data, numBytesToWrite
> > + Out: None
> > + Description:
> > + Given a DRC Index of an NVDimm, write N-bytes from provided buffer at the
> > + given offset to the the meta data area associated with the NVDimm.
> > +
> > +
> > +* H_SCM_BIND_MEM:
> > + Input: drcIndex, startingScmBlockIndex, numScmBlocksToBind, targetAddress
> > + Out: guestMappedAddress, numScmBlockBound
> > + Description:
> > + Given a DRC-Index of an NVDimm, maps the SCM (Storage Class Memory) blocks to
> > + continuous logical addresses in guest physical address space. The HCALL
> > + arguments can be used to map partial range of SCM blocks instead of entire
> > + NVDimm range to the LPAR.
> > +
> > +* H_SCM_UNBIND_MEM:
> > + Input: drcIndex, startingScmLogicalMemoryAddress, numScmBlocksToUnbind
> > + Out: numScmBlocksUnbound
> > + Description:
> > + Given a DRC-Index of an NVDimm, unmap one or more the SCM blocks from guest
> > + physical address space. The HCALL can fail if the Guest has an active PTE
> > + entry to the SCM block being unbinded.
> > +
> > +* H_SCM_QUERY_BLOCK_MEM_BINDING:
> > + Input: drcIndex, scmBlockIndex
> > + Out: Guest-Physical-Address
> > + Description:
> > + Given a DRC-Index and an SCM Block index return the guest physical address to
> > + which the SCM block is mapped to.
> > +
> > +* H_SCM_QUERY_LOGICAL_MEM_BINDING:
> > + Input: Guest-Physical-Address
> > + Out: drcIndex, scmBlockIndex
> > + Description:
> > + Given a guest physical address return which DRC Index and SCM block is mapped
> > + to that address.
> > +
> > +* H_SCM_UNBIND_ALL:
> > + Input: scmTargetScope, drcIndex
> > + Out: None
> > + Description:
> > + Depending on the Target scope unmap all scm blocks belonging to all NVDimms
> > + or all scm blocks belonging to a single NVDimm identified by its drcIndex
> > + from the LPAR memory.
> > +
> > +* H_SCM_HEALTH:
> > + Input: drcIndex
> > + Output: health-bitmap, health-bit-valid-bitmap
> > + Description:
> > + Given a DRC Index return the info on predictive failure and over all health of
> > + the NVDimm. The asserted bits in the health-bitmap indicate a single predictive
> > + failure and health-bit-valid-bitmap indicate which bits in health-bitmap are
> > + valid.
> > +
> > +
> > +* H_SCM_PERFORMANCE_STATS:
> > + Input: drcIndex, resultBuffer Addr
> > + Out: None
> > + Description:
> > + Given a DRC Index collect the performance statistics for NVDimm and copy them
> > + to the resultBuffer.
> > +
> > +
> > +References
> > +==========
> > +[1]: "Linux on Power Architecture Platform Reference"
> > + https://members.openpowerfoundation.org/document/dl/469
> >
>
^ permalink raw reply
* Re: [PATCH v4 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h
From: Michael Ellerman @ 2019-07-24 13:32 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev
Cc: Aneesh Kumar K . V, Laurent Dufour, Oliver O'Halloran,
David Gibson, Vaibhav Jain
In-Reply-To: <20190629160610.23402-2-vaibhav@linux.ibm.com>
On Sat, 2019-06-29 at 16:06:08 UTC, Vaibhav Jain wrote:
> Update the hvcalls.h to include op-codes for new hcalls introduce to
> manage SCM memory. Also update existing hcall definitions to reflect
> current papr specification for SCM.
>
> The removed hcall op-codes H_SCM_MEM_QUERY, H_SCM_BLOCK_CLEAR were
> transient proposals and there support was never implemented by
> Power-VM nor they were used anywhere in Linux kernel. Hence we don't
> expect anyone to be impacted by this change.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Series applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/6d140e7569db89a1b596c1c2d1c2293d5c594432
cheers
^ permalink raw reply
* [GIT PULL] Please pull powerpc/linux.git powerpc-5.3-2 tag
From: Michael Ellerman @ 2019-07-24 13:42 UTC (permalink / raw)
To: Linus Torvalds
Cc: aarcange, ego, mikey, shawn, linux-kernel, clg, sjitindarsingh,
vaibhav, linuxppc-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Linus,
Please pull some powerpc fixes for 5.3:
The following changes since commit 192f0f8e9db7efe4ac98d47f5fa4334e43c1204d:
Merge tag 'powerpc-5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux (2019-07-13 16:08:36 -0700)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.3-2
for you to fetch changes up to 3a855b7ac7d5021674aa3e1cc9d3bfd6b604e9c0:
powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails (2019-07-22 23:31:00 +1000)
- ------------------------------------------------------------------
powerpc fixes for 5.3 #2
An assortment of non-regression fixes that have accumulated since the start of
the merge window.
A fix for a user triggerable oops on machines where transactional memory is
disabled, eg. Power9 bare metal, Power8 with TM disabled on the command line, or
all Power7 or earlier machines.
Three fixes for handling of PMU and power saving registers when running nested
KVM on Power9.
Two fixes for bugs found while stress testing the XIVE interrupt controller
code, also on Power9.
A fix to allow guests to boot under Qemu/KVM on Power9 using the the Hash MMU
with >= 1TB of memory.
Two fixes for bugs in the recent DMA cleanup, one of which could lead to
checkstops.
And finally three fixes for the PAPR SCM nvdimm driver.
Thanks to:
Alexey Kardashevskiy, Andrea Arcangeli, Cédric Le Goater, Christoph Hellwig,
David Gibson, Gautham R. Shenoy, Michael Neuling, Oliver O'Halloran,, Satheesh
Rajendran, Shawn Anastasio, Suraj Jitindar Singh, Vaibhav Jain.
- ------------------------------------------------------------------
Andrea Arcangeli (1):
powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA
Cédric Le Goater (1):
KVM: PPC: Book3S HV: XIVE: fix rollback when kvmppc_xive_create fails
Gautham R. Shenoy (1):
powerpc/xive: Fix loop exit-condition in xive_find_target_in_mask()
Michael Neuling (1):
powerpc/tm: Fix oops on sigreturn on systems without TM
Shawn Anastasio (1):
powerpc/dma: Fix invalid DMA mmap behavior
Suraj Jitindar Singh (4):
powerpc/mm: Limit rma_size to 1TB when running without HV mode
KVM: PPC: Book3S HV: Always save guest pmu for guest capable of nesting
powerpc/pmu: Set pmcregs_in_use in paca when running as LPAR
KVM: PPC: Book3S HV: Save and restore guest visible PSSCR bits on pseries
Vaibhav Jain (3):
powerpc/pseries: Update SCM hcall op-codes in hvcall.h
powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL
powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/hvcall.h | 11 +++++---
arch/powerpc/include/asm/pmc.h | 5 ++--
arch/powerpc/kernel/Makefile | 3 ++-
arch/powerpc/kernel/dma-common.c | 17 ++++++++++++
arch/powerpc/kernel/signal_32.c | 3 +++
arch/powerpc/kernel/signal_64.c | 5 ++++
arch/powerpc/kvm/book3s_hv.c | 13 +++++++++
arch/powerpc/kvm/book3s_xive.c | 4 +--
arch/powerpc/kvm/book3s_xive_native.c | 4 +--
arch/powerpc/mm/book3s64/hash_utils.c | 9 +++++++
arch/powerpc/mm/mem.c | 2 +-
arch/powerpc/platforms/pseries/papr_scm.c | 44 +++++++++++++++++++++++++------
arch/powerpc/sysdev/xive/common.c | 7 +++--
14 files changed, 103 insertions(+), 25 deletions(-)
create mode 100644 arch/powerpc/kernel/dma-common.c
-----BEGIN PGP SIGNATURE-----
iQIcBAEBAgAGBQJdOF+PAAoJEFHr6jzI4aWAEQ4P/iw1q7wyO11sSAc+oNsdCFDh
tT7fPzQruFlulyDr67BqXrUPJ5OoDN7k2eiwa5/Gbte9YgyYQkgw8UspoRTPUNTt
1tjoeEC7KtdWByYdZ9yrhqhzN0OVhc8FSwFvqdprzdfsCyWx0Fuh9uhXShteqpiV
nU8qG7WmS4KmY/+FWuOzH3s75w80UscezZ5WU3SGNoTrZYItlmNrtwFcyU3k5KcE
XWwktFBQP1dQQ81gZTX6L6E2rKHPQ0jphbmLrNhk2qTwv7Z7uq7BDT6b83nS7/sK
DtUTNVD7Cp1HUtRUlla3GhFIW3WP4t8OtZaDLMYL2v1a/B04kSb0iMYQIeLv6Ti0
UvACpGss2s6JLMyGrJrxnzjQcHIk4jYeM/sa+viJ+XYu3rC8Li533MOkNzpyaZ4d
ueAiORVlH02yz6fezhJhXCCN2L7cS7ifufpPpnBWX+hkp7zthxG+1wVhuHnZ53MD
Muz8avaNBF0K3/1/dGDeX3WBKpQoEQP96yyfP+MtmRJsEfIEr/cJdOixetBhwZkU
9DvBGFibUFF4l2aAbv1fGkKak54iOrXzJiBbjvOXmErwYaHnBIKARLHvlgOlykrg
789enXFL3wH2wRtrLwQGC8jh6RyQio6vzbOxlJ011SmtueD/lbnMD67C+TdoYjGc
08eecoUyDMeoW62I9yhH
=tkyv
-----END PGP SIGNATURE-----
^ permalink raw reply
* Re: [PATCH] powerpc: Wire up clone3 syscall
From: Michael Ellerman @ 2019-07-24 14:00 UTC (permalink / raw)
To: Christian Brauner, Arseny Solokha; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20190724093132.orflnhvyiff75yrd@brauner.io>
Christian Brauner <christian@brauner.io> writes:
> On Wed, Jul 24, 2019 at 12:25:14PM +0700, Arseny Solokha wrote:
>> Hi,
>>
>> may I also ask to provide ppc_clone3 symbol also for 32-bit powerpc? Otherwise
>> Michael's patch breaks build for me:
>
> Makes sense. Michael, are you planning on picking this up? :)
Yes I obviously (I hope) am not going to merge a patch that breaks the
32-bit build :)
I'll send a v2.
cheers
^ permalink raw reply
* [PATCH v2] powerpc: Wire up clone3 syscall
From: Michael Ellerman @ 2019-07-24 14:02 UTC (permalink / raw)
To: linuxppc-dev; +Cc: asolokha, linux-kernel, christian
Wire up the new clone3 syscall added in commit 7f192e3cd316 ("fork:
add clone3").
This requires a ppc_clone3 wrapper, in order to save the non-volatile
GPRs before calling into the generic syscall code. Otherwise we hit
the BUG_ON in CHECK_FULL_REGS in copy_thread().
Lightly tested using Christian's test code on a Power8 LE VM.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/unistd.h | 1 +
arch/powerpc/kernel/entry_32.S | 8 ++++++++
arch/powerpc/kernel/entry_64.S | 5 +++++
arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
4 files changed, 15 insertions(+)
v2: Add the wrapper for 32-bit as well, don't allow SPU programs to call
clone3 (switch ABI to nospu).
v1: https://lore.kernel.org/r/20190722132231.10169-1-mpe@ellerman.id.au
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 68473c3c471c..b0720c7c3fcf 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -49,6 +49,7 @@
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_SYS_CLONE3
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 85fdb6d879f1..54fab22c9a43 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -597,6 +597,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
stw r0,_TRAP(r1) /* register set saved */
b sys_clone
+ .globl ppc_clone3
+ppc_clone3:
+ SAVE_NVGPRS(r1)
+ lwz r0,_TRAP(r1)
+ rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
+ stw r0,_TRAP(r1) /* register set saved */
+ b sys_clone3
+
.globl ppc_swapcontext
ppc_swapcontext:
SAVE_NVGPRS(r1)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d9105fcf4021..0a0b5310f54a 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -487,6 +487,11 @@ _GLOBAL(ppc_clone)
bl sys_clone
b .Lsyscall_exit
+_GLOBAL(ppc_clone3)
+ bl save_nvgprs
+ bl sys_clone3
+ b .Lsyscall_exit
+
_GLOBAL(ppc32_swapcontext)
bl save_nvgprs
bl compat_sys_swapcontext
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index f2c3bda2d39f..43f736ed47f2 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -516,3 +516,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
+435 nospu clone3 ppc_clone3
--
2.20.1
^ permalink raw reply related
* Re: [PATCH] powerpc: Wire up clone3 syscall
From: Michael Ellerman @ 2019-07-24 14:06 UTC (permalink / raw)
To: Christian Brauner; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20190722133701.g3w5g4crogqb7oi5@brauner.io>
Christian Brauner <christian@brauner.io> writes:
> On Mon, Jul 22, 2019 at 11:22:31PM +1000, Michael Ellerman wrote:
>> Wire up the new clone3 syscall added in commit 7f192e3cd316 ("fork:
>> add clone3").
>>
>> This requires a ppc_clone3 wrapper, in order to save the non-volatile
>> GPRs before calling into the generic syscall code. Otherwise we hit
>> the BUG_ON in CHECK_FULL_REGS in copy_thread().
>>
>> Lightly tested using Christian's test code on a Power8 LE VM.
>>
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>
> Thank you, Michael!
>
> One comment below, otherwise:
>
> Acked-by: Christian Brauner <christian@brauner.io>
Thanks.
...
>> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
>> index f2c3bda2d39f..6886ecb590d5 100644
>> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
>> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
>> @@ -516,3 +516,4 @@
>> 432 common fsmount sys_fsmount
>> 433 common fspick sys_fspick
>> 434 common pidfd_open sys_pidfd_open
>> +435 common clone3 ppc_clone3
>
> Note that in v5.3-rc1 there's now a comment that 435 is reserved in
> there. So this will likely cause a merge conflict. You might want to
> base your change off of v5.3-rc1 instead to avoid that. :)
Thanks for the heads-up.
My fixes branch is already based off pre-rc1, and in general Linus can
handle a trivial merge conflict like that.
But given I had to send a v2 to fix the 32-bit build (doh!), I'll move
my fixes up past rc1 once Linus has merged what's in there now, and then
do this patch based on top of rc1, so there'll be no conflict.
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc: Wire up clone3 syscall
From: Christian Brauner @ 2019-07-24 14:21 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, asolokha, linux-kernel
In-Reply-To: <20190724140259.23554-1-mpe@ellerman.id.au>
On Thu, Jul 25, 2019 at 12:02:59AM +1000, Michael Ellerman wrote:
> Wire up the new clone3 syscall added in commit 7f192e3cd316 ("fork:
> add clone3").
>
> This requires a ppc_clone3 wrapper, in order to save the non-volatile
> GPRs before calling into the generic syscall code. Otherwise we hit
> the BUG_ON in CHECK_FULL_REGS in copy_thread().
>
> Lightly tested using Christian's test code on a Power8 LE VM.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Christian Brauner <christian@brauner.io>
> ---
> arch/powerpc/include/asm/unistd.h | 1 +
> arch/powerpc/kernel/entry_32.S | 8 ++++++++
> arch/powerpc/kernel/entry_64.S | 5 +++++
> arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
> 4 files changed, 15 insertions(+)
>
> v2: Add the wrapper for 32-bit as well, don't allow SPU programs to call
> clone3 (switch ABI to nospu).
>
> v1: https://lore.kernel.org/r/20190722132231.10169-1-mpe@ellerman.id.au
>
> diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
> index 68473c3c471c..b0720c7c3fcf 100644
> --- a/arch/powerpc/include/asm/unistd.h
> +++ b/arch/powerpc/include/asm/unistd.h
> @@ -49,6 +49,7 @@
> #define __ARCH_WANT_SYS_FORK
> #define __ARCH_WANT_SYS_VFORK
> #define __ARCH_WANT_SYS_CLONE
> +#define __ARCH_WANT_SYS_CLONE3
>
> #endif /* __ASSEMBLY__ */
> #endif /* _ASM_POWERPC_UNISTD_H_ */
> diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
> index 85fdb6d879f1..54fab22c9a43 100644
> --- a/arch/powerpc/kernel/entry_32.S
> +++ b/arch/powerpc/kernel/entry_32.S
> @@ -597,6 +597,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
> stw r0,_TRAP(r1) /* register set saved */
> b sys_clone
>
> + .globl ppc_clone3
> +ppc_clone3:
> + SAVE_NVGPRS(r1)
> + lwz r0,_TRAP(r1)
> + rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
> + stw r0,_TRAP(r1) /* register set saved */
> + b sys_clone3
> +
> .globl ppc_swapcontext
> ppc_swapcontext:
> SAVE_NVGPRS(r1)
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index d9105fcf4021..0a0b5310f54a 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -487,6 +487,11 @@ _GLOBAL(ppc_clone)
> bl sys_clone
> b .Lsyscall_exit
>
> +_GLOBAL(ppc_clone3)
> + bl save_nvgprs
> + bl sys_clone3
> + b .Lsyscall_exit
> +
> _GLOBAL(ppc32_swapcontext)
> bl save_nvgprs
> bl compat_sys_swapcontext
> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
> index f2c3bda2d39f..43f736ed47f2 100644
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -516,3 +516,4 @@
> 432 common fsmount sys_fsmount
> 433 common fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open
> +435 nospu clone3 ppc_clone3
> --
> 2.20.1
>
^ permalink raw reply
* [PATCH 3/5] arch: wire-up pidfd_wait()
From: Christian Brauner @ 2019-07-24 14:46 UTC (permalink / raw)
To: linux-kernel, oleg
Cc: linux-ia64, linux-sh, dhowells, sparclinux, joel, linux-arch,
linux-s390, x86, torvalds, Christian Brauner, kernel-team,
linux-xtensa, keescook, arnd, jannh, linuxppc-dev, linux-m68k,
viro, luto, tglx, linux-arm-kernel, linux-parisc, linux-api,
linux-mips, ebiederm, linux-alpha, tj, akpm, cyphar
In-Reply-To: <20190724144651.28272-1-christian@brauner.io>
This wires up the pidfd_wait() syscall into all arches at once.
Signed-off-by: Christian Brauner <christian@brauner.io>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jann Horn <jannh@google.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Andy Lutomirsky <luto@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Aleksa Sarai <cyphar@cyphar.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-api@vger.kernel.org
Cc: linux-alpha@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-ia64@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-mips@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: linux-arch@vger.kernel.org
Cc: x86@kernel.org
---
arch/alpha/kernel/syscalls/syscall.tbl | 1 +
arch/arm/tools/syscall.tbl | 1 +
arch/arm64/include/asm/unistd.h | 2 +-
arch/arm64/include/asm/unistd32.h | 4 +++-
arch/ia64/kernel/syscalls/syscall.tbl | 1 +
arch/m68k/kernel/syscalls/syscall.tbl | 1 +
arch/microblaze/kernel/syscalls/syscall.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n32.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n64.tbl | 1 +
arch/mips/kernel/syscalls/syscall_o32.tbl | 1 +
arch/parisc/kernel/syscalls/syscall.tbl | 1 +
arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
arch/s390/kernel/syscalls/syscall.tbl | 1 +
arch/sh/kernel/syscalls/syscall.tbl | 1 +
arch/sparc/kernel/syscalls/syscall.tbl | 1 +
arch/x86/entry/syscalls/syscall_32.tbl | 1 +
arch/x86/entry/syscalls/syscall_64.tbl | 1 +
arch/xtensa/kernel/syscalls/syscall.tbl | 1 +
include/linux/syscalls.h | 4 ++++
include/uapi/asm-generic/unistd.h | 4 +++-
20 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index 728fe028c02c..ca3e593f0c7a 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -475,3 +475,4 @@
543 common fspick sys_fspick
544 common pidfd_open sys_pidfd_open
# 545 reserved for clone3
+548 common pidfd_wait sys_pidfd_wait
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
index 6da7dc4d79cc..5e448d915b2f 100644
--- a/arch/arm/tools/syscall.tbl
+++ b/arch/arm/tools/syscall.tbl
@@ -449,3 +449,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
435 common clone3 sys_clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 2629a68b8724..b722e47377a5 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -38,7 +38,7 @@
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
-#define __NR_compat_syscalls 436
+#define __NR_compat_syscalls 439
#endif
#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 94ab29cf4f00..ca77c9d4f7a1 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -877,7 +877,9 @@ __SYSCALL(__NR_fsmount, sys_fsmount)
__SYSCALL(__NR_fspick, sys_fspick)
#define __NR_pidfd_open 434
__SYSCALL(__NR_pidfd_open, sys_pidfd_open)
-#define __NR_clone3 435
+#define __NR_pidfd_wait 438
+__SYSCALL(__NR_pidfd_wait, sys_pidfd_wait)
+#define __NR_clone3 439
__SYSCALL(__NR_clone3, sys_clone3)
/*
diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl
index 36d5faf4c86c..f038afaced9b 100644
--- a/arch/ia64/kernel/syscalls/syscall.tbl
+++ b/arch/ia64/kernel/syscalls/syscall.tbl
@@ -356,3 +356,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index a88a285a0e5f..51f86f7b4cec 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -435,3 +435,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index 09b0cd7dab0a..24f912ac5dfa 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -441,3 +441,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
435 common clone3 sys_clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index c9c879ec9b6d..edc144c4040c 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -374,3 +374,4 @@
433 n32 fspick sys_fspick
434 n32 pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 n32 pidfd_wait sys_pidfd_wait
diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl
index bbce9159caa1..da4486ea0f4f 100644
--- a/arch/mips/kernel/syscalls/syscall_n64.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n64.tbl
@@ -350,3 +350,4 @@
433 n64 fspick sys_fspick
434 n64 pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 n64 pidfd_wait sys_pidfd_wait
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index 9653591428ec..d738688e50d8 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -423,3 +423,4 @@
433 o32 fspick sys_fspick
434 o32 pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 o32 pidfd_wait sys_pidfd_wait
diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
index 670d1371aca1..d60f44d8145c 100644
--- a/arch/parisc/kernel/syscalls/syscall.tbl
+++ b/arch/parisc/kernel/syscalls/syscall.tbl
@@ -432,3 +432,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
435 common clone3 sys_clone3_wrapper
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index 3331749aab20..3309bf5f5370 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -517,3 +517,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index a90d3e945445..ef8ba9a9c3bb 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -438,3 +438,4 @@
433 common fspick sys_fspick sys_fspick
434 common pidfd_open sys_pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 common pidfd_wait sys_pidfd_wait sys_pidfd_wait
diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
index b5ed26c4c005..9e786a198bfd 100644
--- a/arch/sh/kernel/syscalls/syscall.tbl
+++ b/arch/sh/kernel/syscalls/syscall.tbl
@@ -438,3 +438,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index 8c8cc7537fb2..ef4f13907894 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -481,3 +481,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
# 435 reserved for clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index c00019abd076..76ec8c905745 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -440,3 +440,4 @@
433 i386 fspick sys_fspick __ia32_sys_fspick
434 i386 pidfd_open sys_pidfd_open __ia32_sys_pidfd_open
435 i386 clone3 sys_clone3 __ia32_sys_clone3
+438 i386 pidfd_wait sys_pidfd_wait __ia32_sys_pidfd_wait
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index c29976eca4a8..733c206130f8 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -357,6 +357,7 @@
433 common fspick __x64_sys_fspick
434 common pidfd_open __x64_sys_pidfd_open
435 common clone3 __x64_sys_clone3/ptregs
+438 common pidfd_wait __x64_sys_pidfd_wait
#
# x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
index 25f4de729a6d..417203971292 100644
--- a/arch/xtensa/kernel/syscalls/syscall.tbl
+++ b/arch/xtensa/kernel/syscalls/syscall.tbl
@@ -406,3 +406,4 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
435 common clone3 sys_clone3
+438 common pidfd_wait sys_pidfd_wait
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 88145da7d140..760e8eacb93c 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -932,6 +932,10 @@ asmlinkage long sys_clock_adjtime32(clockid_t which_clock,
asmlinkage long sys_syncfs(int fd);
asmlinkage long sys_setns(int fd, int nstype);
asmlinkage long sys_pidfd_open(pid_t pid, unsigned int flags);
+asmlinkage long sys_pidfd_wait(int pidfd, int __user *stat_addr,
+ struct siginfo __user *info,
+ struct rusage __user *ru, unsigned int states,
+ unsigned int flags);
asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
unsigned int vlen, unsigned flags);
asmlinkage long sys_process_vm_readv(pid_t pid,
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 1be0e798e362..0dd5b9d4dba0 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -850,9 +850,11 @@ __SYSCALL(__NR_pidfd_open, sys_pidfd_open)
#define __NR_clone3 435
__SYSCALL(__NR_clone3, sys_clone3)
#endif
+#define __NR_pidfd_wait 438
+__SYSCALL(__NR_pidfd_wait, sys_pidfd_wait)
#undef __NR_syscalls
-#define __NR_syscalls 436
+#define __NR_syscalls 439
/*
* 32 bit systems traditionally used different
--
2.22.0
^ permalink raw reply related
* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.3-2 tag
From: pr-tracker-bot @ 2019-07-24 17:10 UTC (permalink / raw)
To: Michael Ellerman
Cc: aarcange, ego, mikey, shawn, Linus Torvalds, linux-kernel, clg,
sjitindarsingh, vaibhav, linuxppc-dev
In-Reply-To: <87o91j5z20.fsf@concordia.ellerman.id.au>
The pull request you sent on Wed, 24 Jul 2019 23:42:31 +1000:
> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.3-2
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/bed38c3e2dca01b358a62b5e73b46e875742fd75
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
^ 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