Skip to content

Commit

Permalink
Merge branch 'android-goldfish-3.10' into genymotion-goldfish-3.10
Browse files Browse the repository at this point in the history
* android-goldfish-3.10: (252 commits)
  platform: goldfish: pipe: don't log when dropping PIPE_ERROR_AGAIN
  platform: goldfish: pipe: add devicetree bindings
  arm64: ranchu: regenerate minimal defconfig
  arm64: Add ranchu defconfig
  goldfish_fb: Set pixclock = 0
  android_pipe: Pin pages to memory while copying and other cleanups
  android_pipe: don't be clever with #define offsets
  arm64: kernel: fix per-cpu offset restore on resume
  arm64: kernel: restore HW breakpoint registers in cpu_suspend
  arm64: hw_breakpoint compile error fixing
  arm64: kernel: add MPIDR_EL1 accessors macros
  arm64: add CPU power management menu/entries
  arm64: kernel: add PM build infrastructure
  arm64: kernel: add CPU idle call
  arm64: enable generic clockevent broadcast
  arm64: kernel: implement HW breakpoints CPU PM notifier
  arm64: kernel: refactor code to install/uninstall breakpoints
  arm: kvm: implement CPU PM notifier
  arm64: kernel: implement fpsimd CPU PM notifier
  arm64: kernel: cpu_{suspend/resume} implementation
  ...
  • Loading branch information
srats committed Sep 1, 2014
2 parents 757700e + 1bebc76 commit c8a7d47
Show file tree
Hide file tree
Showing 186 changed files with 7,165 additions and 2,068 deletions.
37 changes: 22 additions & 15 deletions Documentation/DMA-API-HOWTO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,23 @@ style to do this even if your device holds the default setting,
because this shows that you did think about these issues wrt. your
device.

The query is performed via a call to dma_set_mask():
The query is performed via a call to dma_set_mask_and_coherent():

int dma_set_mask(struct device *dev, u64 mask);
int dma_set_mask_and_coherent(struct device *dev, u64 mask);

The query for consistent allocations is performed via a call to
dma_set_coherent_mask():
which will query the mask for both streaming and coherent APIs together.
If you have some special requirements, then the following two separate
queries can be used instead:

int dma_set_coherent_mask(struct device *dev, u64 mask);
The query for streaming mappings is performed via a call to
dma_set_mask():

int dma_set_mask(struct device *dev, u64 mask);

The query for consistent allocations is performed via a call
to dma_set_coherent_mask():

int dma_set_coherent_mask(struct device *dev, u64 mask);

Here, dev is a pointer to the device struct of your device, and mask
is a bit mask describing which bits of an address your device
Expand Down Expand Up @@ -137,7 +146,7 @@ exactly why.

The standard 32-bit addressing device would do something like this:

if (dma_set_mask(dev, DMA_BIT_MASK(32))) {
if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {
printk(KERN_WARNING
"mydev: No suitable DMA available.\n");
goto ignore_this_device;
Expand Down Expand Up @@ -171,22 +180,20 @@ the case would look like this:

int using_dac, consistent_using_dac;

if (!dma_set_mask(dev, DMA_BIT_MASK(64))) {
if (!dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))) {
using_dac = 1;
consistent_using_dac = 1;
dma_set_coherent_mask(dev, DMA_BIT_MASK(64));
} else if (!dma_set_mask(dev, DMA_BIT_MASK(32))) {
} else if (!dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {
using_dac = 0;
consistent_using_dac = 0;
dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
} else {
printk(KERN_WARNING
"mydev: No suitable DMA available.\n");
goto ignore_this_device;
}

dma_set_coherent_mask() will always be able to set the same or a
smaller mask as dma_set_mask(). However for the rare case that a
The coherent coherent mask will always be able to set the same or a
smaller mask as the streaming mask. However for the rare case that a
device driver only uses consistent allocations, one would have to
check the return value from dma_set_coherent_mask().

Expand All @@ -199,9 +206,9 @@ address you might do something like:
goto ignore_this_device;
}

When dma_set_mask() is successful, and returns zero, the kernel saves
away this mask you have provided. The kernel will use this
information later when you make DMA mappings.
When dma_set_mask() or dma_set_mask_and_coherent() is successful, and
returns zero, the kernel saves away this mask you have provided. The
kernel will use this information later when you make DMA mappings.

There is a case which we are aware of at this time, which is worth
mentioning in this documentation. If your device supports multiple
Expand Down
8 changes: 8 additions & 0 deletions Documentation/DMA-API.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ won't change the current mask settings. It is more intended as an
internal API for use by the platform than an external API for use by
driver writers.

int
dma_set_mask_and_coherent(struct device *dev, u64 mask)

Checks to see if the mask is possible and updates the device
streaming and coherent DMA mask parameters if it is.

Returns: 0 if successful and a negative error if not.

int
dma_set_mask(struct device *dev, u64 mask)

Expand Down
16 changes: 13 additions & 3 deletions Documentation/arm64/booting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,23 @@ Image target is available instead.

Requirement: MANDATORY

The decompressed kernel image contains a 32-byte header as follows:
The decompressed kernel image contains a 64-byte header as follows:

u32 magic = 0x14000008; /* branch to stext, little-endian */
u32 res0 = 0; /* reserved */
u32 code0; /* Executable code */
u32 code1; /* Executable code */
u64 text_offset; /* Image load offset */
u64 res0 = 0; /* reserved */
u64 res1 = 0; /* reserved */
u64 res2 = 0; /* reserved */
u64 res3 = 0; /* reserved */
u64 res4 = 0; /* reserved */
u32 magic = 0x644d5241; /* Magic number, little endian, "ARM\x64" */
u32 res5 = 0; /* reserved */


Header notes:

- code0/code1 are responsible for branching to stext.

The image must be placed at the specified offset (currently 0x80000)
from the start of the system RAM and called there. The start of the
Expand Down
37 changes: 33 additions & 4 deletions Documentation/arm64/memory.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The swapper_pgd_dir address is written to TTBR1 and never written to
TTBR0.


AArch64 Linux memory layout:
AArch64 Linux memory layout with 4KB pages:

Start End Size Use
-----------------------------------------------------------------------
Expand All @@ -35,17 +35,46 @@ ffffffbc00000000 ffffffbdffffffff 8GB vmemmap

ffffffbe00000000 ffffffbffbbfffff ~8GB [guard, future vmmemap]

ffffffbffbc00000 ffffffbffbdfffff 2MB earlyprintk device
ffffffbffa000000 ffffffbffaffffff 16MB PCI I/O space

ffffffbffbe00000 ffffffbffbe0ffff 64KB PCI I/O space
ffffffbffb000000 ffffffbffbbfffff 12MB [guard]

ffffffbbffff0000 ffffffbcffffffff ~2MB [guard]
ffffffbffbc00000 ffffffbffbdfffff 2MB fixed mappings

ffffffbffbe00000 ffffffbffbffffff 2MB [guard]

ffffffbffc000000 ffffffbfffffffff 64MB modules

ffffffc000000000 ffffffffffffffff 256GB kernel logical memory map


AArch64 Linux memory layout with 64KB pages:

Start End Size Use
-----------------------------------------------------------------------
0000000000000000 000003ffffffffff 4TB user

fffffc0000000000 fffffdfbfffeffff ~2TB vmalloc

fffffdfbffff0000 fffffdfbffffffff 64KB [guard page]

fffffdfc00000000 fffffdfdffffffff 8GB vmemmap

fffffdfe00000000 fffffdfffbbfffff ~8GB [guard, future vmmemap]

fffffdfffa000000 fffffdfffaffffff 16MB PCI I/O space

fffffdfffb000000 fffffdfffbbfffff 12MB [guard]

fffffdfffbc00000 fffffdfffbdfffff 2MB fixed mappings

fffffdfffbe00000 fffffdfffbffffff 2MB [guard]

fffffdfffc000000 fffffdffffffffff 64MB modules

fffffe0000000000 ffffffffffffffff 2TB kernel logical memory map


Translation table lookup with 4KB pages:

+--------+--------+--------+--------+--------+--------+--------+--------+
Expand Down
5 changes: 2 additions & 3 deletions arch/arc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
#endif

#ifdef CONFIG_OF_FLATTREE
void __init early_init_dt_setup_initrd_arch(unsigned long start,
unsigned long end)
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
pr_err("%s(%lx, %lx)\n", __func__, start, end);
pr_err("%s(%llx, %llx)\n", __func__, start, end);
}
#endif /* CONFIG_OF_FLATTREE */
3 changes: 0 additions & 3 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ config GENERIC_BUG
def_bool y
depends on BUG

config GOLDFISH
bool

source "init/Kconfig"

source "kernel/Kconfig.freezer"
Expand Down
45 changes: 31 additions & 14 deletions arch/arm/include/asm/arch_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ static inline u32 arch_timer_get_cntfrq(void)
return val;
}

static inline u64 arch_counter_get_cntpct(void)
{
u64 cval;

isb();
asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
return cval;
}

static inline u64 arch_counter_get_cntvct(void)
{
u64 cval;
Expand All @@ -98,17 +89,43 @@ static inline u64 arch_counter_get_cntvct(void)
return cval;
}

static inline void __cpuinit arch_counter_set_user_access(void)
static inline u32 arch_timer_get_cntkctl(void)
{
u32 cntkctl;

asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl));
return cntkctl;
}

/* disable user access to everything */
cntkctl &= ~((3 << 8) | (7 << 0));

static inline void arch_timer_set_cntkctl(u32 cntkctl)
{
asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
}

static inline void __cpuinit arch_counter_set_user_access(void)
{
u32 cntkctl = arch_timer_get_cntkctl();

/* Disable user access to both physical/virtual counters/timers */
/* Also disable virtual event stream */
cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
| ARCH_TIMER_USR_VT_ACCESS_EN
| ARCH_TIMER_VIRT_EVT_EN
| ARCH_TIMER_USR_VCT_ACCESS_EN
| ARCH_TIMER_USR_PCT_ACCESS_EN);
arch_timer_set_cntkctl(cntkctl);
}

static inline void arch_timer_evtstrm_enable(int divider)
{
u32 cntkctl = arch_timer_get_cntkctl();
cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
/* Set the divider and enable virtual event stream */
cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
| ARCH_TIMER_VIRT_EVT_EN;
arch_timer_set_cntkctl(cntkctl);
elf_hwcap |= HWCAP_EVTSTRM;
}

#endif

#endif
3 changes: 1 addition & 2 deletions arch/arm/include/asm/dma-contiguous.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
#define ASMARM_DMA_CONTIGUOUS_H

#ifdef __KERNEL__
#ifdef CONFIG_CMA
#ifdef CONFIG_DMA_CMA

#include <linux/types.h>
#include <asm-generic/dma-contiguous.h>

void dma_contiguous_early_fixup(phys_addr_t base, unsigned long size);

Expand Down
2 changes: 0 additions & 2 deletions arch/arm/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];

typedef struct user_fp elf_fpregset_t;

#define EM_ARM 40

#define EF_ARM_EABI_MASK 0xff000000
#define EF_ARM_EABI_UNKNOWN 0x00000000
#define EF_ARM_EABI_VER1 0x01000000
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/include/uapi/asm/hwcap.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define HWCAP_IDIVT (1 << 18)
#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */
#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)

#define HWCAP_LPAE (1 << 20)
#define HWCAP_EVTSTRM (1 << 21)

#endif /* _UAPI__ASMARM_HWCAP_H */
3 changes: 3 additions & 0 deletions arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,9 @@ static const char *hwcap_str[] = {
"vfpv4",
"idiva",
"idivt",
"vfpd32",
"lpae",
"evtstrm",
NULL
};

Expand Down
30 changes: 30 additions & 0 deletions arch/arm/kvm/arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include <linux/cpu.h>
#include <linux/cpu_pm.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/kvm_host.h>
Expand Down Expand Up @@ -835,6 +836,33 @@ static struct notifier_block hyp_init_cpu_nb = {
.notifier_call = hyp_init_cpu_notify,
};

#ifdef CONFIG_CPU_PM
static int hyp_init_cpu_pm_notifier(struct notifier_block *self,
unsigned long cmd,
void *v)
{
if (cmd == CPU_PM_EXIT) {
cpu_init_hyp_mode(NULL);
return NOTIFY_OK;
}

return NOTIFY_DONE;
}

static struct notifier_block hyp_init_cpu_pm_nb = {
.notifier_call = hyp_init_cpu_pm_notifier,
};

static void __init hyp_cpu_pm_init(void)
{
cpu_pm_register_notifier(&hyp_init_cpu_pm_nb);
}
#else
static inline void hyp_cpu_pm_init(void)
{
}
#endif

/**
* Inits Hyp-mode on all online CPUs
*/
Expand Down Expand Up @@ -995,6 +1023,8 @@ int kvm_arch_init(void *opaque)
goto out_err;
}

hyp_cpu_pm_init();

kvm_coproc_table_init();
return 0;
out_err:
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static int __init atomic_pool_init(void)
if (!pages)
goto no_pages;

if (IS_ENABLED(CONFIG_CMA))
if (IS_ENABLED(CONFIG_DMA_CMA))
ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page,
atomic_pool_init);
else
Expand Down Expand Up @@ -670,7 +670,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
addr = __alloc_simple_buffer(dev, size, gfp, &page);
else if (!(gfp & __GFP_WAIT))
addr = __alloc_from_pool(size, &page);
else if (!IS_ENABLED(CONFIG_CMA))
else if (!IS_ENABLED(CONFIG_DMA_CMA))
addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller);
else
addr = __alloc_from_contiguous(dev, size, prot, &page, caller);
Expand Down Expand Up @@ -759,7 +759,7 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr,
__dma_free_buffer(page, size);
} else if (__free_from_pool(cpu_addr, size)) {
return;
} else if (!IS_ENABLED(CONFIG_CMA)) {
} else if (!IS_ENABLED(CONFIG_DMA_CMA)) {
__dma_free_remap(cpu_addr, size);
__dma_free_buffer(page, size);
} else {
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static int __init parse_tag_initrd2(const struct tag *tag)
__tagtable(ATAG_INITRD2, parse_tag_initrd2);

#ifdef CONFIG_OF_FLATTREE
void __init early_init_dt_setup_initrd_arch(unsigned long start, unsigned long end)
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
phys_initrd_start = start;
phys_initrd_size = end - start;
Expand Down
Loading

0 comments on commit c8a7d47

Please sign in to comment.