Skip to content

Commit

Permalink
Merge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/cmetcalf/linux-tile

Pull tile update from Chris Metcalf:
 "The interesting bug fix is support for the upcoming "4.2" release of
  the Tilera hypervisor, which by default launches Linux at privilege
  level 2 instead of 1.  The fix lets new and old hypervisors and
  Linuxes interoperate more smoothly, so I've tagged it for
  stable@kernel.org so that older Linuxes will be able to boot under the
  newer hypervisor."

* 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
  usb: tilegx: fix memleak when create hcd fail
  arch/tile: remove inline marking of EXPORT_SYMBOL functions
  rtc: rtc-tile: add missing platform_device_unregister() when module exit
  tile: support new Tilera hypervisor
  • Loading branch information
Linus Torvalds committed May 9, 2013
2 parents 091d0d5 + abab876 commit b32729b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 17 deletions.
14 changes: 10 additions & 4 deletions arch/tile/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,17 @@ config HARDWALL
config KERNEL_PL
int "Processor protection level for kernel"
range 1 2
default "1"
default 2 if TILEGX
default 1 if !TILEGX
---help---
This setting determines the processor protection level the
kernel will be built to run at. Generally you should use
the default value here.
Since MDE 4.2, the Tilera hypervisor runs the kernel
at PL2 by default. If running under an older hypervisor,
or as a KVM guest, you must run at PL1. (The current
hypervisor may also be recompiled with "make HV_PL=2" to
allow it to run a kernel at PL1, but clients running at PL1
are not expected to be supported indefinitely.)

If you're not sure, don't change the default.

source "arch/tile/gxio/Kconfig"

Expand Down
27 changes: 24 additions & 3 deletions arch/tile/include/hv/hypervisor.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,22 @@
#define HV_DISPATCH_ENTRY_SIZE 32

/** Version of the hypervisor interface defined by this file */
#define _HV_VERSION 11
#define _HV_VERSION 13

/** Last version of the hypervisor interface with old hv_init() ABI.
*
* The change from version 12 to version 13 corresponds to launching
* the client by default at PL2 instead of PL1 (corresponding to the
* hv itself running at PL3 instead of PL2). To make this explicit,
* the hv_init() API was also extended so the client can report its
* desired PL, resulting in a more helpful failure diagnostic. If you
* call hv_init() with _HV_VERSION_OLD_HV_INIT and omit the client_pl
* argument, the hypervisor will assume client_pl = 1.
*
* Note that this is a deprecated solution and we do not expect to
* support clients of the Tilera hypervisor running at PL1 indefinitely.
*/
#define _HV_VERSION_OLD_HV_INIT 12

/* Index into hypervisor interface dispatch code blocks.
*
Expand Down Expand Up @@ -377,17 +392,23 @@ typedef int HV_Errno;
#ifndef __ASSEMBLER__

/** Pass HV_VERSION to hv_init to request this version of the interface. */
typedef enum { HV_VERSION = _HV_VERSION } HV_VersionNumber;
typedef enum {
HV_VERSION = _HV_VERSION,
HV_VERSION_OLD_HV_INIT = _HV_VERSION_OLD_HV_INIT,

} HV_VersionNumber;

/** Initializes the hypervisor.
*
* @param interface_version_number The version of the hypervisor interface
* that this program expects, typically HV_VERSION.
* @param chip_num Architecture number of the chip the client was built for.
* @param chip_rev_num Revision number of the chip the client was built for.
* @param client_pl Privilege level the client is built for
* (not required if interface_version_number == HV_VERSION_OLD_HV_INIT).
*/
void hv_init(HV_VersionNumber interface_version_number,
int chip_num, int chip_rev_num);
int chip_num, int chip_rev_num, int client_pl);


/** Queries we can make for hv_sysconf().
Expand Down
2 changes: 1 addition & 1 deletion arch/tile/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ENTRY(_start)
movei r2, TILE_CHIP_REV
}
{
moveli r0, _HV_VERSION
moveli r0, _HV_VERSION_OLD_HV_INIT
jal hv_init
}
/* Get a reasonable default ASID in r0 */
Expand Down
12 changes: 9 additions & 3 deletions arch/tile/kernel/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@
ENTRY(_start)
/* Notify the hypervisor of what version of the API we want */
{
#if KERNEL_PL == 1 && _HV_VERSION == 13
/* Support older hypervisors by asking for API version 12. */
movei r0, _HV_VERSION_OLD_HV_INIT
#else
movei r0, _HV_VERSION
#endif
movei r1, TILE_CHIP
movei r2, TILE_CHIP_REV
}
{
moveli r0, _HV_VERSION
jal hv_init
movei r2, TILE_CHIP_REV
movei r3, KERNEL_PL
}
jal hv_init
/* Get a reasonable default ASID in r0 */
{
move r0, zero
Expand Down
2 changes: 1 addition & 1 deletion arch/tile/lib/spinlock_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ EXPORT_SYMBOL(arch_spin_unlock_wait);
* preserve the semantic that the same read lock can be acquired in an
* interrupt context.
*/
inline int arch_read_trylock(arch_rwlock_t *rwlock)
int arch_read_trylock(arch_rwlock_t *rwlock)
{
u32 val;
__insn_mtspr(SPR_INTERRUPT_CRITICAL_SECTION, 1);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/tile/tilegx.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ static int tile_net_setup_interrupts(struct net_device *dev)
if (info->has_iqueue) {
gxio_mpipe_request_notif_ring_interrupt(
&context, cpu_x(cpu), cpu_y(cpu),
1, ingress_irq, info->iqueue.ring);
KERNEL_PL, ingress_irq, info->iqueue.ring);
}
}

Expand Down
1 change: 1 addition & 0 deletions drivers/rtc/rtc-tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ static int __init tile_rtc_driver_init(void)
*/
static void __exit tile_rtc_driver_exit(void)
{
platform_device_unregister(tile_rtc_platform_device);
platform_driver_unregister(&tile_rtc_platform_driver);
}

Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/host/ehci-tilegx.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ static int ehci_hcd_tilegx_drv_probe(struct platform_device *pdev)

hcd = usb_create_hcd(&ehci_tilegx_hc_driver, &pdev->dev,
dev_name(&pdev->dev));
if (!hcd)
return -ENOMEM;
if (!hcd) {
ret = -ENOMEM;
goto err_hcd;
}

/*
* We don't use rsrc_start to map in our registers, but seems like
Expand Down Expand Up @@ -176,6 +178,7 @@ static int ehci_hcd_tilegx_drv_probe(struct platform_device *pdev)
err_no_irq:
tilegx_stop_ehc();
usb_put_hcd(hcd);
err_hcd:
gxio_usb_host_destroy(&pdata->usb_ctx);
return ret;
}
Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/host/ohci-tilegx.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ static int ohci_hcd_tilegx_drv_probe(struct platform_device *pdev)

hcd = usb_create_hcd(&ohci_tilegx_hc_driver, &pdev->dev,
dev_name(&pdev->dev));
if (!hcd)
return -ENOMEM;
if (!hcd) {
ret = -ENOMEM;
goto err_hcd;
}

/*
* We don't use rsrc_start to map in our registers, but seems like
Expand Down Expand Up @@ -165,6 +167,7 @@ static int ohci_hcd_tilegx_drv_probe(struct platform_device *pdev)
err_no_irq:
tilegx_stop_ohc();
usb_put_hcd(hcd);
err_hcd:
gxio_usb_host_destroy(&pdata->usb_ctx);
return ret;
}
Expand Down

0 comments on commit b32729b

Please sign in to comment.