Skip to contentSkip to conversation

*** SUBJECT HERE ***

PATCH In review Geoff Levand 2 participants 9 messages Jan 13, 2015

Subsystems (2)
lore
Share & tools
lore

Geoff Levand

author maintainer
#0 lore raw

cover *** SUBJECT HERE ***

Hi Ben,

Here is a short series of updates for PS3, none are critical. Please queue. These are based on v3.18. I can rebase to something else if you like.

The first three patches are to have the kernel write the PS3 highmem info to the LV1 hypervisor registry so that the info will be available to second stage OS's loaded by petitboot/kexec. FreeBSD and some Linux derivatives use this feature.

The next two patches fix some warnings emitted by sparse.

The final patch refreshes ps3_defconfig and enables the highmem info write feature (CONFIG_PS3_REPOSITORY_WRITE=y) introduced in the first three patches.

-Geoff

The following changes since commit b2776bf7149bddd1f4161f14f79520f17fc1d71d:

Linux 3.18 (2014-12-07 14:21:05 -0800)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git for-powerpc

for you to fetch changes up to c9fc20b63c625d8d5c136f1e72d9930a6b0070df:

powerpc/ps3: Update ps3_defconfig (2014-12-23 14:56:29 -0800)

----------------------------------------------------------------
Geoff Levand (6):
powerpc/ps3: Add empty repository highmem routines powerpc/ps3: Add ps3_mm_set_repository_highmem powerpc/ps3: Write highmem info to repository powerpc/ps3: Fix vuart sparse warnings powerpc/ps3: Fix sys-manager-core sparse warnings powerpc/ps3: Update ps3_defconfig

 arch/powerpc/configs/ps3_defconfig    | 17 +++-----
 arch/powerpc/platforms/ps3/mm.c       | 77 ++++++++++++++++++++---------------
 arch/powerpc/platforms/ps3/platform.h | 13 ++++++
 drivers/ps3/ps3-vuart.c               |  5 ---
 drivers/ps3/sys-manager-core.c        |  6 +--
 drivers/ps3/vuart.h                   | 16 ++++++++
 6 files changed, 83 insertions(+), 51 deletions(-)
Signature · 1 line
1.9.1
author maintainer
#1 lore raw

PATCH 1/6 powerpc/ps3: Add empty repository highmem routines

To avoid the need for preprocessor conditionals in C source files add a set of empty inline repository highmem write routines to platform.h that are used when CONFIG_PS3_REPOSITORY_WRITE is not defined.

---
 arch/powerpc/platforms/ps3/platform.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/powerpc/platforms/ps3/platform.h +13 -0
index d71329a..1809cfc 100644
@@ -196,6 +196,7 @@ int ps3_repository_read_highmem_size(unsigned int region_index,
 int ps3_repository_read_highmem_info(unsigned int region_index,
 	u64 *highmem_base, u64 *highmem_size);
 
+#if defined (CONFIG_PS3_REPOSITORY_WRITE)
 int ps3_repository_write_highmem_region_count(unsigned int region_count);
 int ps3_repository_write_highmem_base(unsigned int region_index,
 	u64 highmem_base);
@@ -204,6 +205,18 @@ int ps3_repository_write_highmem_size(unsigned int region_index,
 int ps3_repository_write_highmem_info(unsigned int region_index,
 	u64 highmem_base, u64 highmem_size);
 int ps3_repository_delete_highmem_info(unsigned int region_index);
+#else
+static inline int ps3_repository_write_highmem_region_count(
+	unsigned int region_count) {return 0;}
+static inline int ps3_repository_write_highmem_base(unsigned int region_index,
+	u64 highmem_base) {return 0;}
+static inline int ps3_repository_write_highmem_size(unsigned int region_index,
+	u64 highmem_size) {return 0;}
+static inline int ps3_repository_write_highmem_info(unsigned int region_index,
+	u64 highmem_base, u64 highmem_size) {return 0;}
+static inline int ps3_repository_delete_highmem_info(unsigned int region_index)
+	{return 0;}
+#endif
 
 /* repository pme info */
 
Signature · 1 line
1.9.1
author maintainer
#2 lore raw

PATCH 2/6 powerpc/ps3: Add ps3_mm_set_repository_highmem

In reply to Geoff Levand

Add the new routine ps3_mm_set_repository_highmem() that saves highmem info to the ps3 repository. Also, move the existing ps3_mm_get_repository_highmem() routine up in the source file.

This inplementation of ps3_mm_set_repository_highmem() assumes the repository will have a single highmem region entry (at index 0).

---
 arch/powerpc/platforms/ps3/mm.c | 68 +++++++++++++++++++++++------------------
 1 file changed, 38 insertions(+), 30 deletions(-)
arch/powerpc/platforms/ps3/mm.c +38 -30
index 0c9f643..04c1b93 100644
@@ -223,6 +223,44 @@ void ps3_mm_vas_destroy(void)
 	}
 }
 
+static int ps3_mm_get_repository_highmem(struct mem_region *r)
+{
+	int result;
+
+	/* Assume a single highmem region. */
+
+	result = ps3_repository_read_highmem_info(0, &r->base, &r->size);
+
+	if (result)
+		goto zero_region;
+
+	if (!r->base || !r->size) {
+		result = -1;
+		goto zero_region;
+	}
+
+	r->offset = r->base - map.rm.size;
+
+	DBG("%s:%d: Found high region in repository: %llxh %llxh\n",
+	    __func__, __LINE__, r->base, r->size);
+
+	return 0;
+
+zero_region:
+	DBG("%s:%d: No high region in repository.\n", __func__, __LINE__);
+
+	r->size = r->base = r->offset = 0;
+	return result;
+}
+
+static int ps3_mm_set_repository_highmem(const struct mem_region *r)
+{
+	/* Assume a single highmem region. */
+
+	return r ? ps3_repository_write_highmem_info(0, r->base, r->size) :
+		ps3_repository_write_highmem_info(0, 0, 0);
+}
+
 /**
  * ps3_mm_region_create - create a memory region in the vas
  * @r: pointer to a struct mem_region to accept initialized values
@@ -293,36 +331,6 @@ static void ps3_mm_region_destroy(struct mem_region *r)
 	}
 }
 
-static int ps3_mm_get_repository_highmem(struct mem_region *r)
-{
-	int result;
-
-	/* Assume a single highmem region. */
-
-	result = ps3_repository_read_highmem_info(0, &r->base, &r->size);
-
-	if (result)
-		goto zero_region;
-
-	if (!r->base || !r->size) {
-		result = -1;
-		goto zero_region;
-	}
-
-	r->offset = r->base - map.rm.size;
-
-	DBG("%s:%d: Found high region in repository: %llxh %llxh\n",
-	    __func__, __LINE__, r->base, r->size);
-
-	return 0;
-
-zero_region:
-	DBG("%s:%d: No high region in repository.\n", __func__, __LINE__);
-
-	r->size = r->base = r->offset = 0;
-	return result;
-}
-
 /*============================================================================*/
 /* dma routines                                                               */
 /*============================================================================*/
Signature · 1 line
1.9.1
author maintainer
#3 lore raw

PATCH 3/6 powerpc/ps3: Write highmem info to repository

In reply to Geoff Levand

Add calls to the ps3_mm_set_repository_highmem() routine when the ps3 r1 highmem region is either created or destroyed.

---
 arch/powerpc/platforms/ps3/mm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/powerpc/platforms/ps3/mm.c +7 -2
index 04c1b93..b0f3466 100644
@@ -329,6 +329,7 @@ static void ps3_mm_region_destroy(struct mem_region *r)
 		r->size = r->base = r->offset = 0;
 		map.total = map.rm.size;
 	}
+	ps3_mm_set_repository_highmem(NULL);
 }
 
 /*============================================================================*/
@@ -1218,8 +1219,12 @@ void __init ps3_mm_init(void)
 
 	/* Check if we got the highmem region from an earlier boot step */
 
-	if (ps3_mm_get_repository_highmem(&map.r1))
-		ps3_mm_region_create(&map.r1, map.total - map.rm.size);
+	if (ps3_mm_get_repository_highmem(&map.r1)) {
+		result = ps3_mm_region_create(&map.r1, map.total - map.rm.size);
+
+		if (!result)
+			ps3_mm_set_repository_highmem(&map.r1);
+	}
 
 	/* correct map.total for the real total amount of memory we use */
 	map.total = map.rm.size + map.r1.size;
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH 3/6] powerpc/ps3: Write highmem info to repository

Quoted 2 lines · Geoff Levand

Add calls to the ps3_mm_set_repository_highmem() routine when the ps3 r1 highmem region is either created or destroyed.

What does this actually do? ie. from a user perspective.

cheers

author maintainer
#5 lore raw

Re: [PATCH 3/6] powerpc/ps3: Write highmem info to repository

Hi Michael,

Quoted 5 lines · Michael Ellerman
Quoted 2 lines · Geoff Levand

Add calls to the ps3_mm_set_repository_highmem() routine when the ps3 r1 highmem region is either created or destroyed.

What does this actually do? ie. from a user perspective.

It will allow a kexec based bootloader (petitboot for example) to pre-allocate a highmem region and store things like an initrd or other large data needed to boot an OS. With some PS3 configurations the boot memory region is not large enough to fit all the boot data.

There was ongoing discussion about this on the ML. Here are two relevant posts:

https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-April/097691.html
https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-April/097695.html

Here is the very first post which outlines the motivation, etc.:

https://lists.ozlabs.org/pipermail/cbe-oss-dev/2011-August/007420.html

-Geoff

author maintainer
#6 lore raw

PATCH 4/6 powerpc/ps3: Fix vuart sparse warnings

In reply to Geoff Levand

Fix sparse warnings like these:

drivers/ps3/ps3-vuart.c: warning: symbol 'ps3_vuart_disable_interrupt_tx' was not declared. Should it be static?

---
 drivers/ps3/ps3-vuart.c |  5 -----
 drivers/ps3/vuart.h     | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 5 deletions(-)
drivers/ps3/ps3-vuart.c +0 -5
index bc1e513..d6db822 100644
@@ -151,11 +151,6 @@ static void __maybe_unused _dump_port_params(unsigned int port_number,
 #endif
 }
 
-struct vuart_triggers {
-	unsigned long rx;
-	unsigned long tx;
-};
-
 int ps3_vuart_get_triggers(struct ps3_system_bus_device *dev,
 	struct vuart_triggers *trig)
 {
drivers/ps3/vuart.h +16 -0
index eb7f6d9..23358b7 100644
@@ -82,4 +82,20 @@ void ps3_vuart_cancel_async(struct ps3_system_bus_device *dev);
 void ps3_vuart_clear_rx_bytes(struct ps3_system_bus_device *dev,
 	unsigned int bytes);
 
+struct vuart_triggers {
+	unsigned long rx;
+	unsigned long tx;
+};
+
+int ps3_vuart_get_triggers(struct ps3_system_bus_device *dev,
+	struct vuart_triggers *trig);
+int ps3_vuart_set_triggers(struct ps3_system_bus_device *dev, unsigned int tx,
+	unsigned int rx);
+int ps3_vuart_enable_interrupt_tx(struct ps3_system_bus_device *dev);
+int ps3_vuart_disable_interrupt_tx(struct ps3_system_bus_device *dev);
+int ps3_vuart_enable_interrupt_rx(struct ps3_system_bus_device *dev);
+int ps3_vuart_disable_interrupt_rx(struct ps3_system_bus_device *dev);
+int ps3_vuart_enable_interrupt_disconnect(struct ps3_system_bus_device *dev);
+int ps3_vuart_disable_interrupt_disconnect(struct ps3_system_bus_device *dev);
+
 #endif
Signature · 1 line
1.9.1
author maintainer
#7 lore raw

PATCH 5/6 powerpc/ps3: Fix sys-manager-core sparse warnings

In reply to Geoff Levand

Fixes warnings like these:

drivers/ps3/sys-manager-core.c: error: symbol 'ps3_sys_manager_power_off' redeclared with different type

---
 drivers/ps3/sys-manager-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ps3/sys-manager-core.c +3 -3
index 0e41737..c429ffc 100644
@@ -47,7 +47,7 @@ void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops)
 }
 EXPORT_SYMBOL_GPL(ps3_sys_manager_register_ops);
 
-void ps3_sys_manager_power_off(void)
+void __noreturn ps3_sys_manager_power_off(void)
 {
 	if (ps3_sys_manager_ops.power_off)
 		ps3_sys_manager_ops.power_off(ps3_sys_manager_ops.dev);
@@ -55,7 +55,7 @@ void ps3_sys_manager_power_off(void)
 	ps3_sys_manager_halt();
 }
 
-void ps3_sys_manager_restart(void)
+void __noreturn ps3_sys_manager_restart(void)
 {
 	if (ps3_sys_manager_ops.restart)
 		ps3_sys_manager_ops.restart(ps3_sys_manager_ops.dev);
@@ -63,7 +63,7 @@ void ps3_sys_manager_restart(void)
 	ps3_sys_manager_halt();
 }
 
-void ps3_sys_manager_halt(void)
+void __noreturn ps3_sys_manager_halt(void)
 {
 	pr_emerg("System Halted, OK to turn off power\n");
 	local_irq_disable();
Signature · 1 line
1.9.1
author maintainer
#8 lore raw

PATCH 6/6 powerpc/ps3: Update ps3_defconfig

In reply to Geoff Levand

Refresh ps3_defconfig and add CONFIG_PS3_REPOSITORY_WRITE=y.

---
 arch/powerpc/configs/ps3_defconfig | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
arch/powerpc/configs/ps3_defconfig +6 -11
index 2e637c8..9836c1b 100644
@@ -22,6 +22,8 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_PPC_PSERIES is not set
 # CONFIG_PPC_PMAC is not set
 CONFIG_PPC_PS3=y
+CONFIG_PS3_ADVANCED=y
+CONFIG_PS3_REPOSITORY_WRITE=y
 CONFIG_PS3_DISK=y
 CONFIG_PS3_ROM=y
 CONFIG_PS3_FLASH=y
@@ -64,11 +66,9 @@ CONFIG_BT_HCIBTUSB=m
 CONFIG_CFG80211=m
 CONFIG_CFG80211_WEXT=y
 CONFIG_MAC80211=m
-CONFIG_MAC80211_RC_PID=y
 # CONFIG_MAC80211_RC_MINSTREL is not set
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 # CONFIG_FIRMWARE_IN_KERNEL is not set
-CONFIG_PROC_DEVICETREE=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=65535
@@ -76,7 +76,6 @@ CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_BLK_DEV_SR=y
 CONFIG_CHR_DEV_SG=m
-CONFIG_SCSI_MULTI_LUN=y
 # CONFIG_SCSI_LOWLEVEL is not set
 CONFIG_MD=y
 CONFIG_BLK_DEV_DM=m
@@ -107,7 +106,6 @@ CONFIG_INPUT_EVDEV=m
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_VIDEO_OUTPUT_CONTROL=m
 CONFIG_FB=y
 CONFIG_FB_PS3=y
 # CONFIG_VGA_CONSOLE is not set
@@ -130,8 +128,6 @@ CONFIG_HID_TWINHAN=m
 CONFIG_HID_LOGITECH=m
 CONFIG_HID_LOGITECH_DJ=m
 CONFIG_HID_MICROSOFT=m
-CONFIG_HID_PS3REMOTE=m
-CONFIG_HID_SONY=m
 CONFIG_HID_SUNPLUS=m
 CONFIG_HID_SMARTJOYPLUS=m
 CONFIG_USB_HIDDEV=y
@@ -169,18 +165,17 @@ CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_CRC_CCITT=m
 CONFIG_CRC_T10DIF=y
-CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_FS=y
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_MEMORY_INIT=y
+CONFIG_DEBUG_STACKOVERFLOW=y
 CONFIG_DETECT_HUNG_TASK=y
 CONFIG_PROVE_LOCKING=y
 CONFIG_DEBUG_LOCKDEP=y
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_MEMORY_INIT=y
 CONFIG_DEBUG_LIST=y
 CONFIG_RCU_CPU_STALL_TIMEOUT=60
 # CONFIG_FTRACE is not set
-CONFIG_DEBUG_STACKOVERFLOW=y
-CONFIG_CRYPTO_CCM=m
 CONFIG_CRYPTO_GCM=m
 CONFIG_CRYPTO_PCBC=m
 CONFIG_CRYPTO_MICHAEL_MIC=m
Signature · 1 line
1.9.1