LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2] powerpc/xive: Avoid unitialized variable
From: Cédric Le Goater @ 2018-08-24  6:58 UTC (permalink / raw)
  To: Breno Leitao, linuxppc-dev
In-Reply-To: <1535066799-8493-1-git-send-email-leitao@debian.org>

On 08/24/2018 01:26 AM, Breno Leitao wrote:
> From: Breno Leitao <breno.leitao@gmail.com>
> 
> Function xive_native_get_ipi() might uses chip_id without it being
> initialized.
> 
> This gives the following error on 'smatch' tool:
> 
> 	error: uninitialized symbol 'chip_id'
> 
> The suggestion is using xc->chip_id instead of consulting the OF for chip id,
> which is safe since xive_prepare_cpu() should have initialized ->chip_id by
> the time xive_native_get_ipi() is called.
> 
> CC: Cédric Le Goater <clg@kaod.org>
> Signed-off-by: Breno Leitao <leitao@debian.org>



Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> ---
>  arch/powerpc/sysdev/xive/native.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
> index 311185b9960a..bd90fd464a3a 100644
> --- a/arch/powerpc/sysdev/xive/native.c
> +++ b/arch/powerpc/sysdev/xive/native.c
> @@ -238,20 +238,11 @@ static bool xive_native_match(struct device_node *node)
>  #ifdef CONFIG_SMP
>  static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc)
>  {
> -	struct device_node *np;
> -	unsigned int chip_id;
>  	s64 irq;
>  
> -	/* Find the chip ID */
> -	np = of_get_cpu_node(cpu, NULL);
> -	if (np) {
> -		if (of_property_read_u32(np, "ibm,chip-id", &chip_id) < 0)
> -			chip_id = 0;
> -	}
> -
>  	/* Allocate an IPI and populate info about it */
>  	for (;;) {
> -		irq = opal_xive_allocate_irq(chip_id);
> +		irq = opal_xive_allocate_irq(xc->chip_id);
>  		if (irq == OPAL_BUSY) {
>  			msleep(1);
>  			continue;
> 

^ permalink raw reply

* Re: [PATCH] drivers/video/fbdev: use ioremap_wc() instead of __ioremap(_PAGE_NO_CACHE)
From: Segher Boessenkool @ 2018-08-24 11:05 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Bartlomiej Zolnierkiewicz, linux-fbdev, linuxppc-dev,
	linux-kernel, dri-devel
In-Reply-To: <0fe514f6e105a2c7f773679a14fce80216594a9b.1535103285.git.christophe.leroy@c-s.fr>

On Fri, Aug 24, 2018 at 10:16:22AM +0000, Christophe Leroy wrote:
> _PAGE_NO_CACHE is a target specific flag. Prefer generic functions.

>  #ifdef CONFIG_PPC
> -	p->screen_base = __ioremap(addr, 0x200000, _PAGE_NO_CACHE);
> +	p->screen_base = ioremap_wc(addr, 0x200000);
>  #else

But that is not the same.  I think you want ioremap_nocache?


Segher

^ permalink raw reply

* Re: [PATCH] drivers/video/fbdev: use ioremap_wc() instead of __ioremap(_PAGE_NO_CACHE)
From: Christophe LEROY @ 2018-08-24 11:10 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: Bartlomiej Zolnierkiewicz, linux-fbdev, linuxppc-dev,
	linux-kernel, dri-devel
In-Reply-To: <20180824110548.GV24439@gate.crashing.org>



Le 24/08/2018 à 13:05, Segher Boessenkool a écrit :
> On Fri, Aug 24, 2018 at 10:16:22AM +0000, Christophe Leroy wrote:
>> _PAGE_NO_CACHE is a target specific flag. Prefer generic functions.
> 
>>   #ifdef CONFIG_PPC
>> -	p->screen_base = __ioremap(addr, 0x200000, _PAGE_NO_CACHE);
>> +	p->screen_base = ioremap_wc(addr, 0x200000);
>>   #else
> 
> But that is not the same.  I think you want ioremap_nocache?
> 
> 

No, ioremap_nocache() is _PAGE_NO_CACHE | _PAGE_GUARDED



/arch/powerpc/include/asm/io.h

#define ioremap_nocache(addr, size)	ioremap((addr), (size))


/arch/powerpc/mm/pgtable_32.c:

void __iomem *
ioremap_wc(phys_addr_t addr, unsigned long size)
{
	return __ioremap_caller(addr, size, _PAGE_NO_CACHE,
				__builtin_return_address(0));
}

void __iomem *
ioremap(phys_addr_t addr, unsigned long size)
{
	return __ioremap_caller(addr, size, _PAGE_NO_CACHE | _PAGE_GUARDED,
				__builtin_return_address(0));
}

Christophe

^ permalink raw reply

* Re: [PATCH 1/2] macintosh: therm_windtunnel: drop using attach_adapter
From: Wolfram Sang @ 2018-08-24 12:47 UTC (permalink / raw)
  To: linux-i2c
  Cc: linuxppc-dev, Benjamin Herrenschmidt, Michael Ellerman,
	linux-kernel
In-Reply-To: <20180821150240.19964-2-wsa@the-dreams.de>

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

On Tue, Aug 21, 2018 at 05:02:39PM +0200, Wolfram Sang wrote:
> As we now have deferred probing, we can use a custom mechanism and
> finally get rid of the legacy interface from the i2c core.
> 
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 2/2] i2c: remove deprecated attach_adapter callback
From: Wolfram Sang @ 2018-08-24 12:47 UTC (permalink / raw)
  To: linux-i2c
  Cc: linuxppc-dev, Benjamin Herrenschmidt, Michael Ellerman,
	linux-kernel
In-Reply-To: <20180821150240.19964-3-wsa@the-dreams.de>

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

On Tue, Aug 21, 2018 at 05:02:40PM +0200, Wolfram Sang wrote:
> There aren't any users left. Remove this callback from the 2.4 times.
> Phew, finally, that took years to reach...
> 
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-4.19-2 tag
From: Michael Ellerman @ 2018-08-24 13:06 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: aneesh.kumar, benh, christophe.leroy, hbathini, linux-kernel,
	linuxppc-dev, luke, mahesh, naveen.n.rao, npiggin, paulus, srikar

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi Linus,

Please pull powerpc fixes for 4.19:

The following changes since commit a2dc009afa9ae8b92305be7728676562a104cb40:

  powerpc/mm/book3s/radix: Add mapping statistics (2018-08-13 16:35:05 +1000)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-4.19-2

for you to fetch changes up to 0f52b3a00c789569d7ed822b5a6b30f59a8d4393:

  powerpc/mce: Fix SLB rebolting during MCE recovery path. (2018-08-23 23:40:10 +1000)

- ------------------------------------------------------------------
powerpc fixes for 4.19 #2

 - An implementation for the newly added hv_ops->flush() for the OPAL hvc
   console driver backends, I forgot to apply this after merging the hvc driver
   changes before the merge window.

 - Enable all PCI bridges at boot on powernv, to avoid races when multiple
   children of a bridge try to enable it simultaneously. This is a workaround
   until the PCI core can be enhanced to fix the races.

 - A fix to query PowerVM for the correct system topology at boot before
   initialising sched domains, seen in some configurations to cause broken
   scheduling etc.

 - A fix for pte_access_permitted() on "nohash" platforms.

 - Two commits to fix SIGBUS when using remap_pfn_range() seen on Power9 due to
   a workaround when using the nest MMU (GPUs, accelerators).

 - Another fix to the VFIO code used by KVM, the previous fix had some bugs
   which caused guests to not start in some configurations.

 - A handful of other minor fixes.

Thanks to:
  Aneesh Kumar K.V, Benjamin Herrenschmidt, Christophe Leroy, Hari Bathini, Luke
  Dashjr, Mahesh Salgaonkar, Nicholas Piggin, Paul Mackerras, Srikar Dronamraju.

- ------------------------------------------------------------------
Aneesh Kumar K.V (2):
      powerpc/mm/books3s: Add new pte bit to mark pte temporarily invalid.
      powerpc/mm/radix: Only need the Nest MMU workaround for R -> RW transition

Benjamin Herrenschmidt (1):
      powerpc/powernv/pci: Work around races in PCI bridge enabling

Christophe Leroy (1):
      powerpc/nohash: fix pte_access_permitted()

Hari Bathini (1):
      powerpc/fadump: cleanup crash memory ranges support

Luke Dashjr (1):
      powerpc64/ftrace: Include ftrace.h needed for enable/disable calls

Mahesh Salgaonkar (1):
      powerpc/mce: Fix SLB rebolting during MCE recovery path.

Michael Ellerman (1):
      powerpc/traps: Avoid rate limit messages from show unhandled signals

Nicholas Piggin (2):
      powerpc/64s: Fix PACA_IRQ_HARD_DIS accounting in idle_power4()
      powerpc/powernv: provide a console flush operation for opal hvc driver

Paul Mackerras (1):
      KVM: PPC: Book3S: Fix guest DMA when guest partially backed by THP pages

Srikar Dronamraju (1):
      powerpc/topology: Get topology for shared processors at boot


 arch/powerpc/include/asm/book3s/64/pgtable.h | 18 +++++-
 arch/powerpc/include/asm/nohash/pgtable.h    |  9 +--
 arch/powerpc/include/asm/opal.h              |  1 +
 arch/powerpc/include/asm/topology.h          |  5 ++
 arch/powerpc/kernel/fadump.c                 |  8 +--
 arch/powerpc/kernel/idle_power4.S            | 16 +++++-
 arch/powerpc/kernel/smp.c                    |  5 ++
 arch/powerpc/kernel/traps.c                  | 13 ++---
 arch/powerpc/kvm/book3s_hv.c                 |  1 +
 arch/powerpc/mm/mmu_context_iommu.c          | 17 +++---
 arch/powerpc/mm/numa.c                       | 20 +++----
 arch/powerpc/mm/pgtable-radix.c              |  8 ++-
 arch/powerpc/mm/slb.c                        |  2 +-
 arch/powerpc/platforms/powernv/opal.c        | 83 +++++++++++++++++-----------
 arch/powerpc/platforms/powernv/pci-ioda.c    | 37 +++++++++++++
 drivers/tty/hvc/hvc_opal.c                   |  2 +
 16 files changed, 170 insertions(+), 75 deletions(-)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAluAAlEACgkQUevqPMjh
pYAueQ//Zd7kQQjarCi9Je008GtEEFXL+8GgXnIuyXxKnBgJaueTgN9gg0hCIV05
bQazC5Mzg4jY2QJVh1Kft4bxdB01RDAh7G5E0Gbi16/E4UcqvIS+7s+hZds9RI45
exH5qjj/V5pejL2+7Ct5F5eBjysoYxZ0Jn5gyQICjOgaK57Z/q5x9lvUhOfdpJk/
VxT6Uu62a/wwlVsaRmXS3c3byufJgNLTwBtJ1q/5+El2NR3F0nSzGxG99IupSWrw
dWcSZbsNKvXjGh9U46WNnJTMJLp2IH4l/INX2tg4PR2m+ZsIFKAgmqej39YIv8gk
4Md2kje/3/Y6mqy8sA1Eh8Wc3+VM2QEhMhJ27T7Ooivk0ljooR9AtMMwkrj1TrCK
zh4lWBxfaaRfTQH/cmafz6yfgpXAAMig/4XI1gOb53mPfYkByzFsZcFUC6ytic72
6q0gNDGtgdFD99rI4qUDc6QxrdDSKUin4hRaLoh8sL4mCyT6tdsATwL3Jn1kY2e3
rhaCHUw3V6evbkd+OiW5V7KBO4vvd3sIEYiWGiqIIevls8DeS6hhwpL4zVQBah+L
m9juSb9FvdHs/+jIDOIdyDncDh9rRoctQoXHyRQ3ocduM4b2CJu+tja4ZilJ2KpW
lZEwwF4v3v5OZ/qMqh3sZp5dp+py61mH+a4OAIe123qTXgiv1SA=
=GMLT
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available
From: Roy Pledge @ 2018-08-24 14:52 UTC (permalink / raw)
  To: Alexandre Belloni, Leo Li
  Cc: linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <20180823213600.23426-1-alexandre.belloni@bootlin.com>

On 8/23/2018 5:36 PM, Alexandre Belloni wrote:=0A=
> If the qman driver (qman_ccsr) doesn't probe or fail to probe before=0A=
> qman_portal, qm_ccsr_start will be either NULL or a stale pointer to an=
=0A=
> unmapped page.=0A=
>=0A=
> This leads to a crash when probing  qman_portal as the init_pcfg function=
=0A=
> calls qman_liodn_fixup that tries to read qman registers.=0A=
>=0A=
> Assume that qman didn't probe when the pool mask is 0.=0A=
>=0A=
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>=0A=
> ---=0A=
>  drivers/soc/fsl/qbman/qman_portal.c | 2 ++=0A=
>  1 file changed, 2 insertions(+)=0A=
>=0A=
> diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/=
qman_portal.c=0A=
> index a120002b630e..4fc80d2c8feb 100644=0A=
> --- a/drivers/soc/fsl/qbman/qman_portal.c=0A=
> +++ b/drivers/soc/fsl/qbman/qman_portal.c=0A=
> @@ -277,6 +277,8 @@ static int qman_portal_probe(struct platform_device *=
pdev)=0A=
>  	}=0A=
>  =0A=
>  	pcfg->pools =3D qm_get_pools_sdqcr();=0A=
> +	if (pcfg->pools =3D=3D 0)=0A=
> +		return -EPROBE_DEFER;=0A=
>  =0A=
>  	spin_lock(&qman_lock);=0A=
>  	cpu =3D cpumask_next_zero(-1, &portal_cpus);=0A=
=0A=
Reviewed-by: Roy Pledge <roy.pledge@nxp.com>=0A=
=0A=
=0A=

^ permalink raw reply

* Re: [PATCH 2/2] soc: fsl: qbman: qman: avoid allocating from non existing gen_pool
From: Roy Pledge @ 2018-08-24 14:53 UTC (permalink / raw)
  To: Alexandre Belloni, Leo Li
  Cc: linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <20180823213600.23426-2-alexandre.belloni@bootlin.com>

On 8/23/2018 5:36 PM, Alexandre Belloni wrote:=0A=
> If the qman driver didn't probe, calling qman_alloc_fqid_range,=0A=
> qman_alloc_pool_range or qman_alloc_cgrid_range (as done in dpaa_eth) wil=
l=0A=
> pass a NULL pointer to gen_pool_alloc, leading to a NULL pointer=0A=
> dereference.=0A=
>=0A=
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>=0A=
> ---=0A=
>  drivers/soc/fsl/qbman/qman.c | 3 +++=0A=
>  1 file changed, 3 insertions(+)=0A=
>=0A=
> diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c=
=0A=
> index ecb22749df0b..8cc015183043 100644=0A=
> --- a/drivers/soc/fsl/qbman/qman.c=0A=
> +++ b/drivers/soc/fsl/qbman/qman.c=0A=
> @@ -2729,6 +2729,9 @@ static int qman_alloc_range(struct gen_pool *p, u32=
 *result, u32 cnt)=0A=
>  {=0A=
>  	unsigned long addr;=0A=
>  =0A=
> +	if (!p)=0A=
> +		return -ENODEV;=0A=
> +=0A=
>  	addr =3D gen_pool_alloc(p, cnt);=0A=
>  	if (!addr)=0A=
>  		return -ENOMEM;=0A=
=0A=
Reviewed-by: Roy Pledge <roy.pledge@nxp.com>=0A=
=0A=

^ permalink raw reply

* Re: DT case sensitivity
From: Rob Herring @ 2018-08-24 15:14 UTC (permalink / raw)
  To: segher
  Cc: Benjamin Herrenschmidt, Stephen Rothwell, Kumar Gala, devicetree,
	devicetree-spec, linuxppc-dev, Grant Likely, Frank Rowand,
	David Gibson
In-Reply-To: <20180823123650.GT24439@gate.crashing.org>

On Thu, Aug 23, 2018 at 7:37 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Thu, Aug 23, 2018 at 11:29:01AM +1000, Benjamin Herrenschmidt wrote:
> > On Wed, 2018-08-22 at 20:26 -0500, Rob Herring wrote:
> > > On Wed, Aug 22, 2018 at 8:14 PM Benjamin Herrenschmidt
> > > <benh@kernel.crashing.org> wrote:
> > > >
> > > > On Wed, 2018-08-22 at 19:47 -0500, Rob Herring wrote:
> > > > > The default DT string handling in the kernel is node names and
> > > > > compatibles are case insensitive and property names are case sensitive
> > > > > (Sparc is the the only variation and is opposite). It seems only PPC
> > > > > (and perhaps only Power Macs?) needs to support case insensitive
> > > > > comparisons. It was probably a mistake to follow PPC for new arches
> > > > > and we should have made everything case sensitive from the start. So I
> > > > > have a few questions for the DT historians. :)
> > > >
> > > > Open Firmware itself is insensitive.
> > >
> > > Doesn't it depend on the implementation? Otherwise, how is Sparc different?
> >
> > Not sure ...
>
> The standard requires case-sensitive.
>
> > Forth itself is insensitive for words
>
> Not even.   http://forth.sourceforge.net/std/dpans/dpans3.htm#3.3.1.2
>
> (Most non-ancient implementations are though).
>
> > but maybe not for string comparisons.
>
> Only COMPARE is standardised, and that is case-sensitive comparison.  Many
> systems have other words to do case-insensitive comparisons, or words where
> some runtime flag determines the case-sensitivity.
>
> Btw.  A node name in Open Firmware is generically
>   driver-name@unit-address:device-arguments
> where driver-name is the part that is in the "name" property; this whole
> case-sensitivity business is even worse for FDT, where you also treat the
> unit address as part of the name.  In real Open Firmware the address is
> compared *as a number* (or as a few numbers), so it is naturally case-
> insensitive (it does not care if you write 01a0 or 01A0, or 1a0 or 000001a0
> etc.)

True, but it is very rare at least in Linux to look at the
unit-addresses. dtc now does some checking on unit-addresses too, so
we should at least be consistent.

Another question: Is there ever a case where the node name in the path
aka 'driver-name' doesn't match the 'name' property? I think this
generally can't happen on FDT as the 'name' property is generated when
we unflatten it though I suppose one could craft an FDT with name
properties.

There's also various places in the kernel that check for a NULL name
which doesn't seem like it could happen either other than the root
node.

Rob

^ permalink raw reply

* Re: [PATCH 5/5] arm64: dts: add LX2160ARDB board support
From: Rob Herring @ 2018-08-24 16:16 UTC (permalink / raw)
  To: vabhav.sharma
  Cc: linux-kernel@vger.kernel.org, devicetree, Mark Rutland,
	linuxppc-dev,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Michael Turquette, Stephen Boyd, Rafael J. Wysocki, Viresh Kumar,
	linux-clk, open list:THERMAL, linux-kernel-owner, Catalin Marinas,
	Will Deacon, Greg Kroah-Hartman, Arnd Bergmann, Kate Stewart,
	Masahiro Yamada, Russell King, V.Sethi, Udit Kumar, Priyanka Jain,
	Sriram Dash
In-Reply-To: <AM6PR04MB478980C90EE825D024D8B977F3370@AM6PR04MB4789.eurprd04.prod.outlook.com>

On Thu, Aug 23, 2018 at 10:08 AM Vabhav Sharma <vabhav.sharma@nxp.com> wrote:

[...]

> > > +               i2c@3 {
> > > +                       #address-cells = <1>;
> > > +                       #size-cells = <0>;
> > > +                       reg = <0x3>;
> > > +
> > > +                       sa56004@4c {
> >
> > temperature-sensor@4c
> Ok, temperature-sensor-1@4c

No, that's not what I said. You don't need the '-1' because the
unit-address makes the node name unique. Node names are supposed to be
generic based on the class/type of device. See the DT spec.

> >
> > > +                               compatible = "nxp,sa56004";
> > > +                               reg = <0x4c>;
> > > +                       };
> > > +
> > > +                       sa56004@4d {
> Ok,temperature-sensor-2@4d
> > > +                               compatible = "nxp,sa56004";
> > > +                               reg = <0x4d>;
> > > +                       };
> > > +               };
> > > +       };
> > > +};
> > > +
> > > +&i2c4 {
> > > +       status = "okay";
> > > +
> > > +       rtc@51 {
> > > +               compatible = "nxp,pcf2129";
> > > +               reg = <0x51>;
> > > +               // IRQ10_B
> > > +               interrupts = <0 150 0x4>;
> > > +               };
> > > +
> > > +};
> > > +
> > > +&usb0 {
> > > +       status = "okay";
> > > +};
> > > +
> > > +&usb1 {
> > > +       status = "okay";
> > > +};
> > > +
> > > +&crypto {
> > > +       status = "okay";
> > > +};
> > > --
> > > 2.7.4
> > >

^ permalink raw reply

* Re: MPC83xx reset status register (RSR, offset 0x910)
From: Christophe Leroy @ 2018-08-24 16:20 UTC (permalink / raw)
  To: Radu Rendec, linuxppc-dev; +Cc: Scott Wood
In-Reply-To: <CAD5jUk_e3LwPZGN7G3ZGHx=zdQBZSdAeoKWjxwE7Ei2=LtXQTg@mail.gmail.com>

Hi

On 08/03/2018 04:36 PM, Radu Rendec wrote:
> Hi Everyone,
> 
> Is there any kernel code that handles the "reset status register" (RSR)
> on MPC83xx? I looked at arch/powerpc/platforms/83xx/misc.c, but it seems
> to only map the reset register area and it's static. The watchdog driver
> (drivers/watchdog/mpc8xxx_wdt.c) doesn't seem to look at it either (for
> the bootstatus flags).

How do you boot your Linux kernel ?

My 832x board boots using U-boot, and U-boot reads the RSR then clears 
it. So when Linux kernel reads it, it is just 0.

> 
> Basically I need to check the CPU reset reason and I thought I would ask
> first, before starting to write any code of my own.

Anyway, find below a set of two patches I used for testing. Feel free to 
use them if you bootloader doesn't clear the register

Christophe

commit f5171b463b149d6d60816fd9673e0367c0d6a90c
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Wed Aug 22 12:49:42 2018 +0000

     powerpc/83xx: Show reset status at startup

     The 83xx has a register called Reset Status Register that
     shows the reason of the last reset.

     Print this reason at startup.

     Suggested-by: Radu Rendec <radu.rendec@gmail.com>

diff --git a/arch/powerpc/platforms/83xx/misc.c 
b/arch/powerpc/platforms/83xx/misc.c
index 773559431459..a3dbc22088d9 100644
--- a/arch/powerpc/platforms/83xx/misc.c
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -24,6 +24,16 @@
  #include "mpc83xx.h"

  #define RST_OFFSET	0x00000900
+#define RST_STAT_REG	0x00000010
+#define RSR_BSF		BIT(15)
+#define RSR_SWSR	BIT(18)
+#define RSR_SWHR	BIT(19)
+#define RSR_JSRS	BIT(23)
+#define RSR_CSHR	BIT(27)
+#define RSR_SWRS	BIT(28)
+#define RSR_BMRS	BIT(29)
+#define RSR_SRS		BIT(30)
+#define RSR_HRS		BIT(31)
  #define RST_PROT_REG	0x00000018
  #define RST_CTRL_REG	0x0000001c

@@ -34,6 +44,32 @@ static int __init mpc83xx_restart_init(void)
  	/* map reset restart_reg_baseister space */
  	restart_reg_base = ioremap(get_immrbase() + RST_OFFSET, 0xff);

+	if (restart_reg_base) {
+		u32 status = in_be32(restart_reg_base + (RST_STAT_REG >> 2));
+
+		if (status & RSR_BSF)
+			pr_info("Reset Status: Boot Sequencer Fail\n");
+		if (status & RSR_SWSR)
+			pr_info("Reset Status: Software soft reset\n");
+		if (status & RSR_SWHR)
+			pr_info("Reset Status: Software hard reset\n");
+		if (status & RSR_JSRS)
+			pr_info("Reset Status: JTAG soft reset\n");
+		if (status & RSR_CSHR)
+			pr_info("Reset Status: Checkstop reset\n");
+		if (status & RSR_SWRS)
+			pr_info("Reset Status: Software watchdog reset\n");
+		if (status & RSR_BMRS)
+			pr_info("Reset Status: Bus monitor reset\n");
+		if (status & RSR_SRS)
+			pr_info("Reset Status: Soft reset\n");
+		if (status & RSR_HRS)
+			pr_info("Reset Status: Hard reset\n");
+
+		/* clear reset statuses */
+		out_be32(restart_reg_base + (RST_STAT_REG >> 2), status);
+	}
+
  	return 0;
  }


commit c1ef17dd9c736c5e1b94da68852ae761a193090f
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Wed Aug 22 12:19:02 2018 +0000

     powerpc/83xx: Move reset registers defines before functions

     Move the registers defines before/out of the functions.
     Reuse in another function.

diff --git a/arch/powerpc/platforms/83xx/misc.c 
b/arch/powerpc/platforms/83xx/misc.c
index d75c9816a5c9..773559431459 100644
--- a/arch/powerpc/platforms/83xx/misc.c
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -23,12 +23,16 @@

  #include "mpc83xx.h"

+#define RST_OFFSET	0x00000900
+#define RST_PROT_REG	0x00000018
+#define RST_CTRL_REG	0x0000001c
+
  static __be32 __iomem *restart_reg_base;

  static int __init mpc83xx_restart_init(void)
  {
  	/* map reset restart_reg_baseister space */
-	restart_reg_base = ioremap(get_immrbase() + 0x900, 0xff);
+	restart_reg_base = ioremap(get_immrbase() + RST_OFFSET, 0xff);

  	return 0;
  }
@@ -37,10 +41,6 @@ arch_initcall(mpc83xx_restart_init);

  void __noreturn mpc83xx_restart(char *cmd)
  {
-#define RST_OFFSET	0x00000900
-#define RST_PROT_REG	0x00000018
-#define RST_CTRL_REG	0x0000001c
-
  	local_irq_disable();

  	if (restart_reg_base) {

^ permalink raw reply related

* [RFC PATCH 00/11] Secure Virtual Machine Enablement
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Thiago Jung Bauermann

[ Some people didn't receive all the patches in this series, even though
  the linuxppc-dev list did so trying to send again. This is exactly the
  same series I posted yesterday. Sorry for the clutter. ]

This series contains preliminary work to enable Secure Virtual Machines
(SVM) on powerpc. SVMs request to be migrated to secure memory very early in
the boot process (in prom_init()), so by default all of their memory is
inaccessible to the hypervisor. There is an ultravisor call that the VM can
use to request certain pages to be made accessible (aka shared).

The objective of these patches is to have the guest perform this request for
buffers that need to be shared with the hypervisor, such as the LPPACAs, the
SWIOTLB buffer and the Debug Trace Log. This work is incomplete: there are
surely other memory regions that need to be made accessible, but I'm posting
it early to get comments on whether the approach being taken is appropriate.

It should be applied on top of the generic virtio DMA API rework series
posted earlier, which adds a platform hook to override any arch based DMA
API operations for any virtio device:

https://lists.ozlabs.org/pipermail/linuxppc-dev/2018-July/175994.html

I'm aware that changes need to be made to the patch series above, but IIUC
it depends on upcoming virtio cleanup from Christoph Hellwig so for now the
patch series above will be used as a stepping stone for this series.

This code has been tested with virtio block, net and scsi devices with and
without VIRTIO_F_IOMMU_PLATFORM flag. Please let me know what you think.

For now I am testing on a regular guest with a couple of patches on top
forcing is_svm_platform() to always return true and adding debug messages to
confirm that mem_convert_shared() is being called in the expected places.

These are the commands I'm using to start up the guest:

Without VIRTIO_F_IOMMU_PLATFORM:

qemu-system-ppc64 \
  -enable-kvm \
  -kernel /home/bauermann/src/linux/arch/powerpc/boot/zImage \
  -append "root=PARTUUID=e550ad6f-05 ro" \
  -machine pseries-2.6 \
  -m 8G \
  -smp 2 \
  -serial mon:stdio \
  -nographic \
  -nodefaults \
  -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 \
  -drive file=/home/bauermann/VMs/svm.qcow2,format=qcow2,if=none,id=drive-scsi0-0-0-0 \
  -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
  -drive file=/home/bauermann/VMs/svm-blk.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 \
  -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 \
  -device virtio-net,netdev=hostnet0,id=net0,mac=52:54:00:96:70:1f \
  -netdev user,id=hostnet0 \
  -set netdev.hostnet0.hostfwd=tcp::42022-:22

With VIRTIO_F_IOMMU_PLATFORM. Same as above plus some -global options so
that the virtio devices use the modern interface rather than the
transitional one:

qemu-system-ppc64 \
  -enable-kvm \
  -kernel /home/bauermann/src/linux/arch/powerpc/boot/zImage \
  -append "root=PARTUUID=e550ad6f-05 ro" \
  -machine pseries-2.6 \
  -m 8G \
  -smp 2 \
  -serial mon:stdio \
  -nographic \
  -nodefaults \
  -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 \
  -drive file=/home/bauermann/VMs/svm.qcow2,format=qcow2,if=none,id=drive-scsi0-0-0-0 \
  -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
  -drive file=/home/bauermann/VMs/svm-blk.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 \
  -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 \
  -device virtio-net,netdev=hostnet0,id=net0,mac=52:54:00:96:70:1f \
  -netdev user,id=hostnet0 \
  -set netdev.hostnet0.hostfwd=tcp::42022-:22 \
  -global virtio-blk-pci.iommu_platform=true \
  -global virtio-blk-pci.disable-legacy=on \
  -global virtio-blk-pci.disable-modern=off \
  -global virtio-net-pci.iommu_platform=true \
  -global virtio-net-pci.disable-legacy=on \
  -global virtio-net-pci.disable-modern=off \
  -global virtio-scsi-pci.iommu_platform=true \
  -global virtio-scsi-pci.disable-legacy=on \
  -global virtio-scsi-pci.disable-modern=off

The code was tested with a couple of other permutations where one virtio
device has the flag VIRTIO_F_IOMMU_PLATFORM and others don't. Please suggest
some other scenarios which need to be tested as well.

Anshuman Khandual (10):
  powerpc/svm: Detect Secure Virtual Machine (SVM) platform
  powerpc/svm: Select CONFIG_DMA_DIRECT_OPS and CONFIG_SWIOTLB
  powerpc/svm: Add memory conversion (shared/secure) helper functions
  powerpc/svm: Convert SWIOTLB buffers to shared memory
  powerpc/svm: Don't release SWIOTLB buffers on secure guests
  powerpc/svm: Use SWIOTLB DMA API for all virtio devices
  powerpc/svm: Use shared memory for Debug Trace Log (DTL)
  powerpc/svm: Use shared memory for LPPACA structures
  powerpc/svm: Force the use of bounce buffers
  powerpc/svm: Increase SWIOTLB buffer size

Thiago Jung Bauermann (1):
  powerpc: Add and use LPPACA_SIZE constant

 arch/powerpc/Kconfig                   | 22 ++++++++
 arch/powerpc/include/asm/mem_encrypt.h | 19 +++++++
 arch/powerpc/include/asm/reg.h         |  3 ++
 arch/powerpc/include/asm/svm.h         | 26 +++++++++
 arch/powerpc/kernel/Makefile           |  1 +
 arch/powerpc/kernel/paca.c             | 41 ++++++++++++--
 arch/powerpc/kernel/svm.c              | 99 ++++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/iommu.c |  6 ++-
 arch/powerpc/platforms/pseries/setup.c |  5 +-
 kernel/dma/swiotlb.c                   |  5 ++
 10 files changed, 221 insertions(+), 6 deletions(-)
 create mode 100644 arch/powerpc/include/asm/mem_encrypt.h
 create mode 100644 arch/powerpc/include/asm/svm.h
 create mode 100644 arch/powerpc/kernel/svm.c

^ permalink raw reply

* [RFC PATCH 01/11] powerpc/svm: Detect Secure Virtual Machine (SVM) platform
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Sukadev Bhattiprolu, Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

A guest requests to be moved to secure memory early at the kernel
startup (in prom_init). Define a flag that can be easily checked by other
parts of the kernel so that they can set things up accordingly. This is
done by checking the MSR(S) bit, which is always set for secure VMs.

Also add a new config option CONFIG_PPC_SVM to wrap all these code to
prevent it from being executed from non subscribing platforms. This SVM
platform detection is applicable only to guest kernels that will run under
an Ultravisor as a secure guest.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/Kconfig           | 11 +++++++++++
 arch/powerpc/include/asm/reg.h |  3 +++
 arch/powerpc/include/asm/svm.h | 22 ++++++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9f2b75fe2c2d..f786c962edf0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -440,6 +440,17 @@ config MATH_EMULATION_HW_UNIMPLEMENTED
 
 endchoice
 
+config PPC_SVM
+       bool "Secure virtual machine (SVM) support for POWERPC"
+       default n
+       depends on PPC_PSERIES
+       help
+         Support secure guests on POWERPC. There are certain POWER platforms
+	 which support secure guests with the help of an Ultravisor executing
+	 below the hypervisor layer. This enables the support for those guests.
+
+	 If unsure, say "N".
+
 config PPC_TRANSACTIONAL_MEM
        bool "Transactional Memory support for POWERPC"
        depends on PPC_BOOK3S_64
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 562568414cf4..fcf7b79356d0 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -36,6 +36,7 @@
 #define MSR_TM_LG	32		/* Trans Mem Available */
 #define MSR_VEC_LG	25	        /* Enable AltiVec */
 #define MSR_VSX_LG	23		/* Enable VSX */
+#define MSR_S_LG	22		/* Secure VM bit */
 #define MSR_POW_LG	18		/* Enable Power Management */
 #define MSR_WE_LG	18		/* Wait State Enable */
 #define MSR_TGPR_LG	17		/* TLB Update registers in use */
@@ -69,11 +70,13 @@
 #define MSR_SF		__MASK(MSR_SF_LG)	/* Enable 64 bit mode */
 #define MSR_ISF		__MASK(MSR_ISF_LG)	/* Interrupt 64b mode valid on 630 */
 #define MSR_HV 		__MASK(MSR_HV_LG)	/* Hypervisor state */
+#define MSR_S 		__MASK(MSR_S_LG)	/* Secure state */
 #else
 /* so tests for these bits fail on 32-bit */
 #define MSR_SF		0
 #define MSR_ISF		0
 #define MSR_HV		0
+#define MSR_S		0
 #endif
 
 /*
diff --git a/arch/powerpc/include/asm/svm.h b/arch/powerpc/include/asm/svm.h
new file mode 100644
index 000000000000..6f89e5d6d37f
--- /dev/null
+++ b/arch/powerpc/include/asm/svm.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * SVM helper functions
+ *
+ * Copyright 2018 Anshuman Khandual, IBM Corporation.
+ */
+
+#ifndef _ASM_POWERPC_SVM_H
+#define _ASM_POWERPC_SVM_H
+
+#ifdef CONFIG_PPC_SVM
+static bool is_svm_platform(void)
+{
+	return mfmsr() & MSR_S;
+}
+#else
+static inline bool is_svm_platform(void)
+{
+	return false;
+}
+#endif
+#endif /* _ASM_POWERPC_SVM_H */

^ permalink raw reply related

* [RFC PATCH 02/11] powerpc/svm: Select CONFIG_DMA_DIRECT_OPS and CONFIG_SWIOTLB
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

Ultravisor based secure guest platforms will use generic SWIOTLB DMA API
(i.e swiotlb_dma_ops structure) available under the CONFIG_DMA_DIRECT_OPS
config. Also base CONFIG_SWIOTLB needs to be explicitly selected as well.
Select both these config options on powerpc server platforms with secure
guest support.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index f786c962edf0..90f73d15f58a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -444,6 +444,8 @@ config PPC_SVM
        bool "Secure virtual machine (SVM) support for POWERPC"
        default n
        depends on PPC_PSERIES
+       select DMA_DIRECT_OPS
+       select SWIOTLB
        help
          Support secure guests on POWERPC. There are certain POWER platforms
 	 which support secure guests with the help of an Ultravisor executing

^ permalink raw reply related

* [RFC PATCH 03/11] powerpc/svm: Add memory conversion (shared/secure) helper functions
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

Add the following helper functions to convert PAGE_SIZE aligned memory
buffers as shared or secure (i.e., accessible to the hypervisor or not) via
Ultravisor calls.

1. mem_convert_shared(unsigned long pfn, unsigned long npages)
2. mem_convert_secure(unsigned long pfn, unsigned long npages)

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/include/asm/svm.h |  3 +++
 arch/powerpc/kernel/Makefile   |  1 +
 arch/powerpc/kernel/svm.c      | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+)

diff --git a/arch/powerpc/include/asm/svm.h b/arch/powerpc/include/asm/svm.h
index 6f89e5d6d37f..95d69e472e52 100644
--- a/arch/powerpc/include/asm/svm.h
+++ b/arch/powerpc/include/asm/svm.h
@@ -13,6 +13,9 @@ static bool is_svm_platform(void)
 {
 	return mfmsr() & MSR_S;
 }
+
+extern void mem_convert_shared(unsigned long pfn, unsigned long npages);
+extern void mem_convert_secure(unsigned long pfn, unsigned long npages);
 #else
 static inline bool is_svm_platform(void)
 {
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 2b4c40b255e4..98780b4e924c 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -113,6 +113,7 @@ ifeq ($(CONFIG_HAVE_IMA_KEXEC)$(CONFIG_IMA),yy)
 obj-y				+= ima_kexec.o
 endif
 
+obj-$(CONFIG_PPC_SVM)		+= svm.o
 obj-$(CONFIG_AUDIT)		+= audit.o
 obj64-$(CONFIG_AUDIT)		+= compat_audit.o
 
diff --git a/arch/powerpc/kernel/svm.c b/arch/powerpc/kernel/svm.c
new file mode 100644
index 000000000000..37437cf92df5
--- /dev/null
+++ b/arch/powerpc/kernel/svm.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Secure VM platform
+ *
+ * Copyright 2018 IBM Corporation
+ * Author: Anshuman Khandual <khandual@linux.vnet.ibm.com>
+ */
+
+#include <linux/mm.h>
+
+void mem_convert_shared(unsigned long pfn, unsigned long npages)
+{
+	if (!pfn_valid(pfn))
+		return;
+
+	/*
+	 * FIXME: Insert real UV call when ready
+	 *
+	 * ucall_convert_shared(paddr, size)
+	 */
+}
+
+void mem_convert_secure(unsigned long pfn, unsigned long npages)
+{
+	if (!pfn_valid(pfn))
+		return;
+
+	/*
+	 * FIXME: Insert real UV call when ready
+	 *
+	 * ucall_convert_secure(paddr, size)
+	 */
+}

^ permalink raw reply related

* [RFC PATCH 04/11] powerpc/svm: Convert SWIOTLB buffers to shared memory
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

Hook the shared memory conversion functions into the ARCH_HAS_MEM_ENCRYPT
framework and call swiotlb_update_mem_attributes() to convert SWIOTLB's
buffers to shared memory.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/Kconfig                   |  4 ++++
 arch/powerpc/include/asm/mem_encrypt.h | 19 +++++++++++++++++++
 arch/powerpc/kernel/svm.c              | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 90f73d15f58a..1466d1234723 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -440,12 +440,16 @@ config MATH_EMULATION_HW_UNIMPLEMENTED
 
 endchoice
 
+config ARCH_HAS_MEM_ENCRYPT
+	def_bool n
+
 config PPC_SVM
        bool "Secure virtual machine (SVM) support for POWERPC"
        default n
        depends on PPC_PSERIES
        select DMA_DIRECT_OPS
        select SWIOTLB
+       select ARCH_HAS_MEM_ENCRYPT
        help
          Support secure guests on POWERPC. There are certain POWER platforms
 	 which support secure guests with the help of an Ultravisor executing
diff --git a/arch/powerpc/include/asm/mem_encrypt.h b/arch/powerpc/include/asm/mem_encrypt.h
new file mode 100644
index 000000000000..2b6e37ea446c
--- /dev/null
+++ b/arch/powerpc/include/asm/mem_encrypt.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * SVM helper functions
+ *
+ * Copyright 2018 IBM Corporation
+ */
+
+#ifndef _ASM_POWERPC_MEM_ENCRYPT_H
+#define _ASM_POWERPC_MEM_ENCRYPT_H
+
+#define sme_me_mask	0ULL
+
+static inline bool sme_active(void) { return false; }
+static inline bool sev_active(void) { return false; }
+
+int set_memory_encrypted(unsigned long addr, int numpages);
+int set_memory_decrypted(unsigned long addr, int numpages);
+
+#endif /* _ASM_POWERPC_MEM_ENCRYPT_H */
diff --git a/arch/powerpc/kernel/svm.c b/arch/powerpc/kernel/svm.c
index 37437cf92df5..eab2a64d8643 100644
--- a/arch/powerpc/kernel/svm.c
+++ b/arch/powerpc/kernel/svm.c
@@ -7,6 +7,20 @@
  */
 
 #include <linux/mm.h>
+#include <linux/swiotlb.h>
+#include <asm/machdep.h>
+#include <asm/svm.h>
+
+static int __init init_svm(void)
+{
+	if (!is_svm_platform())
+		return 0;
+
+	swiotlb_update_mem_attributes();
+
+	return 0;
+}
+machine_early_initcall(pseries, init_svm);
 
 void mem_convert_shared(unsigned long pfn, unsigned long npages)
 {
@@ -31,3 +45,23 @@ void mem_convert_secure(unsigned long pfn, unsigned long npages)
 	 * ucall_convert_secure(paddr, size)
 	 */
 }
+
+int set_memory_encrypted(unsigned long addr, int numpages)
+{
+	if (!PAGE_ALIGNED(addr))
+		return -EINVAL;
+
+	mem_convert_secure(PHYS_PFN(__pa(addr)), numpages);
+
+	return 0;
+}
+
+int set_memory_decrypted(unsigned long addr, int numpages)
+{
+	if (!PAGE_ALIGNED(addr))
+		return -EINVAL;
+
+	mem_convert_shared(PHYS_PFN(__pa(addr)), numpages);
+
+	return 0;
+}

^ permalink raw reply related

* [RFC PATCH 05/11] powerpc/svm: Don't release SWIOTLB buffers on secure guests
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

Even though SWIOTLB slab gets allocated and initialized on each powerpc
platform with swiotlb_init(), it gets released away again on all server
platforms because ppc_swiotlb_enable variable never gets set. Secure
guests would require SWIOTLB DMA API support for virtio bounce buffering
purpose. Hence retain the allocated buffer by setting ppc_swiotlb_enable
variable for secure guests on Ultravisor platforms.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/kernel/svm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/svm.c b/arch/powerpc/kernel/svm.c
index eab2a64d8643..891db2de8c04 100644
--- a/arch/powerpc/kernel/svm.c
+++ b/arch/powerpc/kernel/svm.c
@@ -16,6 +16,7 @@ static int __init init_svm(void)
 	if (!is_svm_platform())
 		return 0;
 
+	ppc_swiotlb_enable = 1;
 	swiotlb_update_mem_attributes();
 
 	return 0;

^ permalink raw reply related

* [RFC PATCH 06/11] powerpc/svm: Use SWIOTLB DMA API for all virtio devices
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

Secure guest memory (GPA range) is isolated and inaccessible from the host.
But virtio ring transactions require the back end drivers to process
incoming scatter gather buffers which require their access in host. Hence a
portion of guest memory can be converted to shared memory and all buffers
need to be bounced into the pool before being passed on to the host.

SWIOTLB buffers can be pre-allocated and converted as shared memory during
early boot. Generic SWIOTLB DMA API (swiotlb_dma_ops) callbacks can be used
to bounce each incoming scatter gather I/O buffer addresses into this pool
of shared memory before being passed on to the host. All virtio devices on
secure guest platform need to use generic SWIOTLB DMA API. Utilize the new
virtio core platform hook platform_override_dma_ops() to achieve this.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/iommu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 5773bc7eb4bd..56b894d65dba 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -39,6 +39,7 @@
 #include <linux/iommu.h>
 #include <linux/rculist.h>
 #include <linux/virtio.h>
+#include <linux/virtio_config.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -51,6 +52,7 @@
 #include <asm/udbg.h>
 #include <asm/mmzone.h>
 #include <asm/plpar_wrappers.h>
+#include <asm/svm.h>
 
 #include "pseries.h"
 
@@ -1400,5 +1402,7 @@ machine_subsys_initcall_sync(pseries, tce_iommu_bus_notifier_init);
 
 void platform_override_dma_ops(struct virtio_device *vdev)
 {
-	/* Override vdev->parent.dma_ops if required */
+	if (is_svm_platform() &&
+			!virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM))
+		set_dma_ops(vdev->dev.parent, &swiotlb_dma_ops);
 }

^ permalink raw reply related

* [RFC PATCH 07/11] powerpc/svm: Use shared memory for Debug Trace Log (DTL)
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

On Ultravisor platform kmem_cache for DTL buffers must use a constructor
function which converts the underlying buddy allocated SLUB cache pages
into shared memory so that they are accessible to the hypervisor.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/include/asm/svm.h         |  1 +
 arch/powerpc/kernel/svm.c              | 30 ++++++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/setup.c |  5 ++++-
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/svm.h b/arch/powerpc/include/asm/svm.h
index 95d69e472e52..e00688761704 100644
--- a/arch/powerpc/include/asm/svm.h
+++ b/arch/powerpc/include/asm/svm.h
@@ -16,6 +16,7 @@ static bool is_svm_platform(void)
 
 extern void mem_convert_shared(unsigned long pfn, unsigned long npages);
 extern void mem_convert_secure(unsigned long pfn, unsigned long npages);
+extern void dtl_cache_ctor(void *addr);
 #else
 static inline bool is_svm_platform(void)
 {
diff --git a/arch/powerpc/kernel/svm.c b/arch/powerpc/kernel/svm.c
index 891db2de8c04..1af5caa955f5 100644
--- a/arch/powerpc/kernel/svm.c
+++ b/arch/powerpc/kernel/svm.c
@@ -66,3 +66,33 @@ int set_memory_decrypted(unsigned long addr, int numpages)
 
 	return 0;
 }
+
+/* There's one dispatch log per CPU. */
+#define NR_DTL_PAGE (DISPATCH_LOG_BYTES * CONFIG_NR_CPUS / PAGE_SIZE)
+
+static struct page *dtl_page_store[NR_DTL_PAGE];
+static long dtl_nr_pages;
+
+static bool is_dtl_page_shared(struct page *page)
+{
+	long i;
+
+	for (i = 0; i < dtl_nr_pages; i++)
+		if (dtl_page_store[i] == page)
+			return true;
+
+	return false;
+}
+
+void dtl_cache_ctor(void *addr)
+{
+	unsigned long pfn = PHYS_PFN(__pa(addr));
+	struct page *page = pfn_to_page(pfn);
+
+	if (!is_dtl_page_shared(page)) {
+		dtl_page_store[dtl_nr_pages] = page;
+		dtl_nr_pages++;
+		WARN_ON(dtl_nr_pages >= NR_DTL_PAGE);
+		mem_convert_shared(pfn, PAGE_SIZE);
+	}
+}
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 139f0af6c3d9..50ba77c802d2 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -69,6 +69,7 @@
 #include <asm/kexec.h>
 #include <asm/isa-bridge.h>
 #include <asm/security_features.h>
+#include <asm/svm.h>
 
 #include "pseries.h"
 
@@ -288,8 +289,10 @@ static inline int alloc_dispatch_logs(void)
 
 static int alloc_dispatch_log_kmem_cache(void)
 {
+	void (*ctor)(void *) = is_svm_platform() ? dtl_cache_ctor : NULL;
+
 	dtl_cache = kmem_cache_create("dtl", DISPATCH_LOG_BYTES,
-						DISPATCH_LOG_BYTES, 0, NULL);
+						DISPATCH_LOG_BYTES, 0, ctor);
 	if (!dtl_cache) {
 		pr_warn("Failed to create dispatch trace log buffer cache\n");
 		pr_warn("Stolen time statistics will be unreliable\n");

^ permalink raw reply related

* [RFC PATCH 08/11] powerpc: Add and use LPPACA_SIZE constant
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

Helps document what the hard-coded number means.

Suggested-by: Alexey Kardashevskiy <aik@linux.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/kernel/paca.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 0ee3e6d50f28..1edf8695019d 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -24,6 +24,8 @@
 #define boot_cpuid 0
 #endif
 
+#define LPPACA_SIZE 0x400
+
 static void *__init alloc_paca_data(unsigned long size, unsigned long align,
 				unsigned long limit, int cpu)
 {
@@ -70,7 +72,7 @@ static inline void init_lppaca(struct lppaca *lppaca)
 
 	*lppaca = (struct lppaca) {
 		.desc = cpu_to_be32(0xd397d781),	/* "LpPa" */
-		.size = cpu_to_be16(0x400),
+		.size = cpu_to_be16(LPPACA_SIZE),
 		.fpregs_in_use = 1,
 		.slb_count = cpu_to_be16(64),
 		.vmxregs_in_use = 0,
@@ -80,14 +82,13 @@ static inline void init_lppaca(struct lppaca *lppaca)
 static struct lppaca * __init new_lppaca(int cpu, unsigned long limit)
 {
 	struct lppaca *lp;
-	size_t size = 0x400;
 
-	BUILD_BUG_ON(size < sizeof(struct lppaca));
+	BUILD_BUG_ON(LPPACA_SIZE < sizeof(struct lppaca));
 
 	if (early_cpu_has_feature(CPU_FTR_HVMODE))
 		return NULL;
 
-	lp = alloc_paca_data(size, 0x400, limit, cpu);
+	lp = alloc_paca_data(LPPACA_SIZE, 0x400, limit, cpu);
 	init_lppaca(lp);
 
 	return lp;

^ permalink raw reply related

* [RFC PATCH 09/11] powerpc/svm: Use shared memory for LPPACA structures
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

LPPACA structures need to be shared with the host. Hence they need to be on
shared memory. Instead of allocating individual chunks of memory for given
structure from memblock, a contiguous chunk of memory is allocated and then
converted into shared memory. Subsequent allocation requests will come from
the contiguous chunk which will be always shared memory for all structures.

While we were able to use a kmem_cache constructor for the Debug Trace Log,
LPPACAs are allocated very early in the boot process (before SLUB is
available) so we need to use a simpler scheme here.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/kernel/paca.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 1edf8695019d..3e2aca150ad2 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -17,6 +17,7 @@
 #include <asm/sections.h>
 #include <asm/pgtable.h>
 #include <asm/kexec.h>
+#include <asm/svm.h>
 
 #include "setup.h"
 
@@ -25,6 +26,33 @@
 #endif
 
 #define LPPACA_SIZE 0x400
+#define SHARED_LPPACA_SIZE PAGE_ALIGN(LPPACA_SIZE * CONFIG_NR_CPUS)
+
+static phys_addr_t shared_lppaca_pa;
+static unsigned long shared_lppaca_size;
+
+static void *__init alloc_shared_lppaca(unsigned long size, unsigned long align,
+				unsigned long limit, int cpu)
+{
+	unsigned long pa;
+
+	if (!shared_lppaca_pa) {
+		memblock_set_bottom_up(true);
+		shared_lppaca_pa = memblock_alloc_base_nid(SHARED_LPPACA_SIZE,
+					PAGE_SIZE, limit, -1, MEMBLOCK_NONE);
+		if (!shared_lppaca_pa)
+			panic("cannot allocate shared data");
+		memblock_set_bottom_up(false);
+		mem_convert_shared(PHYS_PFN(shared_lppaca_pa),
+				       SHARED_LPPACA_SIZE / PAGE_SIZE);
+	}
+
+	pa = shared_lppaca_pa + shared_lppaca_size;
+	shared_lppaca_size += size;
+
+	BUG_ON(shared_lppaca_size >= SHARED_LPPACA_SIZE);
+	return __va(pa);
+}
 
 static void *__init alloc_paca_data(unsigned long size, unsigned long align,
 				unsigned long limit, int cpu)
@@ -88,7 +116,11 @@ static struct lppaca * __init new_lppaca(int cpu, unsigned long limit)
 	if (early_cpu_has_feature(CPU_FTR_HVMODE))
 		return NULL;
 
-	lp = alloc_paca_data(LPPACA_SIZE, 0x400, limit, cpu);
+	if (is_svm_platform())
+		lp = alloc_shared_lppaca(LPPACA_SIZE, 0x400, limit, cpu);
+	else
+		lp = alloc_paca_data(LPPACA_SIZE, 0x400, limit, cpu);
+
 	init_lppaca(lp);
 
 	return lp;

^ permalink raw reply related

* [RFC PATCH 10/11] powerpc/svm: Force the use of bounce buffers
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

SWIOTLB checks range of incoming CPU addresses to be bounced and see if the
device can access it through it's DMA window without requiring bouncing. In
such cases it just chooses to skip bouncing. But for cases like secure
guests on powerpc platform all addresses need to be bounced into the shared
pool of memory because the host cannot access it otherwise. Hence the need
to do the bouncing is not related to device's DMA window. Hence force the
use of bouncing by setting the swiotlb_force variable on secure guests.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/kernel/svm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/svm.c b/arch/powerpc/kernel/svm.c
index 1af5caa955f5..f0576ad65cd0 100644
--- a/arch/powerpc/kernel/svm.c
+++ b/arch/powerpc/kernel/svm.c
@@ -17,6 +17,7 @@ static int __init init_svm(void)
 		return 0;
 
 	ppc_swiotlb_enable = 1;
+	swiotlb_force = SWIOTLB_FORCE;
 	swiotlb_update_mem_attributes();
 
 	return 0;

^ permalink raw reply related

* [RFC PATCH 11/11] powerpc/svm: Increase SWIOTLB buffer size
From: Thiago Jung Bauermann @ 2018-08-24 16:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: iommu, linux-kernel, Alexey Kardashevskiy, Anshuman Khandual,
	Benjamin Herrenschmidt, Christoph Hellwig, Michael Ellerman,
	Mike Anderson, Paul Mackerras, Ram Pai, Anshuman Khandual,
	Thiago Jung Bauermann
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

SWIOTLB buffer default size (64MB) is not enough for large sequential write
operations which eventually leads to kernel crash like here.

virtio-pci 0000:00:05.0: swiotlb buffer is full (sz: 327680 bytes)
virtio-pci 0000:00:05.0: DMA: Out of SW-IOMMU space for 327680 bytes
Kernel panic - not syncing: DMA: Random memory could be DMA read
CPU: 12 PID: 3985 Comm: mkfs.ext4 Not tainted 4.18.0-rc4+ #285
Call Trace:
[c0000007d2a27020] [c000000000cfdffc] dump_stack+0xb0/0xf4 (unreliable)
[c0000007d2a27060] [c000000000112a98] panic+0x140/0x328
[c0000007d2a270f0] [c0000000001b4f88] swiotlb_full+0x108/0x130
[c0000007d2a27180] [c0000000001b5f6c] swiotlb_map_page+0x25c/0x2c0
[c0000007d2a271e0] [c0000000007bfaf8] vring_map_one_sg.isra.0+0x58/0x70
[c0000007d2a27200] [c0000000007c08dc] virtqueue_add_sgs+0x1bc/0x690
[c0000007d2a272f0] [d0000000042a1280] virtio_queue_rq+0x358/0x4a0 [virtio_blk]
[c0000007d2a273d0] [c0000000006b5d68] blk_mq_dispatch_rq_list+0x1f8/0x6d0
..................

Increase the SWIOTLB size to 1GB on Ultravisor based secure guests.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/Kconfig | 5 +++++
 kernel/dma/swiotlb.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1466d1234723..fee7194ce9e4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -457,6 +457,11 @@ config PPC_SVM
 
 	 If unsure, say "N".
 
+config SWIOTLB_DEFAULT_SIZE
+       int "Size of Software I/O TLB buffer (in MiB)"
+       default "1024"
+       depends on PPC_SVM
+
 config PPC_TRANSACTIONAL_MEM
        bool "Transactional Memory support for POWERPC"
        depends on PPC_BOOK3S_64
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 04b68d9dffac..32dc67422d8a 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -146,8 +146,13 @@ void swiotlb_set_max_segment(unsigned int val)
 		max_segment = rounddown(val, PAGE_SIZE);
 }
 
+#ifdef CONFIG_SWIOTLB_DEFAULT_SIZE
+#define IO_TLB_DEFAULT_SIZE ((unsigned long) CONFIG_SWIOTLB_DEFAULT_SIZE << 20)
+#else
 /* default to 64MB */
 #define IO_TLB_DEFAULT_SIZE (64UL<<20)
+#endif
+
 unsigned long swiotlb_size_or_default(void)
 {
 	unsigned long size;

^ permalink raw reply related

* Re: [RFC PATCH 00/11] Secure Virtual Machine Enablement
From: Christoph Hellwig @ 2018-08-24 16:33 UTC (permalink / raw)
  To: Thiago Jung Bauermann
  Cc: linuxppc-dev, iommu, linux-kernel, Alexey Kardashevskiy,
	Anshuman Khandual, Benjamin Herrenschmidt, Christoph Hellwig,
	Michael Ellerman, Mike Anderson, Paul Mackerras, Ram Pai
In-Reply-To: <20180824162535.22798-1-bauerman@linux.ibm.com>

On Fri, Aug 24, 2018 at 01:25:24PM -0300, Thiago Jung Bauermann wrote:
> [ Some people didn't receive all the patches in this series, even though
>   the linuxppc-dev list did so trying to send again. This is exactly the
>   same series I posted yesterday. Sorry for the clutter. ]

I'm still only getting six of the patches.

^ permalink raw reply

* Re: DT case sensitivity
From: Segher Boessenkool @ 2018-08-24 16:52 UTC (permalink / raw)
  To: Rob Herring
  Cc: Benjamin Herrenschmidt, Stephen Rothwell, Kumar Gala, devicetree,
	devicetree-spec, linuxppc-dev, Grant Likely, Frank Rowand,
	David Gibson
In-Reply-To: <CAL_Jsq+VnhT_4H4yECWsuXnmpQRnSHNRXAohRYds1LxcRjUHkw@mail.gmail.com>

On Fri, Aug 24, 2018 at 10:14:01AM -0500, Rob Herring wrote:
> Another question: Is there ever a case where the node name in the path
> aka 'driver-name' doesn't match the 'name' property? I think this
> generally can't happen on FDT as the 'name' property is generated when
> we unflatten it though I suppose one could craft an FDT with name
> properties.

In Open Firmware, it *is* the "name" property :-)

> There's also various places in the kernel that check for a NULL name
> which doesn't seem like it could happen either other than the root
> node.

In Open Firmware the root node is required to have a "name" property, too.
There are systems that violate that rule (as with most rules...)


Segher

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox