LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] powerpc: bpf: Fix the broken LD_VLAN_TAG_PRESENT test
From: Denis Kirjanov @ 2014-06-24  9:59 UTC (permalink / raw)
  To: netdev; +Cc: Denis Kirjanov, linuxppc-dev
In-Reply-To: <1403603969-24436-1-git-send-email-kda@linux-powerpc.org>

We have to return the boolean here if the tag presents
or not, not jusr ORing the TCI with the mask which results to:

[  709.412097] test_bpf: #18 LD_VLAN_TAG_PRESENT
[  709.412245] ret 4096 != 1
[  709.412332] ret 4096 != 1
[  709.412333] FAIL (2 times)
---
 arch/powerpc/net/bpf_jit_comp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index af0ed4d..a3d8f58 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -394,8 +394,10 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
 							  vlan_tci));
 			if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
 				PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
-			else
+			else {
 				PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
+				PPC_SRWI(r_A, r_A, 12);
+			}
 			break;
 		case BPF_ANC | SKF_AD_QUEUE:
 			BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
-- 
2.0.0

^ permalink raw reply related

* [PATCH 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag
From: Denis Kirjanov @ 2014-06-24  9:59 UTC (permalink / raw)
  To: netdev; +Cc: Denis Kirjanov, linuxppc-dev

Use the proper mask which is 0xefff
---
 arch/powerpc/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 6dcdade..af0ed4d 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -393,7 +393,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
 			PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
 							  vlan_tci));
 			if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
-				PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
+				PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
 			else
 				PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
 			break;
-- 
2.0.0

^ permalink raw reply related

* Re: [PATCH] vfio: Fix endianness handling for emulated BARs
From: Alexey Kardashevskiy @ 2014-06-24 10:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Alex Williamson
  Cc: Nikunj A Dadhania, linuxppc-dev, linux-kernel, kvm,
	Alexander Graf
In-Reply-To: <1403305961.4587.66.camel@pasglop>

On 06/21/2014 09:12 AM, Benjamin Herrenschmidt wrote:
> On Thu, 2014-06-19 at 21:21 -0600, Alex Williamson wrote:
> 
>> Working on big endian being an accident may be a matter of perspective
> 
>  :-)
> 
>> The comment remains that this patch doesn't actually fix anything except
>> the overhead on big endian systems doing redundant byte swapping and
>> maybe the philosophy that vfio regions are little endian.
> 
> Yes, that works by accident because technically VFIO is a transport and
> thus shouldn't perform any endian swapping of any sort, which remains
> the responsibility of the end driver which is the only one to know
> whether a given BAR location is a a register or some streaming data
> and in the former case whether it's LE or BE (some PCI devices are BE
> even ! :-)
> 
> But yes, in the end, it works with the dual "cancelling" swaps and the
> overhead of those swaps is probably drowned in the noise of the syscall
> overhead.
> 
>> I'm still not a fan of iowrite vs iowritebe, there must be something we
>> can use that doesn't have an implicit swap.
> 
> Sadly there isn't ... In the old day we didn't even have the "be"
> variant and readl/writel style accessors still don't have them either
> for all archs.
> 
> There is __raw_readl/writel but here the semantics are much more than
> just "don't swap", they also don't have memory barriers (which means
> they are essentially useless to most drivers unless those are platform
> specific drivers which know exactly what they are doing, or in the rare
> cases such as accessing a framebuffer which we know never have side
> effects). 
> 
>>  Calling it iowrite*_native is also an abuse of the namespace.
> 
> 
>>  Next thing we know some common code
>> will legitimately use that name. 
> 
> I might make sense to those definitions into a common header. There have
> been a handful of cases in the past that wanted that sort of "native
> byte order" MMIOs iirc (though don't ask me for examples, I can't really
> remember).
> 
>>  If we do need to define an alias
>> (which I'd like to avoid) it should be something like vfio_iowrite32.


Ping?

We need to make a decision whether to move those xxx_native() helpers
somewhere (where?) or leave the patch as is (as we figured out that
iowriteXX functions implement barriers and we cannot just use raw
accessors) and fix commit log to explain everything.

Thanks!




>> Thanks,
> 
> Cheers,
> Ben.
> 
>> Alex
>>
>>>> ===
>>>>
>>>> any better?
>>>>
>>>>
>>>>
>>>>
>>>>>>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>>>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>>>>>> ---
>>>>>>>  drivers/vfio/pci/vfio_pci_rdwr.c | 20 ++++++++++++++++----
>>>>>>>  1 file changed, 16 insertions(+), 4 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c
>>>>>>> index 210db24..f363b5a 100644
>>>>>>> --- a/drivers/vfio/pci/vfio_pci_rdwr.c
>>>>>>> +++ b/drivers/vfio/pci/vfio_pci_rdwr.c
>>>>>>> @@ -21,6 +21,18 @@
>>>>>>>  
>>>>>>>  #include "vfio_pci_private.h"
>>>>>>>  
>>>>>>> +#ifdef __BIG_ENDIAN__
>>>>>>> +#define ioread16_native		ioread16be
>>>>>>> +#define ioread32_native		ioread32be
>>>>>>> +#define iowrite16_native	iowrite16be
>>>>>>> +#define iowrite32_native	iowrite32be
>>>>>>> +#else
>>>>>>> +#define ioread16_native		ioread16
>>>>>>> +#define ioread32_native		ioread32
>>>>>>> +#define iowrite16_native	iowrite16
>>>>>>> +#define iowrite32_native	iowrite32
>>>>>>> +#endif
>>>>>>> +
>>>>>>>  /*
>>>>>>>   * Read or write from an __iomem region (MMIO or I/O port) with an excluded
>>>>>>>   * range which is inaccessible.  The excluded range drops writes and fills
>>>>>>> @@ -50,9 +62,9 @@ static ssize_t do_io_rw(void __iomem *io, char __user *buf,
>>>>>>>  				if (copy_from_user(&val, buf, 4))
>>>>>>>  					return -EFAULT;
>>>>>>>  
>>>>>>> -				iowrite32(le32_to_cpu(val), io + off);
>>>>>>> +				iowrite32_native(val, io + off);
>>>>>>>  			} else {
>>>>>>> -				val = cpu_to_le32(ioread32(io + off));
>>>>>>> +				val = ioread32_native(io + off);
>>>>>>>  
>>>>>>>  				if (copy_to_user(buf, &val, 4))
>>>>>>>  					return -EFAULT;
>>>>>>> @@ -66,9 +78,9 @@ static ssize_t do_io_rw(void __iomem *io, char __user *buf,
>>>>>>>  				if (copy_from_user(&val, buf, 2))
>>>>>>>  					return -EFAULT;
>>>>>>>  
>>>>>>> -				iowrite16(le16_to_cpu(val), io + off);
>>>>>>> +				iowrite16_native(val, io + off);
>>>>>>>  			} else {
>>>>>>> -				val = cpu_to_le16(ioread16(io + off));
>>>>>>> +				val = ioread16_native(io + off);
>>>>>>>  
>>>>>>>  				if (copy_to_user(buf, &val, 2))
>>>>>>>  					return -EFAULT;
>>>>>>
>>>>>>
>>>>>>

-- 
Alexey

^ permalink raw reply

* Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically
From: Alexey Kardashevskiy @ 2014-06-24 10:06 UTC (permalink / raw)
  To: Wei Yang, benh; +Cc: linux-pci, gwshan, qiudayu, bhelgaas, yan, linuxppc-dev
In-Reply-To: <1402365399-5121-7-git-send-email-weiyang@linux.vnet.ibm.com>

On 06/10/2014 11:56 AM, Wei Yang wrote:
> Current iommu_table of a PE is a static field. This will have a problem when
> iommu_free_table is called.

What kind of problem? This table is per PE and PE is not going anywhere.


> 
> This patch allocate iommu_table dynamically.
> 
> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/iommu.h          |    3 +++
>  arch/powerpc/platforms/powernv/pci-ioda.c |   24 +++++++++++++-----------
>  arch/powerpc/platforms/powernv/pci.h      |    2 +-
>  3 files changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
> index 42632c7..0fedacb 100644
> --- a/arch/powerpc/include/asm/iommu.h
> +++ b/arch/powerpc/include/asm/iommu.h
> @@ -78,6 +78,9 @@ struct iommu_table {
>  	struct iommu_group *it_group;
>  #endif
>  	void (*set_bypass)(struct iommu_table *tbl, bool enable);
> +#ifdef CONFIG_PPC_POWERNV
> +	void           *data;
> +#endif
>  };
>  
>  /* Pure 2^n version of get_order */
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 9715351..8ca3926 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -608,6 +608,10 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
>  		return;
>  	}
>  
> +	pe->tce32_table = kzalloc_node(sizeof(struct iommu_table),
> +			GFP_KERNEL, hose->node);
> +	pe->tce32_table->data = pe;
> +
>  	/* Associate it with all child devices */
>  	pnv_ioda_setup_same_PE(bus, pe);
>  
> @@ -675,7 +679,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
>  
>  	pe = &phb->ioda.pe_array[pdn->pe_number];
>  	WARN_ON(get_dma_ops(&pdev->dev) != &dma_iommu_ops);
> -	set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table);
> +	set_iommu_table_base_and_group(&pdev->dev, pe->tce32_table);
>  }
>  
>  static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb,
> @@ -702,7 +706,7 @@ static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb,
>  	} else {
>  		dev_info(&pdev->dev, "Using 32-bit DMA via iommu\n");
>  		set_dma_ops(&pdev->dev, &dma_iommu_ops);
> -		set_iommu_table_base(&pdev->dev, &pe->tce32_table);
> +		set_iommu_table_base(&pdev->dev, pe->tce32_table);
>  	}
>  	return 0;
>  }
> @@ -712,7 +716,7 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
>  	struct pci_dev *dev;
>  
>  	list_for_each_entry(dev, &bus->devices, bus_list) {
> -		set_iommu_table_base_and_group(&dev->dev, &pe->tce32_table);
> +		set_iommu_table_base_and_group(&dev->dev, pe->tce32_table);
>  		if (dev->subordinate)
>  			pnv_ioda_setup_bus_dma(pe, dev->subordinate);
>  	}
> @@ -798,8 +802,7 @@ static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe,
>  void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl,
>  				 __be64 *startp, __be64 *endp, bool rm)
>  {
> -	struct pnv_ioda_pe *pe = container_of(tbl, struct pnv_ioda_pe,
> -					      tce32_table);
> +	struct pnv_ioda_pe *pe = tbl->data;
>  	struct pnv_phb *phb = pe->phb;
>  
>  	if (phb->type == PNV_PHB_IODA1)
> @@ -862,7 +865,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
>  	}
>  
>  	/* Setup linux iommu table */
> -	tbl = &pe->tce32_table;
> +	tbl = pe->tce32_table;
>  	pnv_pci_setup_iommu_table(tbl, addr, PNV_TCE32_TAB_SIZE * segs,
>  				  base << PNV_TCE32_SEG_SHIFT);
>  
> @@ -900,8 +903,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
>  
>  static void pnv_pci_ioda2_set_bypass(struct iommu_table *tbl, bool enable)
>  {
> -	struct pnv_ioda_pe *pe = container_of(tbl, struct pnv_ioda_pe,
> -					      tce32_table);
> +	struct pnv_ioda_pe *pe = tbl->data;
>  	uint16_t window_id = (pe->pe_number << 1 ) + 1;
>  	int64_t rc;
>  
> @@ -942,10 +944,10 @@ static void pnv_pci_ioda2_setup_bypass_pe(struct pnv_phb *phb,
>  	pe->tce_bypass_base = 1ull << 59;
>  
>  	/* Install set_bypass callback for VFIO */
> -	pe->tce32_table.set_bypass = pnv_pci_ioda2_set_bypass;
> +	pe->tce32_table->set_bypass = pnv_pci_ioda2_set_bypass;
>  
>  	/* Enable bypass by default */
> -	pnv_pci_ioda2_set_bypass(&pe->tce32_table, true);
> +	pnv_pci_ioda2_set_bypass(pe->tce32_table, true);
>  }
>  
>  static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
> @@ -993,7 +995,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
>  	}
>  
>  	/* Setup linux iommu table */
> -	tbl = &pe->tce32_table;
> +	tbl = pe->tce32_table;
>  	pnv_pci_setup_iommu_table(tbl, addr, tce_table_size, 0);
>  
>  	/* OPAL variant of PHB3 invalidated TCEs */
> diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> index 90f6da4..9fbf7c0 100644
> --- a/arch/powerpc/platforms/powernv/pci.h
> +++ b/arch/powerpc/platforms/powernv/pci.h
> @@ -60,7 +60,7 @@ struct pnv_ioda_pe {
>  	/* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
>  	int			tce32_seg;
>  	int			tce32_segcount;
> -	struct iommu_table	tce32_table;
> +	struct iommu_table	*tce32_table;
>  	phys_addr_t		tce_inval_reg_phys;
>  
>  	/* 64-bit TCE bypass region */
> 


-- 
Alexey

^ permalink raw reply

* [PATCH V2] powerpc: module: fix TOC symbol CRC
From: Laurent Dufour @ 2014-06-24  8:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: rusty, linuxppc-dev, Anton Blanchard
In-Reply-To: <1403582770.4587.150.camel@pasglop>

The commit 71ec7c55ed91 introduced the magic symbol ".TOC." for ELFv2 ABI.
This symbol is built manually and has no CRC value computed. A zero value
is put in the CRC section to avoid modpost complaining about a missing CRC.
Unfortunately, this breaks the kernel module loading when the kernel is
relocated (kdump case for instance) because of the relocation applied to
the kcrctab values.

This patch compute a CRC value for the TOC symbol which will match the one
compute by the kernel when it is relocated - aka '0 - relocate_start' done in
maybe_relocated called by check_version (module.c).

Changes in V2:
 - fix only when relocation is applied to kcrctab.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Cc: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/module_64.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 077d2ce..d807ee6 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -315,8 +315,17 @@ static void dedotify_versions(struct modversion_info *vers,
 	struct modversion_info *end;
 
 	for (end = (void *)vers + size; vers < end; vers++)
-		if (vers->name[0] == '.')
+		if (vers->name[0] == '.') {
 			memmove(vers->name, vers->name+1, strlen(vers->name));
+#ifdef ARCH_RELOCATES_KCRCTAB
+			/* The TOC symbol has no CRC computed. To avoid CRC
+			 * check failing, we must force it to the expected
+			 * value (see CRC check in module.c).
+			 */
+			if (!strcmp(vers->name, "TOC."))
+				vers->crc = -(unsigned long)reloc_start;
+#endif
+		}
 }
 
 /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */

^ permalink raw reply related

* Re: [PATCH] powerpc: module: fix TOC symbol CRC
From: Laurent Dufour @ 2014-06-24  8:42 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Anton Blanchard; +Cc: rusty, linuxppc-dev
In-Reply-To: <1403582770.4587.150.camel@pasglop>

On 24/06/2014 06:06, Benjamin Herrenschmidt wrote:
> On Thu, 2014-06-19 at 09:44 +1000, Anton Blanchard wrote:
>> Hi Laurent,
>>
>>> The commit 71ec7c55ed91 introduced the magic symbol ".TOC." for ELFv2
>>> ABI. This symbol is built manually and has no CRC value computed. A
>>> zero value is put in the CRC section to avoid modpost complaining
>>> about a missing CRC. Unfortunately, this breaks the kernel module
>>> loading when the kernel is relocated (kdump case for instance)
>>> because of the relocation applied to the kcrctab values.
>>>
>>> This patch compute a CRC value for the TOC symbol which will match
>>> the one compute by the kernel when it is relocated - aka '0 -
>>> relocate_start' done in maybe_relocated called by check_version
>>> (module.c).
>>
>> Adding Rusty since he maintains the module loader code.
> 
> This patch gives me:
> 
> arch/powerpc/kernel/module_64.c: In function 'dedotify_versions':
> arch/powerpc/kernel/module_64.c:325:33: error: 'reloc_start' undeclared (first use in this function)
> arch/powerpc/kernel/module_64.c:325:33: note: each undeclared identifier is reported only once for each function it appears in

Hi Ben,

My mistake, I forgot to check building the kernel when module version
checking is disabled. I'll send a v2 asap.

Cheers,
Laurent.


> Cheers,
> Ben.
> 
> 

^ permalink raw reply

* [PATCH] powerpc/ucc_geth: deal with an compile warning
From: Zhao Qiang @ 2014-06-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, B07421; +Cc: Zhao Qiang

deal with a compile warning: comparison between
'enum qe_fltr_largest_external_tbl_lookup_key_size'
and 'enum qe_fltr_tbl_lookup_key_size'

the code:
	"if (ug_info->largestexternallookupkeysize ==
	     QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES)"
is warned because different enum, so modify it.

	"enum qe_fltr_largest_external_tbl_lookup_key_size
	             largestexternallookupkeysize;

	enum qe_fltr_tbl_lookup_key_size {
		 QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES
			 = 0x3f,         /* LookupKey parsed by the Generate LookupKey
					    CMD is truncated to 8 bytes */
		 QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES
			 = 0x5f,         /* LookupKey parsed by the Generate LookupKey
					    CMD is truncated to 16 bytes */
	 };

	 /* QE FLTR extended filtering Largest External Table Lookup Key Size */
	 enum qe_fltr_largest_external_tbl_lookup_key_size {
		 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE
			 = 0x0,/* not used */
		 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES
			 = QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES,        /* 8 bytes */
		 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES
			 = QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES,       /* 16 bytes */
	 };"

Signed-off-by: Zhao Qiang <B45475@freescale.com>
---
 drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index ee2f1ff..0b0de89 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -2993,11 +2993,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
 	if (ug_info->rxExtendedFiltering) {
 		size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING;
 		if (ug_info->largestexternallookupkeysize ==
-		    QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES)
+		    QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES)
 			size +=
 			    THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8;
 		if (ug_info->largestexternallookupkeysize ==
-		    QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES)
+		    QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)
 			size +=
 			    THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16;
 	}
-- 
1.8.5

^ permalink raw reply related

* [PATCH] powerpc: Use standard macros for sys_sigpending() & sys_old_getrlimit()
From: Michael Ellerman @ 2014-06-24  8:15 UTC (permalink / raw)
  To: linuxppc-dev

Currently we have sys_sigpending and sys_old_getrlimit defined to use
COMPAT_SYS() in systbl.h, but then both are #defined to sys_ni_syscall
in systbl.S.

This seems to have been done when ppc and ppc64 were merged, in commit
9994a33 "Introduce entry_{32,64}.S, misc_{32,64}.S, systbl.S".

AFAICS there's no longer (or never was) any need for this, we can just
use SYSX() for both and remove the #defines to sys_ni_syscall.

The expansion before was:

  #define COMPAT_SYS(func)	.llong	.sys_##func,.compat_sys_##func
  #define sys_old_getrlimit sys_ni_syscall
  COMPAT_SYS(old_getrlimit)
  =>
  .llong	.sys_old_getrlimit,.compat_sys_old_getrlimit
  =>
  .llong	.sys_ni_syscall,.compat_sys_old_getrlimit

After is:

  #define SYSX(f, f3264, f32)	.llong	.f,.f3264
  SYSX(sys_ni_syscall, compat_sys_old_getrlimit, sys_old_getrlimit)
  =>
  .llong	.sys_ni_syscall,.compat_sys_old_getrlimit

ie. they are equivalent.

Finally both COMPAT_SYS() and SYSX() evaluate to sys_ni_syscall in the
Cell SPU code.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/systbl.h | 4 ++--
 arch/powerpc/kernel/systbl.S      | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index babbeca..542bc0f 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -77,10 +77,10 @@ SYSCALL_SPU(setreuid)
 SYSCALL_SPU(setregid)
 #define compat_sys_sigsuspend sys_sigsuspend
 SYS32ONLY(sigsuspend)
-COMPAT_SYS(sigpending)
+SYSX(sys_ni_syscall,compat_sys_sigpending,sys_sigpending)
 SYSCALL_SPU(sethostname)
 COMPAT_SYS_SPU(setrlimit)
-COMPAT_SYS(old_getrlimit)
+SYSX(sys_ni_syscall,compat_sys_old_getrlimit,sys_old_getrlimit)
 COMPAT_SYS_SPU(getrusage)
 COMPAT_SYS_SPU(gettimeofday)
 COMPAT_SYS_SPU(settimeofday)
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 895c50c..7ab5d43 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -39,9 +39,6 @@
 .section .rodata,"a"
 
 #ifdef CONFIG_PPC64
-#define sys_sigpending	sys_ni_syscall
-#define sys_old_getrlimit sys_ni_syscall
-
 	.p2align	3
 #endif
 
-- 
1.9.1

^ permalink raw reply related

* [PATCH] spi: include "int ret" with macro
From: Zhao Qiang @ 2014-06-24  7:55 UTC (permalink / raw)
  To: linuxppc-dev, B07421; +Cc: Zhao Qiang

ret is unused when CONFIG_FSL_SOC defined,
so include it with "#ifndef CONFIG_FSL_SOC".

Signed-off-by: Zhao Qiang <B45475@freescale.com>
---
 drivers/spi/spi-fsl-lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
index e5d45fc..44aace1 100644
--- a/drivers/spi/spi-fsl-lib.c
+++ b/drivers/spi/spi-fsl-lib.c
@@ -198,8 +198,9 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
 	struct mpc8xxx_spi_probe_info *pinfo;
 	struct fsl_spi_platform_data *pdata;
 	const void *prop;
+#ifndef CONFIG_FSL_SOC
 	int ret = -ENOMEM;
-
+#endif
 	pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL);
 	if (!pinfo)
 		return -ENOMEM;
-- 
1.8.5

^ permalink raw reply related

* Re: [PATCH] powerpc/powernv: Remove OPAL v1 takeover
From: Mike Qiu @ 2014-06-24  7:50 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1403594267-25979-1-git-send-email-mpe@ellerman.id.au>

Reported-and-tested-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>

Thanks
Mike
On 06/24/2014 03:17 PM, Michael Ellerman wrote:
> In commit 27f4488872d9 "Add OPAL takeover from PowerVM" we added support
> for "takeover" on OPAL v1 machines.
>
> This was a mode of operation where we would boot under pHyp, and query
> for the presence of OPAL. If detected we would then do a special
> sequence to take over the machine, and the kernel would end up running
> in hypervisor mode.
>
> OPAL v1 was never a supported product, and was never shipped outside
> IBM. As far as we know no one is still using it.
>
> Newer versions of OPAL do not use the takeover mechanism. Although the
> query for OPAL should be harmless on machines with newer OPAL, we have
> seen a machine where it causes a crash in Open Firmware.
>
> The code in early_init_devtree() to copy boot_command_line into cmd_line
> was added in commit 817c21ad9a1f "Get kernel command line accross OPAL
> takeover", and AFAIK is only used by takeover, so should also be
> removed.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>   arch/powerpc/Kconfig.debug                     |   1 -
>   arch/powerpc/include/asm/opal.h                |  29 ----
>   arch/powerpc/kernel/prom.c                     |   7 -
>   arch/powerpc/kernel/prom_init.c                | 211 -------------------------
>   arch/powerpc/kernel/prom_init_check.sh         |   4 +-
>   arch/powerpc/platforms/powernv/Makefile        |   2 +-
>   arch/powerpc/platforms/powernv/opal-takeover.S | 140 ----------------
>   7 files changed, 2 insertions(+), 392 deletions(-)
>   delete mode 100644 arch/powerpc/platforms/powernv/opal-takeover.S
>
> diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
> index 790352f..35d16bd 100644
> --- a/arch/powerpc/Kconfig.debug
> +++ b/arch/powerpc/Kconfig.debug
> @@ -303,7 +303,6 @@ config PPC_EARLY_DEBUG_OPAL_VTERMNO
>   	  This correspond to which /dev/hvcN you want to use for early
>   	  debug.
>   
> -	  On OPAL v1 (takeover) this should always be 0
>   	  On OPAL v2, this will be 0 for network console and 1 or 2 for
>   	  the machine built-in serial ports.
>   
> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
> index 4600188..0da1dbd 100644
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -12,27 +12,7 @@
>   #ifndef __OPAL_H
>   #define __OPAL_H
>   
> -/****** Takeover interface ********/
> -
> -/* PAPR H-Call used to querty the HAL existence and/or instanciate
> - * it from within pHyp (tech preview only).
> - *
> - * This is exclusively used in prom_init.c
> - */
> -
>   #ifndef __ASSEMBLY__
> -
> -struct opal_takeover_args {
> -	u64	k_image;		/* r4 */
> -	u64	k_size;			/* r5 */
> -	u64	k_entry;		/* r6 */
> -	u64	k_entry2;		/* r7 */
> -	u64	hal_addr;		/* r8 */
> -	u64	rd_image;		/* r9 */
> -	u64	rd_size;		/* r10 */
> -	u64	rd_loc;			/* r11 */
> -};
> -
>   /*
>    * SG entry
>    *
> @@ -55,15 +35,6 @@ struct opal_sg_list {
>   /* We calculate number of sg entries based on PAGE_SIZE */
>   #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
>   
> -extern long opal_query_takeover(u64 *hal_size, u64 *hal_align);
> -
> -extern long opal_do_takeover(struct opal_takeover_args *args);
> -
> -struct rtas_args;
> -extern int opal_enter_rtas(struct rtas_args *args,
> -			   unsigned long data,
> -			   unsigned long entry);
> -
>   #endif /* __ASSEMBLY__ */
>   
>   /****** OPAL APIs ******/
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 613a860..b694b07 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -662,13 +662,6 @@ void __init early_init_devtree(void *params)
>   	of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL);
>   #endif
>   
> -	/* Pre-initialize the cmd_line with the content of boot_commmand_line,
> -	 * which will be empty except when the content of the variable has
> -	 * been overriden by a bootloading mechanism. This happens typically
> -	 * with HAL takeover
> -	 */
> -	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
> -
>   	/* Retrieve various informations from the /chosen node of the
>   	 * device-tree, including the platform type, initrd location and
>   	 * size, TCE reserve, and more ...
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 078145a..1a85d8f 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -1268,201 +1268,6 @@ static u64 __initdata prom_opal_base;
>   static u64 __initdata prom_opal_entry;
>   #endif
>   
> -#ifdef __BIG_ENDIAN__
> -/* XXX Don't change this structure without updating opal-takeover.S */
> -static struct opal_secondary_data {
> -	s64				ack;	/*  0 */
> -	u64				go;	/*  8 */
> -	struct opal_takeover_args	args;	/* 16 */
> -} opal_secondary_data;
> -
> -static u64 __initdata prom_opal_align;
> -static u64 __initdata prom_opal_size;
> -static int __initdata prom_rtas_start_cpu;
> -static u64 __initdata prom_rtas_data;
> -static u64 __initdata prom_rtas_entry;
> -
> -extern char opal_secondary_entry;
> -
> -static void __init prom_query_opal(void)
> -{
> -	long rc;
> -
> -	/* We must not query for OPAL presence on a machine that
> -	 * supports TNK takeover (970 blades), as this uses the same
> -	 * h-call with different arguments and will crash
> -	 */
> -	if (PHANDLE_VALID(call_prom("finddevice", 1, 1,
> -				    ADDR("/tnk-memory-map")))) {
> -		prom_printf("TNK takeover detected, skipping OPAL check\n");
> -		return;
> -	}
> -
> -	prom_printf("Querying for OPAL presence... ");
> -
> -	rc = opal_query_takeover(&prom_opal_size,
> -				 &prom_opal_align);
> -	prom_debug("(rc = %ld) ", rc);
> -	if (rc != 0) {
> -		prom_printf("not there.\n");
> -		return;
> -	}
> -	of_platform = PLATFORM_OPAL;
> -	prom_printf(" there !\n");
> -	prom_debug("  opal_size  = 0x%lx\n", prom_opal_size);
> -	prom_debug("  opal_align = 0x%lx\n", prom_opal_align);
> -	if (prom_opal_align < 0x10000)
> -		prom_opal_align = 0x10000;
> -}
> -
> -static int __init prom_rtas_call(int token, int nargs, int nret,
> -				 int *outputs, ...)
> -{
> -	struct rtas_args rtas_args;
> -	va_list list;
> -	int i;
> -
> -	rtas_args.token = token;
> -	rtas_args.nargs = nargs;
> -	rtas_args.nret  = nret;
> -	rtas_args.rets  = (rtas_arg_t *)&(rtas_args.args[nargs]);
> -	va_start(list, outputs);
> -	for (i = 0; i < nargs; ++i)
> -		rtas_args.args[i] = va_arg(list, rtas_arg_t);
> -	va_end(list);
> -
> -	for (i = 0; i < nret; ++i)
> -		rtas_args.rets[i] = 0;
> -
> -	opal_enter_rtas(&rtas_args, prom_rtas_data,
> -			prom_rtas_entry);
> -
> -	if (nret > 1 && outputs != NULL)
> -		for (i = 0; i < nret-1; ++i)
> -			outputs[i] = rtas_args.rets[i+1];
> -	return (nret > 0)? rtas_args.rets[0]: 0;
> -}
> -
> -static void __init prom_opal_hold_cpus(void)
> -{
> -	int i, cnt, cpu, rc;
> -	long j;
> -	phandle node;
> -	char type[64];
> -	u32 servers[8];
> -	void *entry = (unsigned long *)&opal_secondary_entry;
> -	struct opal_secondary_data *data = &opal_secondary_data;
> -
> -	prom_debug("prom_opal_hold_cpus: start...\n");
> -	prom_debug("    - entry       = 0x%x\n", entry);
> -	prom_debug("    - data        = 0x%x\n", data);
> -
> -	data->ack = -1;
> -	data->go = 0;
> -
> -	/* look for cpus */
> -	for (node = 0; prom_next_node(&node); ) {
> -		type[0] = 0;
> -		prom_getprop(node, "device_type", type, sizeof(type));
> -		if (strcmp(type, "cpu") != 0)
> -			continue;
> -
> -		/* Skip non-configured cpus. */
> -		if (prom_getprop(node, "status", type, sizeof(type)) > 0)
> -			if (strcmp(type, "okay") != 0)
> -				continue;
> -
> -		cnt = prom_getprop(node, "ibm,ppc-interrupt-server#s", servers,
> -			     sizeof(servers));
> -		if (cnt == PROM_ERROR)
> -			break;
> -		cnt >>= 2;
> -		for (i = 0; i < cnt; i++) {
> -			cpu = servers[i];
> -			prom_debug("CPU %d ... ", cpu);
> -			if (cpu == prom.cpu) {
> -				prom_debug("booted !\n");
> -				continue;
> -			}
> -			prom_debug("starting ... ");
> -
> -			/* Init the acknowledge var which will be reset by
> -			 * the secondary cpu when it awakens from its OF
> -			 * spinloop.
> -			 */
> -			data->ack = -1;
> -			rc = prom_rtas_call(prom_rtas_start_cpu, 3, 1,
> -					    NULL, cpu, entry, data);
> -			prom_debug("rtas rc=%d ...", rc);
> -
> -			for (j = 0; j < 100000000 && data->ack == -1; j++) {
> -				HMT_low();
> -				mb();
> -			}
> -			HMT_medium();
> -			if (data->ack != -1)
> -				prom_debug("done, PIR=0x%x\n", data->ack);
> -			else
> -				prom_debug("timeout !\n");
> -		}
> -	}
> -	prom_debug("prom_opal_hold_cpus: end...\n");
> -}
> -
> -static void __init prom_opal_takeover(void)
> -{
> -	struct opal_secondary_data *data = &opal_secondary_data;
> -	struct opal_takeover_args *args = &data->args;
> -	u64 align = prom_opal_align;
> -	u64 top_addr, opal_addr;
> -
> -	args->k_image	= (u64)_stext;
> -	args->k_size	= _end - _stext;
> -	args->k_entry	= 0;
> -	args->k_entry2	= 0x60;
> -
> -	top_addr = _ALIGN_UP(args->k_size, align);
> -
> -	if (prom_initrd_start != 0) {
> -		args->rd_image = prom_initrd_start;
> -		args->rd_size = prom_initrd_end - args->rd_image;
> -		args->rd_loc = top_addr;
> -		top_addr = _ALIGN_UP(args->rd_loc + args->rd_size, align);
> -	}
> -
> -	/* Pickup an address for the HAL. We want to go really high
> -	 * up to avoid problem with future kexecs. On the other hand
> -	 * we don't want to be all over the TCEs on P5IOC2 machines
> -	 * which are going to be up there too. We assume the machine
> -	 * has plenty of memory, and we ask for the HAL for now to
> -	 * be just below the 1G point, or above the initrd
> -	 */
> -	opal_addr = _ALIGN_DOWN(0x40000000 - prom_opal_size, align);
> -	if (opal_addr < top_addr)
> -		opal_addr = top_addr;
> -	args->hal_addr = opal_addr;
> -
> -	/* Copy the command line to the kernel image */
> -	strlcpy(boot_command_line, prom_cmd_line,
> -		COMMAND_LINE_SIZE);
> -
> -	prom_debug("  k_image    = 0x%lx\n", args->k_image);
> -	prom_debug("  k_size     = 0x%lx\n", args->k_size);
> -	prom_debug("  k_entry    = 0x%lx\n", args->k_entry);
> -	prom_debug("  k_entry2   = 0x%lx\n", args->k_entry2);
> -	prom_debug("  hal_addr   = 0x%lx\n", args->hal_addr);
> -	prom_debug("  rd_image   = 0x%lx\n", args->rd_image);
> -	prom_debug("  rd_size    = 0x%lx\n", args->rd_size);
> -	prom_debug("  rd_loc     = 0x%lx\n", args->rd_loc);
> -	prom_printf("Performing OPAL takeover,this can take a few minutes..\n");
> -	prom_close_stdin();
> -	mb();
> -	data->go = 1;
> -	for (;;)
> -		opal_do_takeover(args);
> -}
> -#endif /* __BIG_ENDIAN__ */
> -
>   /*
>    * Allocate room for and instantiate OPAL
>    */
> @@ -1597,12 +1402,6 @@ static void __init prom_instantiate_rtas(void)
>   			 &val, sizeof(val)) != PROM_ERROR)
>   		rtas_has_query_cpu_stopped = true;
>   
> -#if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__)
> -	/* PowerVN takeover hack */
> -	prom_rtas_data = base;
> -	prom_rtas_entry = entry;
> -	prom_getprop(rtas_node, "start-cpu", &prom_rtas_start_cpu, 4);
> -#endif
>   	prom_debug("rtas base     = 0x%x\n", base);
>   	prom_debug("rtas entry    = 0x%x\n", entry);
>   	prom_debug("rtas size     = 0x%x\n", (long)size);
> @@ -3027,16 +2826,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
>   		prom_instantiate_rtas();
>   
>   #ifdef CONFIG_PPC_POWERNV
> -#ifdef __BIG_ENDIAN__
> -	/* Detect HAL and try instanciating it & doing takeover */
> -	if (of_platform == PLATFORM_PSERIES_LPAR) {
> -		prom_query_opal();
> -		if (of_platform == PLATFORM_OPAL) {
> -			prom_opal_hold_cpus();
> -			prom_opal_takeover();
> -		}
> -	} else
> -#endif /* __BIG_ENDIAN__ */
>   	if (of_platform == PLATFORM_OPAL)
>   		prom_instantiate_opal();
>   #endif /* CONFIG_PPC_POWERNV */
> diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
> index 77aa1e9..fe8e54b 100644
> --- a/arch/powerpc/kernel/prom_init_check.sh
> +++ b/arch/powerpc/kernel/prom_init_check.sh
> @@ -21,9 +21,7 @@ _end enter_prom memcpy memset reloc_offset __secondary_hold
>   __secondary_hold_acknowledge __secondary_hold_spinloop __start
>   strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
>   reloc_got2 kernstart_addr memstart_addr linux_banner _stext
> -opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry
> -boot_command_line __prom_init_toc_start __prom_init_toc_end
> -btext_setup_display TOC."
> +__prom_init_toc_start __prom_init_toc_end btext_setup_display TOC."
>   
>   NM="$1"
>   OBJ="$2"
> diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
> index d55891f..4ad227d 100644
> --- a/arch/powerpc/platforms/powernv/Makefile
> +++ b/arch/powerpc/platforms/powernv/Makefile
> @@ -1,4 +1,4 @@
> -obj-y			+= setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o
> +obj-y			+= setup.o opal-wrappers.o opal.o opal-async.o
>   obj-y			+= opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
>   obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
>   obj-y			+= opal-msglog.o
> diff --git a/arch/powerpc/platforms/powernv/opal-takeover.S b/arch/powerpc/platforms/powernv/opal-takeover.S
> deleted file mode 100644
> index 11a3169..0000000
> --- a/arch/powerpc/platforms/powernv/opal-takeover.S
> +++ /dev/null
> @@ -1,140 +0,0 @@
> -/*
> - * PowerNV OPAL takeover assembly code, for use by prom_init.c
> - *
> - * Copyright 2011 IBM Corp.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version
> - * 2 of the License, or (at your option) any later version.
> - */
> -
> -#include <asm/ppc_asm.h>
> -#include <asm/hvcall.h>
> -#include <asm/asm-offsets.h>
> -#include <asm/opal.h>
> -
> -#define H_HAL_TAKEOVER			0x5124
> -#define H_HAL_TAKEOVER_QUERY_MAGIC	-1
> -
> -	.text
> -_GLOBAL(opal_query_takeover)
> -	mfcr	r0
> -	stw	r0,8(r1)
> -	stdu	r1,-STACKFRAMESIZE(r1)
> -	std	r3,STK_PARAM(R3)(r1)
> -	std	r4,STK_PARAM(R4)(r1)
> -	li	r3,H_HAL_TAKEOVER
> -	li	r4,H_HAL_TAKEOVER_QUERY_MAGIC
> -	HVSC
> -	addi	r1,r1,STACKFRAMESIZE
> -	ld	r10,STK_PARAM(R3)(r1)
> -	std	r4,0(r10)
> -	ld	r10,STK_PARAM(R4)(r1)
> -	std	r5,0(r10)
> -	lwz	r0,8(r1)
> -	mtcrf	0xff,r0
> -	blr
> -
> -_GLOBAL(opal_do_takeover)
> -	mfcr	r0
> -	stw	r0,8(r1)
> -	mflr	r0
> -	std	r0,16(r1)
> -	bl	__opal_do_takeover
> -	ld	r0,16(r1)
> -	mtlr	r0
> -	lwz	r0,8(r1)
> -	mtcrf	0xff,r0
> -	blr
> -
> -__opal_do_takeover:
> -	ld	r4,0(r3)
> -	ld	r5,0x8(r3)
> -	ld	r6,0x10(r3)
> -	ld	r7,0x18(r3)
> -	ld	r8,0x20(r3)
> -	ld	r9,0x28(r3)
> -	ld	r10,0x30(r3)
> -	ld	r11,0x38(r3)
> -	li	r3,H_HAL_TAKEOVER
> -	HVSC
> -	blr
> -
> -	.globl opal_secondary_entry
> -opal_secondary_entry:
> -	mr	r31,r3
> -	mfmsr	r11
> -	li	r12,(MSR_SF | MSR_ISF)@highest
> -	sldi	r12,r12,48
> -	or	r11,r11,r12
> -	mtmsrd	r11
> -	isync
> -	mfspr	r4,SPRN_PIR
> -	std	r4,0(r3)
> -1:	HMT_LOW
> -	ld	r4,8(r3)
> -	cmpli	cr0,r4,0
> -	beq	1b
> -	HMT_MEDIUM
> -1:	addi	r3,r31,16
> -	bl	__opal_do_takeover
> -	b	1b
> -
> -_GLOBAL(opal_enter_rtas)
> -	mflr	r0
> -	std	r0,16(r1)
> -        stdu	r1,-PROM_FRAME_SIZE(r1)	/* Save SP and create stack space */
> -
> -	/* Because PROM is running in 32b mode, it clobbers the high order half
> -	 * of all registers that it saves.  We therefore save those registers
> -	 * PROM might touch to the stack.  (r0, r3-r13 are caller saved)
> -	*/
> -	SAVE_GPR(2, r1)
> -	SAVE_GPR(13, r1)
> -	SAVE_8GPRS(14, r1)
> -	SAVE_10GPRS(22, r1)
> -	mfcr	r10
> -	mfmsr	r11
> -	std	r10,_CCR(r1)
> -	std	r11,_MSR(r1)
> -
> -	/* Get the PROM entrypoint */
> -	mtlr	r5
> -
> -	/* Switch MSR to 32 bits mode
> -	 */
> -        li      r12,1
> -        rldicr  r12,r12,MSR_SF_LG,(63-MSR_SF_LG)
> -        andc    r11,r11,r12
> -        li      r12,1
> -        rldicr  r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
> -        andc    r11,r11,r12
> -        mtmsrd  r11
> -        isync
> -
> -	/* Enter RTAS here... */
> -	blrl
> -
> -	/* Just make sure that r1 top 32 bits didn't get
> -	 * corrupt by OF
> -	 */
> -	rldicl	r1,r1,0,32
> -
> -	/* Restore the MSR (back to 64 bits) */
> -	ld	r0,_MSR(r1)
> -	MTMSRD(r0)
> -        isync
> -
> -	/* Restore other registers */
> -	REST_GPR(2, r1)
> -	REST_GPR(13, r1)
> -	REST_8GPRS(14, r1)
> -	REST_10GPRS(22, r1)
> -	ld	r4,_CCR(r1)
> -	mtcr	r4
> -
> -        addi	r1,r1,PROM_FRAME_SIZE
> -	ld	r0,16(r1)
> -	mtlr    r0
> -	blr

^ permalink raw reply

* Re: [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code
From: Joonsoo Kim @ 2014-06-24  7:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kvm-ppc, Russell King - ARM Linux, kvm, linux-mm, Gleb Natapov,
	Greg Kroah-Hartman, Alexander Graf, Michal Nazarewicz,
	linux-kernel, Minchan Kim, Paul Mackerras, Aneesh Kumar K.V,
	Paolo Bonzini, Zhang Yanfei, linuxppc-dev, linux-arm-kernel,
	Marek Szyprowski
In-Reply-To: <20140618135144.297c785260f9e2aebead867c@linux-foundation.org>

On Wed, Jun 18, 2014 at 01:51:44PM -0700, Andrew Morton wrote:
> On Tue, 17 Jun 2014 10:25:07 +0900 Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
> 
> > > >v2:
> > > >   - Although this patchset looks very different with v1, the end result,
> > > >   that is, mm/cma.c is same with v1's one. So I carry Ack to patch 6-7.
> > > >
> > > >This patchset is based on linux-next 20140610.
> > > 
> > > Thanks for taking care of this. I will test it with my setup and if
> > > everything goes well, I will take it to my -next tree. If any branch
> > > is required for anyone to continue his works on top of those patches,
> > > let me know, I will also prepare it.
> > 
> > Hello,
> > 
> > I'm glad to hear that. :)
> > But, there is one concern. As you already know, I am preparing further
> > patches (Aggressively allocate the pages on CMA reserved memory). It
> > may be highly related to MM branch and also slightly depends on this CMA
> > changes. In this case, what is the best strategy to merge this
> > patchset? IMHO, Anrew's tree is more appropriate branch. If there is
> > no issue in this case, I am willing to develope further patches based
> > on your tree.
> 
> That's probably easier.  Marek, I'll merge these into -mm (and hence
> -next and git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git)
> and shall hold them pending you review/ack/test/etc, OK?

Hello, Marek.

Could you share your decision about this patchset?

Thanks.

^ permalink raw reply

* [PATCH] powerpc/powernv: Remove OPAL v1 takeover
From: Michael Ellerman @ 2014-06-24  7:17 UTC (permalink / raw)
  To: linuxppc-dev

In commit 27f4488872d9 "Add OPAL takeover from PowerVM" we added support
for "takeover" on OPAL v1 machines.

This was a mode of operation where we would boot under pHyp, and query
for the presence of OPAL. If detected we would then do a special
sequence to take over the machine, and the kernel would end up running
in hypervisor mode.

OPAL v1 was never a supported product, and was never shipped outside
IBM. As far as we know no one is still using it.

Newer versions of OPAL do not use the takeover mechanism. Although the
query for OPAL should be harmless on machines with newer OPAL, we have
seen a machine where it causes a crash in Open Firmware.

The code in early_init_devtree() to copy boot_command_line into cmd_line
was added in commit 817c21ad9a1f "Get kernel command line accross OPAL
takeover", and AFAIK is only used by takeover, so should also be
removed.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/Kconfig.debug                     |   1 -
 arch/powerpc/include/asm/opal.h                |  29 ----
 arch/powerpc/kernel/prom.c                     |   7 -
 arch/powerpc/kernel/prom_init.c                | 211 -------------------------
 arch/powerpc/kernel/prom_init_check.sh         |   4 +-
 arch/powerpc/platforms/powernv/Makefile        |   2 +-
 arch/powerpc/platforms/powernv/opal-takeover.S | 140 ----------------
 7 files changed, 2 insertions(+), 392 deletions(-)
 delete mode 100644 arch/powerpc/platforms/powernv/opal-takeover.S

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 790352f..35d16bd 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -303,7 +303,6 @@ config PPC_EARLY_DEBUG_OPAL_VTERMNO
 	  This correspond to which /dev/hvcN you want to use for early
 	  debug.
 
-	  On OPAL v1 (takeover) this should always be 0
 	  On OPAL v2, this will be 0 for network console and 1 or 2 for
 	  the machine built-in serial ports.
 
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 4600188..0da1dbd 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -12,27 +12,7 @@
 #ifndef __OPAL_H
 #define __OPAL_H
 
-/****** Takeover interface ********/
-
-/* PAPR H-Call used to querty the HAL existence and/or instanciate
- * it from within pHyp (tech preview only).
- *
- * This is exclusively used in prom_init.c
- */
-
 #ifndef __ASSEMBLY__
-
-struct opal_takeover_args {
-	u64	k_image;		/* r4 */
-	u64	k_size;			/* r5 */
-	u64	k_entry;		/* r6 */
-	u64	k_entry2;		/* r7 */
-	u64	hal_addr;		/* r8 */
-	u64	rd_image;		/* r9 */
-	u64	rd_size;		/* r10 */
-	u64	rd_loc;			/* r11 */
-};
-
 /*
  * SG entry
  *
@@ -55,15 +35,6 @@ struct opal_sg_list {
 /* We calculate number of sg entries based on PAGE_SIZE */
 #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
 
-extern long opal_query_takeover(u64 *hal_size, u64 *hal_align);
-
-extern long opal_do_takeover(struct opal_takeover_args *args);
-
-struct rtas_args;
-extern int opal_enter_rtas(struct rtas_args *args,
-			   unsigned long data,
-			   unsigned long entry);
-
 #endif /* __ASSEMBLY__ */
 
 /****** OPAL APIs ******/
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 613a860..b694b07 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -662,13 +662,6 @@ void __init early_init_devtree(void *params)
 	of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL);
 #endif
 
-	/* Pre-initialize the cmd_line with the content of boot_commmand_line,
-	 * which will be empty except when the content of the variable has
-	 * been overriden by a bootloading mechanism. This happens typically
-	 * with HAL takeover
-	 */
-	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
-
 	/* Retrieve various informations from the /chosen node of the
 	 * device-tree, including the platform type, initrd location and
 	 * size, TCE reserve, and more ...
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 078145a..1a85d8f 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1268,201 +1268,6 @@ static u64 __initdata prom_opal_base;
 static u64 __initdata prom_opal_entry;
 #endif
 
-#ifdef __BIG_ENDIAN__
-/* XXX Don't change this structure without updating opal-takeover.S */
-static struct opal_secondary_data {
-	s64				ack;	/*  0 */
-	u64				go;	/*  8 */
-	struct opal_takeover_args	args;	/* 16 */
-} opal_secondary_data;
-
-static u64 __initdata prom_opal_align;
-static u64 __initdata prom_opal_size;
-static int __initdata prom_rtas_start_cpu;
-static u64 __initdata prom_rtas_data;
-static u64 __initdata prom_rtas_entry;
-
-extern char opal_secondary_entry;
-
-static void __init prom_query_opal(void)
-{
-	long rc;
-
-	/* We must not query for OPAL presence on a machine that
-	 * supports TNK takeover (970 blades), as this uses the same
-	 * h-call with different arguments and will crash
-	 */
-	if (PHANDLE_VALID(call_prom("finddevice", 1, 1,
-				    ADDR("/tnk-memory-map")))) {
-		prom_printf("TNK takeover detected, skipping OPAL check\n");
-		return;
-	}
-
-	prom_printf("Querying for OPAL presence... ");
-
-	rc = opal_query_takeover(&prom_opal_size,
-				 &prom_opal_align);
-	prom_debug("(rc = %ld) ", rc);
-	if (rc != 0) {
-		prom_printf("not there.\n");
-		return;
-	}
-	of_platform = PLATFORM_OPAL;
-	prom_printf(" there !\n");
-	prom_debug("  opal_size  = 0x%lx\n", prom_opal_size);
-	prom_debug("  opal_align = 0x%lx\n", prom_opal_align);
-	if (prom_opal_align < 0x10000)
-		prom_opal_align = 0x10000;
-}
-
-static int __init prom_rtas_call(int token, int nargs, int nret,
-				 int *outputs, ...)
-{
-	struct rtas_args rtas_args;
-	va_list list;
-	int i;
-
-	rtas_args.token = token;
-	rtas_args.nargs = nargs;
-	rtas_args.nret  = nret;
-	rtas_args.rets  = (rtas_arg_t *)&(rtas_args.args[nargs]);
-	va_start(list, outputs);
-	for (i = 0; i < nargs; ++i)
-		rtas_args.args[i] = va_arg(list, rtas_arg_t);
-	va_end(list);
-
-	for (i = 0; i < nret; ++i)
-		rtas_args.rets[i] = 0;
-
-	opal_enter_rtas(&rtas_args, prom_rtas_data,
-			prom_rtas_entry);
-
-	if (nret > 1 && outputs != NULL)
-		for (i = 0; i < nret-1; ++i)
-			outputs[i] = rtas_args.rets[i+1];
-	return (nret > 0)? rtas_args.rets[0]: 0;
-}
-
-static void __init prom_opal_hold_cpus(void)
-{
-	int i, cnt, cpu, rc;
-	long j;
-	phandle node;
-	char type[64];
-	u32 servers[8];
-	void *entry = (unsigned long *)&opal_secondary_entry;
-	struct opal_secondary_data *data = &opal_secondary_data;
-
-	prom_debug("prom_opal_hold_cpus: start...\n");
-	prom_debug("    - entry       = 0x%x\n", entry);
-	prom_debug("    - data        = 0x%x\n", data);
-
-	data->ack = -1;
-	data->go = 0;
-
-	/* look for cpus */
-	for (node = 0; prom_next_node(&node); ) {
-		type[0] = 0;
-		prom_getprop(node, "device_type", type, sizeof(type));
-		if (strcmp(type, "cpu") != 0)
-			continue;
-
-		/* Skip non-configured cpus. */
-		if (prom_getprop(node, "status", type, sizeof(type)) > 0)
-			if (strcmp(type, "okay") != 0)
-				continue;
-
-		cnt = prom_getprop(node, "ibm,ppc-interrupt-server#s", servers,
-			     sizeof(servers));
-		if (cnt == PROM_ERROR)
-			break;
-		cnt >>= 2;
-		for (i = 0; i < cnt; i++) {
-			cpu = servers[i];
-			prom_debug("CPU %d ... ", cpu);
-			if (cpu == prom.cpu) {
-				prom_debug("booted !\n");
-				continue;
-			}
-			prom_debug("starting ... ");
-
-			/* Init the acknowledge var which will be reset by
-			 * the secondary cpu when it awakens from its OF
-			 * spinloop.
-			 */
-			data->ack = -1;
-			rc = prom_rtas_call(prom_rtas_start_cpu, 3, 1,
-					    NULL, cpu, entry, data);
-			prom_debug("rtas rc=%d ...", rc);
-
-			for (j = 0; j < 100000000 && data->ack == -1; j++) {
-				HMT_low();
-				mb();
-			}
-			HMT_medium();
-			if (data->ack != -1)
-				prom_debug("done, PIR=0x%x\n", data->ack);
-			else
-				prom_debug("timeout !\n");
-		}
-	}
-	prom_debug("prom_opal_hold_cpus: end...\n");
-}
-
-static void __init prom_opal_takeover(void)
-{
-	struct opal_secondary_data *data = &opal_secondary_data;
-	struct opal_takeover_args *args = &data->args;
-	u64 align = prom_opal_align;
-	u64 top_addr, opal_addr;
-
-	args->k_image	= (u64)_stext;
-	args->k_size	= _end - _stext;
-	args->k_entry	= 0;
-	args->k_entry2	= 0x60;
-
-	top_addr = _ALIGN_UP(args->k_size, align);
-
-	if (prom_initrd_start != 0) {
-		args->rd_image = prom_initrd_start;
-		args->rd_size = prom_initrd_end - args->rd_image;
-		args->rd_loc = top_addr;
-		top_addr = _ALIGN_UP(args->rd_loc + args->rd_size, align);
-	}
-
-	/* Pickup an address for the HAL. We want to go really high
-	 * up to avoid problem with future kexecs. On the other hand
-	 * we don't want to be all over the TCEs on P5IOC2 machines
-	 * which are going to be up there too. We assume the machine
-	 * has plenty of memory, and we ask for the HAL for now to
-	 * be just below the 1G point, or above the initrd
-	 */
-	opal_addr = _ALIGN_DOWN(0x40000000 - prom_opal_size, align);
-	if (opal_addr < top_addr)
-		opal_addr = top_addr;
-	args->hal_addr = opal_addr;
-
-	/* Copy the command line to the kernel image */
-	strlcpy(boot_command_line, prom_cmd_line,
-		COMMAND_LINE_SIZE);
-
-	prom_debug("  k_image    = 0x%lx\n", args->k_image);
-	prom_debug("  k_size     = 0x%lx\n", args->k_size);
-	prom_debug("  k_entry    = 0x%lx\n", args->k_entry);
-	prom_debug("  k_entry2   = 0x%lx\n", args->k_entry2);
-	prom_debug("  hal_addr   = 0x%lx\n", args->hal_addr);
-	prom_debug("  rd_image   = 0x%lx\n", args->rd_image);
-	prom_debug("  rd_size    = 0x%lx\n", args->rd_size);
-	prom_debug("  rd_loc     = 0x%lx\n", args->rd_loc);
-	prom_printf("Performing OPAL takeover,this can take a few minutes..\n");
-	prom_close_stdin();
-	mb();
-	data->go = 1;
-	for (;;)
-		opal_do_takeover(args);
-}
-#endif /* __BIG_ENDIAN__ */
-
 /*
  * Allocate room for and instantiate OPAL
  */
@@ -1597,12 +1402,6 @@ static void __init prom_instantiate_rtas(void)
 			 &val, sizeof(val)) != PROM_ERROR)
 		rtas_has_query_cpu_stopped = true;
 
-#if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__)
-	/* PowerVN takeover hack */
-	prom_rtas_data = base;
-	prom_rtas_entry = entry;
-	prom_getprop(rtas_node, "start-cpu", &prom_rtas_start_cpu, 4);
-#endif
 	prom_debug("rtas base     = 0x%x\n", base);
 	prom_debug("rtas entry    = 0x%x\n", entry);
 	prom_debug("rtas size     = 0x%x\n", (long)size);
@@ -3027,16 +2826,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
 		prom_instantiate_rtas();
 
 #ifdef CONFIG_PPC_POWERNV
-#ifdef __BIG_ENDIAN__
-	/* Detect HAL and try instanciating it & doing takeover */
-	if (of_platform == PLATFORM_PSERIES_LPAR) {
-		prom_query_opal();
-		if (of_platform == PLATFORM_OPAL) {
-			prom_opal_hold_cpus();
-			prom_opal_takeover();
-		}
-	} else
-#endif /* __BIG_ENDIAN__ */
 	if (of_platform == PLATFORM_OPAL)
 		prom_instantiate_opal();
 #endif /* CONFIG_PPC_POWERNV */
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index 77aa1e9..fe8e54b 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -21,9 +21,7 @@ _end enter_prom memcpy memset reloc_offset __secondary_hold
 __secondary_hold_acknowledge __secondary_hold_spinloop __start
 strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
 reloc_got2 kernstart_addr memstart_addr linux_banner _stext
-opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry
-boot_command_line __prom_init_toc_start __prom_init_toc_end
-btext_setup_display TOC."
+__prom_init_toc_start __prom_init_toc_end btext_setup_display TOC."
 
 NM="$1"
 OBJ="$2"
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index d55891f..4ad227d 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -1,4 +1,4 @@
-obj-y			+= setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o
+obj-y			+= setup.o opal-wrappers.o opal.o opal-async.o
 obj-y			+= opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
 obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
 obj-y			+= opal-msglog.o
diff --git a/arch/powerpc/platforms/powernv/opal-takeover.S b/arch/powerpc/platforms/powernv/opal-takeover.S
deleted file mode 100644
index 11a3169..0000000
--- a/arch/powerpc/platforms/powernv/opal-takeover.S
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * PowerNV OPAL takeover assembly code, for use by prom_init.c
- *
- * Copyright 2011 IBM Corp.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#include <asm/ppc_asm.h>
-#include <asm/hvcall.h>
-#include <asm/asm-offsets.h>
-#include <asm/opal.h>
-
-#define H_HAL_TAKEOVER			0x5124
-#define H_HAL_TAKEOVER_QUERY_MAGIC	-1
-
-	.text
-_GLOBAL(opal_query_takeover)
-	mfcr	r0
-	stw	r0,8(r1)
-	stdu	r1,-STACKFRAMESIZE(r1)
-	std	r3,STK_PARAM(R3)(r1)
-	std	r4,STK_PARAM(R4)(r1)
-	li	r3,H_HAL_TAKEOVER
-	li	r4,H_HAL_TAKEOVER_QUERY_MAGIC
-	HVSC
-	addi	r1,r1,STACKFRAMESIZE
-	ld	r10,STK_PARAM(R3)(r1)
-	std	r4,0(r10)
-	ld	r10,STK_PARAM(R4)(r1)
-	std	r5,0(r10)
-	lwz	r0,8(r1)
-	mtcrf	0xff,r0
-	blr
-
-_GLOBAL(opal_do_takeover)
-	mfcr	r0
-	stw	r0,8(r1)
-	mflr	r0
-	std	r0,16(r1)
-	bl	__opal_do_takeover
-	ld	r0,16(r1)
-	mtlr	r0
-	lwz	r0,8(r1)
-	mtcrf	0xff,r0
-	blr
-
-__opal_do_takeover:
-	ld	r4,0(r3)
-	ld	r5,0x8(r3)
-	ld	r6,0x10(r3)
-	ld	r7,0x18(r3)
-	ld	r8,0x20(r3)
-	ld	r9,0x28(r3)
-	ld	r10,0x30(r3)
-	ld	r11,0x38(r3)
-	li	r3,H_HAL_TAKEOVER
-	HVSC
-	blr
-
-	.globl opal_secondary_entry
-opal_secondary_entry:
-	mr	r31,r3
-	mfmsr	r11
-	li	r12,(MSR_SF | MSR_ISF)@highest
-	sldi	r12,r12,48
-	or	r11,r11,r12
-	mtmsrd	r11
-	isync
-	mfspr	r4,SPRN_PIR
-	std	r4,0(r3)
-1:	HMT_LOW
-	ld	r4,8(r3)
-	cmpli	cr0,r4,0
-	beq	1b
-	HMT_MEDIUM
-1:	addi	r3,r31,16
-	bl	__opal_do_takeover
-	b	1b
-
-_GLOBAL(opal_enter_rtas)
-	mflr	r0
-	std	r0,16(r1)
-        stdu	r1,-PROM_FRAME_SIZE(r1)	/* Save SP and create stack space */
-
-	/* Because PROM is running in 32b mode, it clobbers the high order half
-	 * of all registers that it saves.  We therefore save those registers
-	 * PROM might touch to the stack.  (r0, r3-r13 are caller saved)
-	*/
-	SAVE_GPR(2, r1)
-	SAVE_GPR(13, r1)
-	SAVE_8GPRS(14, r1)
-	SAVE_10GPRS(22, r1)
-	mfcr	r10
-	mfmsr	r11
-	std	r10,_CCR(r1)
-	std	r11,_MSR(r1)
-
-	/* Get the PROM entrypoint */
-	mtlr	r5
-
-	/* Switch MSR to 32 bits mode
-	 */
-        li      r12,1
-        rldicr  r12,r12,MSR_SF_LG,(63-MSR_SF_LG)
-        andc    r11,r11,r12
-        li      r12,1
-        rldicr  r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
-        andc    r11,r11,r12
-        mtmsrd  r11
-        isync
-
-	/* Enter RTAS here... */
-	blrl
-
-	/* Just make sure that r1 top 32 bits didn't get
-	 * corrupt by OF
-	 */
-	rldicl	r1,r1,0,32
-
-	/* Restore the MSR (back to 64 bits) */
-	ld	r0,_MSR(r1)
-	MTMSRD(r0)
-        isync
-
-	/* Restore other registers */
-	REST_GPR(2, r1)
-	REST_GPR(13, r1)
-	REST_8GPRS(14, r1)
-	REST_10GPRS(22, r1)
-	ld	r4,_CCR(r1)
-	mtcr	r4
-
-        addi	r1,r1,PROM_FRAME_SIZE
-	ld	r0,16(r1)
-	mtlr    r0
-	blr
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH] powerpc/kvm: Fix build break with CONFIG_KVM_BOOK3S_64_HV=y
From: Michael Ellerman @ 2014-06-24  7:12 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, Stephen Rothwell, kvm, linux-kernel, agraf,
	linuxppc-dev
In-Reply-To: <20140624065127.GA4836@js1304-P5Q-DELUXE>

On Tue, 2014-06-24 at 15:51 +0900, Joonsoo Kim wrote:
> On Tue, Jun 24, 2014 at 04:36:47PM +1000, Michael Ellerman wrote:
> > Commit e58e263 "PPC, KVM, CMA: use general CMA reserved area management
> > framework" in next-20140624 removed arch/powerpc/kvm/book3s_hv_cma.c but
> > neglected to update the Makefile, thus breaking the build.
> > 
> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > ---
> > 
> > Hi Andrew,
> > 
> > This is in your akpm-current and is breaking some of the builds for
> > powerpc in linux-next. Squashing this fix into the original patch would
> > be best for us.
> > 
> 
> I sent really same patch 10 minutes ago. :)

Haha, oh well, I should have had a coffee instead :)

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/kvm: Fix build break with CONFIG_KVM_BOOK3S_64_HV=y
From: Joonsoo Kim @ 2014-06-24  6:51 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Andrew Morton, Stephen Rothwell, kvm, linux-kernel, agraf,
	linuxppc-dev
In-Reply-To: <1403591807-9550-1-git-send-email-mpe@ellerman.id.au>

On Tue, Jun 24, 2014 at 04:36:47PM +1000, Michael Ellerman wrote:
> Commit e58e263 "PPC, KVM, CMA: use general CMA reserved area management
> framework" in next-20140624 removed arch/powerpc/kvm/book3s_hv_cma.c but
> neglected to update the Makefile, thus breaking the build.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> 
> Hi Andrew,
> 
> This is in your akpm-current and is breaking some of the builds for
> powerpc in linux-next. Squashing this fix into the original patch would
> be best for us.
> 

I sent really same patch 10 minutes ago. :)

Thanks.

^ permalink raw reply

* Re: [PATCH v1 2/3] powerpc/powernv: Support PCI error injection
From: Benjamin Herrenschmidt @ 2014-06-24  7:00 UTC (permalink / raw)
  To: Mike Qiu; +Cc: aik, linuxppc-dev, Gavin Shan, kvm-ppc, agraf
In-Reply-To: <53A9216C.8050904@linux.vnet.ibm.com>

On Tue, 2014-06-24 at 14:57 +0800, Mike Qiu wrote:
> Is that mean *host* side error injection should base on 
> "CONFIG_IOMMU_API" ? If it is just host side(no guest, no pass through), 
> can't we do error inject?
> 
> Maybe I misunderstand :)

Ah no, make different patches, we don't want to use IOMMU group ID, just
PE numbers. Maybe we should expose in sysfs the PEs from the platform
code with the error injection files underneath ... 

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH v1 2/3] powerpc/powernv: Support PCI error injection
From: Mike Qiu @ 2014-06-24  6:57 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: aik, linuxppc-dev, Gavin Shan, kvm-ppc, agraf
In-Reply-To: <1403591761.4587.161.camel@pasglop>

On 06/24/2014 02:36 PM, Benjamin Herrenschmidt wrote:
>> Is it reasonable to do error injection with "CONFIG_IOMMU_API" ?
>>
>> That means if use default config(CONFIG_IOMMU_API = n),  we can not do
>> error injection to pci devices?
> Well we can't pass them through either so ...
> In any case, this is not a priority. First we need to implement a solid
> error injection facility for the *host*. The guest one is really really

OK.

Is that mean *host* side error injection should base on 
"CONFIG_IOMMU_API" ? If it is just host side(no guest, no pass through), 
can't we do error inject?

Maybe I misunderstand :)

Thanks
Mike
> low on the list.
>
> Cheers,
> Ben.
>
>
>

^ permalink raw reply

* Re: [PATCH] powerpc: Fix build warning
From: Benjamin Herrenschmidt @ 2014-06-24  6:38 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel, Vincent Guittot
In-Reply-To: <53A91449.6010701@roeck-us.net>

On Mon, 2014-06-23 at 23:01 -0700, Guenter Roeck wrote:
> I thought that only happens if a const is dropped, but maybe not.
> 
> Sigh. Much easier to break something than to fix it. That would mean
> to get approval
> from at least three maintainers, and all that to get rid of a warning.
> I don't
> really have time for that. Let's just forget about it and live with
> the warning.

Well you have my tentative approval :) And trivial ones like that don't
really need the respective maintainers to respond really, I forget
regularly and they still go upstream.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc/kvm: Fix build break with CONFIG_KVM_BOOK3S_64_HV=y
From: Michael Ellerman @ 2014-06-24  6:36 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Stephen Rothwell, kvm, linux-kernel, agraf, linuxppc-dev,
	iamjoonsoo.kim

Commit e58e263 "PPC, KVM, CMA: use general CMA reserved area management
framework" in next-20140624 removed arch/powerpc/kvm/book3s_hv_cma.c but
neglected to update the Makefile, thus breaking the build.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---

Hi Andrew,

This is in your akpm-current and is breaking some of the builds for
powerpc in linux-next. Squashing this fix into the original patch would
be best for us.

cheers

 arch/powerpc/kvm/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index ce569b6..72905c3 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -90,7 +90,6 @@ kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
 	book3s_hv_rm_mmu.o \
 	book3s_hv_ras.o \
 	book3s_hv_builtin.o \
-	book3s_hv_cma.o \
 	$(kvm-book3s_64-builtin-xics-objs-y)
 endif
 
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH v1 2/3] powerpc/powernv: Support PCI error injection
From: Benjamin Herrenschmidt @ 2014-06-24  6:36 UTC (permalink / raw)
  To: Mike Qiu; +Cc: aik, linuxppc-dev, Gavin Shan, kvm-ppc, agraf
In-Reply-To: <53A91819.1010900@linux.vnet.ibm.com>


> Is it reasonable to do error injection with "CONFIG_IOMMU_API" ?
> 
> That means if use default config(CONFIG_IOMMU_API = n),  we can not do 
> error injection to pci devices?

Well we can't pass them through either so ...

In any case, this is not a priority. First we need to implement a solid
error injection facility for the *host*. The guest one is really really
low on the list.

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH v1 2/3] powerpc/powernv: Support PCI error injection
From: Mike Qiu @ 2014-06-24  6:18 UTC (permalink / raw)
  To: Gavin Shan; +Cc: aik, linuxppc-dev, agraf, kvm-ppc
In-Reply-To: <1403489682-14841-3-git-send-email-gwshan@linux.vnet.ibm.com>

On 06/23/2014 10:14 AM, Gavin Shan wrote:
> The patch implements one OPAL firmware sysfs file to support PCI error
> injection: "/sys/firmware/opal/errinjct", which will be used like the
> way described as follows.
>
> According to PAPR spec, there are 3 RTAS calls related to error injection:
> "ibm,open-errinjct": allocate token prior to doing error injection.
> "ibm,close-errinjct": release the token allocated from "ibm,open-errinjct".
> "ibm,errinjct": do error injection.
>
> Sysfs file /sys/firmware/opal/errinjct accepts strings that have fixed
> format "ei_token ...". For now, we only support 32-bits and 64-bits
> PCI error injection and they should have following strings written to
> /sys/firmware/opal/errinjct as follows. We don't have corresponding
> sysfs files for "ibm,open-errinjct" and "ibm,close-errinjct", which
> means that we rely on userland to maintain the token by itself.
>
> 32-bits PCI error: "7:addr:mask:iommu_group_id:function".
> 64-bits PCI error: "8:addr:mask:iommu_group_id:function".
>
> The above "7" and "8" represent 32-bits and 64-bits PCI error seperately
> and "function" is one of the specific PCI errors (e.g. MMIO access address
> parity error), which are defined by PAPR spec.
>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>   arch/powerpc/include/asm/opal.h                |   1 +
>   arch/powerpc/platforms/powernv/Makefile        |   2 +-
>   arch/powerpc/platforms/powernv/opal-errinjct.c | 184 +++++++++++++++++++++++++
>   arch/powerpc/platforms/powernv/opal.c          |   2 +
>   4 files changed, 188 insertions(+), 1 deletion(-)
>   create mode 100644 arch/powerpc/platforms/powernv/opal-errinjct.c
>
> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
> index d982bb8..bf280d9 100644
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -985,6 +985,7 @@ extern int opal_elog_init(void);
>   extern void opal_platform_dump_init(void);
>   extern void opal_sys_param_init(void);
>   extern void opal_msglog_init(void);
> +extern void opal_errinjct_init(void);
>
>   extern int opal_machine_check(struct pt_regs *regs);
>   extern bool opal_mce_check_early_recovery(struct pt_regs *regs);
> diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
> index 63cebb9..4711de8 100644
> --- a/arch/powerpc/platforms/powernv/Makefile
> +++ b/arch/powerpc/platforms/powernv/Makefile
> @@ -1,7 +1,7 @@
>   obj-y			+= setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o
>   obj-y			+= opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
>   obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
> -obj-y			+= opal-msglog.o
> +obj-y			+= opal-msglog.o opal-errinjct.o
>
>   obj-$(CONFIG_SMP)	+= smp.o
>   obj-$(CONFIG_PCI)	+= pci.o pci-p5ioc2.o pci-ioda.o
> diff --git a/arch/powerpc/platforms/powernv/opal-errinjct.c b/arch/powerpc/platforms/powernv/opal-errinjct.c
> new file mode 100644
> index 0000000..29c9e83
> --- /dev/null
> +++ b/arch/powerpc/platforms/powernv/opal-errinjct.c
> @@ -0,0 +1,184 @@
> +/*
> + * The file supports error injection, which works based on OPAL API.
> + * For now, we only support PCI error injection. We need support
> + * injecting other types of errors in future.
> + *
> + * Copyright Gavin Shan, IBM Corporation 2014.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/msi.h>
> +#include <linux/pci.h>
> +#include <linux/iommu.h>
> +#include <linux/random.h>
> +#include <linux/slab.h>
> +#include <linux/sysfs.h>
> +#include <linux/fs.h>
> +#include <linux/fcntl.h>
> +#include <linux/kobject.h>
> +
> +#include <asm/msi_bitmap.h>
> +#include <asm/iommu.h>
> +#include <asm/pci-bridge.h>
> +#include <asm/ppc-pci.h>
> +#include <asm/opal.h>
> +
> +#include "powernv.h"
> +#include "pci.h"
> +
> +static DEFINE_MUTEX(errinjct_mutex);
> +
> +static int errinjct_iommu_group_to_phb_and_pe(uint32_t iommu_grp_id,
> +					      uint64_t *phb_id,
> +					      uint32_t *pe_num)
> +{
> +#ifdef CONFIG_IOMMU_API

Is it reasonable to do error injection with "CONFIG_IOMMU_API" ?

That means if use default config(CONFIG_IOMMU_API = n),  we can not do 
error injection to pci devices?

Thanks
Mike
> +	struct iommu_group *iommu_grp;
> +	struct iommu_table *tbl;
> +	struct pnv_ioda_pe *pe;
> +
> +	iommu_grp = iommu_group_get_by_id(iommu_grp_id);
> +	if (!iommu_grp)
> +		return -ENODEV;
> +
> +	tbl = iommu_group_get_iommudata(iommu_grp);
> +	if (!tbl)
> +		return -ENODEV;
> +
> +	pe = container_of(tbl, struct pnv_ioda_pe, tce32_table);
> +	if (!pe->phb)
> +		return -ENODEV;
> +
> +	*phb_id = pe->phb->opal_id;
> +	*pe_num = pe->pe_number;
> +
> +	return 0;
> +#endif
> +
> +	return -ENXIO;
> +}
> +
> +static int errinjct_ioa_bus_error(const char *buf, struct OpalErrinjct *ei)
> +{
> +	uint32_t iommu_grp_id;
> +	int ret;
> +
> +	/* Extract parameters */
> +	ret = sscanf(buf, "%x:%x:%x:%x:%x",
> +		     &ei->type, &ei->ioa.addr,
> +		     &ei->ioa.mask, &iommu_grp_id, ei->ioa.function);
> +	if (ret != 5)
> +		return -EINVAL;
> +
> +	/* Invalid function ? */
> +	if (ei->ioa.function < OpalEitIoaLoadMemAddr ||
> +	    ei->ioa.function > OpalEitIoaDmaWriteMemTarget)
> +		return -ERANGE;
> +
> +	/* Retrieve PHB ID and PE number */
> +	ret = errinjct_iommu_group_to_phb_and_pe(iommu_grp_id,
> +						 &ei->ioa.phb_id,
> +						 &ei->ioa.pe);
> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}
> +
> +static int errinjct_ioa_bus_error64(const char *buf, struct OpalErrinjct *ei)
> +{
> +	uint32_t iommu_grp_id;
> +	int ret;
> +
> +	/* Extract parameter */
> +	ret = sscanf(buf, "%x:%llx:%llx:%x:%x",
> +		     &ei->type, &ei->ioa64.addr,
> +		     &ei->ioa64.mask, &iommu_grp_id, &ei->ioa64.function);
> +	if (ret != 5)
> +		return -EINVAL;
> +
> +	/* Invalid function ? */
> +	if (ei->ioa64.function < OpalEitIoaLoadMemAddr ||
> +	    ei->ioa64.function > OpalEitIoaDmaWriteMemTarget)
> +		return -ERANGE;
> +
> +	/* Retrieve PHB ID and PE number */
> +	ret = errinjct_iommu_group_to_phb_and_pe(iommu_grp_id,
> +						 &ei->ioa64.phb_id,
> +						 &ei->ioa64.pe);
> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}
> +
> +static ssize_t errinjct_store(struct kobject *kobj,
> +			      struct kobj_attribute *attr,
> +			      const char *buf, size_t count)
> +{
> +	struct OpalErrinjct ei;
> +	int ret;
> +	long rc;
> +
> +	/* Extract common parameters */
> +	ret = sscanf(buf, "%x", &ei.type);
> +	if (ret != 1)
> +		return -EINVAL;
> +
> +	/* Error injection might be in progress */
> +	if (!mutex_trylock(&errinjct_mutex))
> +		return -EAGAIN;
> +
> +	switch (ei.type) {
> +	case OpalErrinjctTypeIoaBusError:
> +		ret = errinjct_ioa_bus_error(buf, &ei);
> +		break;
> +	case OpalErrinjctTypeIoaBusError64:
> +		ret = errinjct_ioa_bus_error64(buf, &ei);
> +		break;
> +	default:
> +		ret = -ERANGE;
> +	}
> +
> +	/* Invalid parameters ? */
> +	if (ret)
> +		goto mutex_unlock_exit;
> +
> +	/* OPAL call */
> +	rc = opal_err_injct(&ei);
> +	if (rc == OPAL_SUCCESS)
> +		ret = count;
> +	else
> +		ret = -EIO;
> +
> +mutex_unlock_exit:
> +	mutex_unlock(&errinjct_mutex);
> +	return ret;
> +}
> +
> +static struct kobj_attribute errinjct_attr =
> +	__ATTR(errinjct, 0600, NULL, errinjct_store);
> +
> +void __init opal_errinjct_init(void)
> +{
> +	int ret;
> +
> +	/* Make sure /sys/firmware/opal directory is created */
> +	if (!opal_kobj) {
> +		pr_warn("%s: opal kobject is not available\n",
> +			__func__);
> +		return;
> +	}
> +
> +	/* Create the sysfs files */
> +	ret = sysfs_create_file(opal_kobj, &errinjct_attr.attr);
> +	if (ret)
> +		pr_warn("%s: Cannot create sysfs file (%d)\n",
> +			__func__, ret);
> +}
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 360ad80c..cb29bb5 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -604,6 +604,8 @@ static int __init opal_init(void)
>   		opal_sys_param_init();
>   		/* Setup message log interface. */
>   		opal_msglog_init();
> +		/* Setup error injection interface */
> +		opal_errinjct_init();
>   	}
>
>   	return 0;

^ permalink raw reply

* Re: [PATCH] powerpc: Fix build warning
From: Guenter Roeck @ 2014-06-24  6:01 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, Paul Mackerras, linux-kernel, Vincent Guittot
In-Reply-To: <1403588053.4587.160.camel@pasglop>

On 06/23/2014 10:34 PM, Benjamin Herrenschmidt wrote:
> On Mon, 2014-06-23 at 22:05 -0700, Guenter Roeck wrote:
>> On 06/23/2014 09:35 PM, Benjamin Herrenschmidt wrote:
>>> On Fri, 2014-06-13 at 09:38 -0700, Guenter Roeck wrote:
>>>> If compiled with W=1, the following warning is seen in powerpc builds.
>>>>
>>>> arch/powerpc/kernel/smp.c:750:18: warning:
>>>> 	type qualifiers ignored on function return type
>>>> static const int powerpc_smt_flags(void)
>>>>                    ^
>>>>
>>>> This is caused by a function returning 'const int', which doesn't
>>>> make sense to gcc. Drop 'const' to fix the problem.
>>>
>>> This breaks the 64-bit build:
>>>
>>> arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror]
>>> arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]
>>>
>>> It appears that the generic definition in sched.h has this function
>>> defined as const int, so that needs to be fixed too along with all
>>> instances in all archs.
>>>
>>
>> https://lkml.org/lkml/2014/6/12/743
>
> Won't the patch above break powerpc then ? IE. The functions signature
> won't match anymore ... /me thinks you probably need to fix them all
> at once.
>

I thought that only happens if a const is dropped, but maybe not.

Sigh. Much easier to break something than to fix it. That would mean to get approval
from at least three maintainers, and all that to get rid of a warning. I don't
really have time for that. Let's just forget about it and live with the warning.

Guenter

^ permalink raw reply

* Re: [PATCH] powerpc: Fix build warning
From: Benjamin Herrenschmidt @ 2014-06-24  5:34 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel, Vincent Guittot
In-Reply-To: <53A90718.4050401@roeck-us.net>

On Mon, 2014-06-23 at 22:05 -0700, Guenter Roeck wrote:
> On 06/23/2014 09:35 PM, Benjamin Herrenschmidt wrote:
> > On Fri, 2014-06-13 at 09:38 -0700, Guenter Roeck wrote:
> >> If compiled with W=1, the following warning is seen in powerpc builds.
> >>
> >> arch/powerpc/kernel/smp.c:750:18: warning:
> >> 	type qualifiers ignored on function return type
> >> static const int powerpc_smt_flags(void)
> >>                   ^
> >>
> >> This is caused by a function returning 'const int', which doesn't
> >> make sense to gcc. Drop 'const' to fix the problem.
> >
> > This breaks the 64-bit build:
> >
> > arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror]
> > arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]
> >
> > It appears that the generic definition in sched.h has this function
> > defined as const int, so that needs to be fixed too along with all
> > instances in all archs.
> >
> 
> https://lkml.org/lkml/2014/6/12/743

Won't the patch above break powerpc then ? IE. The functions signature
won't match anymore ... /me thinks you probably need to fix them all
at once.

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH] powerpc: Fix build warning
From: Guenter Roeck @ 2014-06-24  5:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, Paul Mackerras, linux-kernel, Vincent Guittot
In-Reply-To: <1403584501.4587.153.camel@pasglop>

On 06/23/2014 09:35 PM, Benjamin Herrenschmidt wrote:
> On Fri, 2014-06-13 at 09:38 -0700, Guenter Roeck wrote:
>> If compiled with W=1, the following warning is seen in powerpc builds.
>>
>> arch/powerpc/kernel/smp.c:750:18: warning:
>> 	type qualifiers ignored on function return type
>> static const int powerpc_smt_flags(void)
>>                   ^
>>
>> This is caused by a function returning 'const int', which doesn't
>> make sense to gcc. Drop 'const' to fix the problem.
>
> This breaks the 64-bit build:
>
> arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror]
> arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]
>
> It appears that the generic definition in sched.h has this function
> defined as const int, so that needs to be fixed too along with all
> instances in all archs.
>

https://lkml.org/lkml/2014/6/12/743

Guenter

^ permalink raw reply

* Re: [PATCH] powerpc: Fix build warning
From: Benjamin Herrenschmidt @ 2014-06-24  4:35 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel, Vincent Guittot
In-Reply-To: <1402677499-28289-1-git-send-email-linux@roeck-us.net>

On Fri, 2014-06-13 at 09:38 -0700, Guenter Roeck wrote:
> If compiled with W=1, the following warning is seen in powerpc builds.
> 
> arch/powerpc/kernel/smp.c:750:18: warning:
> 	type qualifiers ignored on function return type
> static const int powerpc_smt_flags(void)
>                  ^
> 
> This is caused by a function returning 'const int', which doesn't
> make sense to gcc. Drop 'const' to fix the problem.

This breaks the 64-bit build:

arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror]
arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]

It appears that the generic definition in sched.h has this function
defined as const int, so that needs to be fixed too along with all
instances in all archs.

Cheers,
Ben.

> Reported-by: Vincent Guittot <vincent.guittot@linaro.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  arch/powerpc/kernel/smp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 10ffffe..49d5d4e 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -768,7 +768,7 @@ int setup_profiling_timer(unsigned int multiplier)
>  
>  #ifdef CONFIG_SCHED_SMT
>  /* cpumask of CPUs with asymetric SMT dependancy */
> -static const int powerpc_smt_flags(void)
> +static int powerpc_smt_flags(void)
>  {
>  	int flags = SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES;
>  

^ permalink raw reply

* Re: [PATCH] powerpc: module: fix TOC symbol CRC
From: Benjamin Herrenschmidt @ 2014-06-24  4:06 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: rusty, Laurent Dufour, linuxppc-dev
In-Reply-To: <20140619094404.18e7047b@kryten>

On Thu, 2014-06-19 at 09:44 +1000, Anton Blanchard wrote:
> Hi Laurent,
> 
> > The commit 71ec7c55ed91 introduced the magic symbol ".TOC." for ELFv2
> > ABI. This symbol is built manually and has no CRC value computed. A
> > zero value is put in the CRC section to avoid modpost complaining
> > about a missing CRC. Unfortunately, this breaks the kernel module
> > loading when the kernel is relocated (kdump case for instance)
> > because of the relocation applied to the kcrctab values.
> > 
> > This patch compute a CRC value for the TOC symbol which will match
> > the one compute by the kernel when it is relocated - aka '0 -
> > relocate_start' done in maybe_relocated called by check_version
> > (module.c).
> 
> Adding Rusty since he maintains the module loader code.

This patch gives me:

arch/powerpc/kernel/module_64.c: In function 'dedotify_versions':
arch/powerpc/kernel/module_64.c:325:33: error: 'reloc_start' undeclared (first use in this function)
arch/powerpc/kernel/module_64.c:325:33: note: each undeclared identifier is reported only once for each function it appears in

Cheers,
Ben.

^ 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