Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4798
b: refs/heads/master
c: 514fd7f
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Jul 13, 2005
1 parent 9036333 commit 6a1e3ee
Show file tree
Hide file tree
Showing 31 changed files with 338 additions and 285 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99ad25a313bda566a346b46a6015afa65bc0a02b
refs/heads/master: 514fd7fd01d378a7b5584c657d9807fc28f22079
7 changes: 6 additions & 1 deletion trunk/arch/ppc/boot/images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ MKIMAGE := $(srctree)/scripts/mkuboot.sh

extra-y := vmlinux.bin vmlinux.gz

# two make processes may write to vmlinux.gz at the same time with make -j
quiet_cmd_mygzip = GZIP $@
cmd_mygzip = gzip -f -9 < $< > $@.$$$$ && mv $@.$$$$ $@


OBJCOPYFLAGS_vmlinux.bin := -O binary
$(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy)

$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,gzip)
$(call if_changed,mygzip)

quiet_cmd_uimage = UIMAGE $@
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T kernel \
Expand Down
38 changes: 22 additions & 16 deletions trunk/arch/ppc64/kernel/cpu_setup_power4.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ _GLOBAL(__970_cpu_preinit)
*/
mfspr r0,SPRN_PVR
srwi r0,r0,16
cmpwi cr0,r0,0x39
cmpwi cr1,r0,0x3c
cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
cmpwi r0,0x39
beq 1f
cmpwi r0,0x3c
beq 1f
cmpwi r0,0x44
bnelr
1:

/* Make sure HID4:rm_ci is off before MMU is turned off, that large
* pages are enabled with HID4:61 and clear HID5:DCBZ_size and
Expand Down Expand Up @@ -133,12 +136,14 @@ _GLOBAL(__save_cpu_setup)
/* We only deal with 970 for now */
mfspr r0,SPRN_PVR
srwi r0,r0,16
cmpwi cr0,r0,0x39
cmpwi cr1,r0,0x3c
cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
bne 1f

/* Save HID0,1,4 and 5 */
cmpwi r0,0x39
beq 1f
cmpwi r0,0x3c
beq 1f
cmpwi r0,0x44
bne 2f

1: /* Save HID0,1,4 and 5 */
mfspr r3,SPRN_HID0
std r3,CS_HID0(r5)
mfspr r3,SPRN_HID1
Expand All @@ -148,7 +153,7 @@ _GLOBAL(__save_cpu_setup)
mfspr r3,SPRN_HID5
std r3,CS_HID5(r5)

1:
2:
mtcr r7
blr

Expand All @@ -165,12 +170,14 @@ _GLOBAL(__restore_cpu_setup)
/* We only deal with 970 for now */
mfspr r0,SPRN_PVR
srwi r0,r0,16
cmpwi cr0,r0,0x39
cmpwi cr1,r0,0x3c
cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
bne 1f
cmpwi r0,0x39
beq 1f
cmpwi r0,0x3c
beq 1f
cmpwi r0,0x44
bnelr

/* Before accessing memory, we make sure rm_ci is clear */
1: /* Before accessing memory, we make sure rm_ci is clear */
li r0,0
mfspr r3,SPRN_HID4
rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
Expand Down Expand Up @@ -223,6 +230,5 @@ _GLOBAL(__restore_cpu_setup)
mtspr SPRN_HID5,r3
sync
isync
1:
blr

15 changes: 15 additions & 0 deletions trunk/arch/ppc64/kernel/cputable.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ struct cpu_spec cpu_specs[] = {
.cpu_setup = __setup_cpu_ppc970,
.firmware_features = COMMON_PPC64_FW,
},
{ /* PPC970MP */
.pvr_mask = 0xffff0000,
.pvr_value = 0x00440000,
.cpu_name = "PPC970MP",
.cpu_features = CPU_FTR_SPLIT_ID_CACHE |
CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA,
.cpu_user_features = COMMON_USER_PPC64 |
PPC_FEATURE_HAS_ALTIVEC_COMP,
.icache_bsize = 128,
.dcache_bsize = 128,
.cpu_setup = __setup_cpu_ppc970,
.firmware_features = COMMON_PPC64_FW,
},
{ /* Power5 */
.pvr_mask = 0xffff0000,
.pvr_value = 0x003a0000,
Expand Down
51 changes: 21 additions & 30 deletions trunk/arch/ppc64/kernel/iSeries_htab.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,45 +38,40 @@ static inline void iSeries_hunlock(unsigned long slot)
}

static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
unsigned long prpn, int secondary,
unsigned long hpteflags, int bolted, int large)
unsigned long prpn, unsigned long vflags,
unsigned long rflags)
{
long slot;
HPTE lhpte;
hpte_t lhpte;
int secondary = 0;

/*
* The hypervisor tries both primary and secondary.
* If we are being called to insert in the secondary,
* it means we have already tried both primary and secondary,
* so we return failure immediately.
*/
if (secondary)
if (vflags & HPTE_V_SECONDARY)
return -1;

iSeries_hlock(hpte_group);

slot = HvCallHpt_findValid(&lhpte, va >> PAGE_SHIFT);
BUG_ON(lhpte.dw0.dw0.v);
BUG_ON(lhpte.v & HPTE_V_VALID);

if (slot == -1) { /* No available entry found in either group */
iSeries_hunlock(hpte_group);
return -1;
}

if (slot < 0) { /* MSB set means secondary group */
vflags |= HPTE_V_VALID;
secondary = 1;
slot &= 0x7fffffffffffffff;
}

lhpte.dw1.dword1 = 0;
lhpte.dw1.dw1.rpn = physRpn_to_absRpn(prpn);
lhpte.dw1.flags.flags = hpteflags;

lhpte.dw0.dword0 = 0;
lhpte.dw0.dw0.avpn = va >> 23;
lhpte.dw0.dw0.h = secondary;
lhpte.dw0.dw0.bolted = bolted;
lhpte.dw0.dw0.v = 1;
lhpte.v = (va >> 23) << HPTE_V_AVPN_SHIFT | vflags | HPTE_V_VALID;
lhpte.r = (physRpn_to_absRpn(prpn) << HPTE_R_RPN_SHIFT) | rflags;

/* Now fill in the actual HPTE */
HvCallHpt_addValidate(slot, secondary, &lhpte);
Expand All @@ -88,31 +83,27 @@ static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,

static unsigned long iSeries_hpte_getword0(unsigned long slot)
{
unsigned long dword0;
HPTE hpte;
hpte_t hpte;

HvCallHpt_get(&hpte, slot);
dword0 = hpte.dw0.dword0;

return dword0;
return hpte.v;
}

static long iSeries_hpte_remove(unsigned long hpte_group)
{
unsigned long slot_offset;
int i;
HPTE lhpte;
unsigned long hpte_v;

/* Pick a random slot to start at */
slot_offset = mftb() & 0x7;

iSeries_hlock(hpte_group);

for (i = 0; i < HPTES_PER_GROUP; i++) {
lhpte.dw0.dword0 =
iSeries_hpte_getword0(hpte_group + slot_offset);
hpte_v = iSeries_hpte_getword0(hpte_group + slot_offset);

if (!lhpte.dw0.dw0.bolted) {
if (! (hpte_v & HPTE_V_BOLTED)) {
HvCallHpt_invalidateSetSwBitsGet(hpte_group +
slot_offset, 0, 0);
iSeries_hunlock(hpte_group);
Expand All @@ -137,13 +128,13 @@ static long iSeries_hpte_remove(unsigned long hpte_group)
static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
unsigned long va, int large, int local)
{
HPTE hpte;
hpte_t hpte;
unsigned long avpn = va >> 23;

iSeries_hlock(slot);

HvCallHpt_get(&hpte, slot);
if ((hpte.dw0.dw0.avpn == avpn) && (hpte.dw0.dw0.v)) {
if ((HPTE_V_AVPN_VAL(hpte.v) == avpn) && (hpte.v & HPTE_V_VALID)) {
/*
* Hypervisor expects bits as NPPP, which is
* different from how they are mapped in our PP.
Expand All @@ -167,7 +158,7 @@ static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
*/
static long iSeries_hpte_find(unsigned long vpn)
{
HPTE hpte;
hpte_t hpte;
long slot;

/*
Expand All @@ -177,7 +168,7 @@ static long iSeries_hpte_find(unsigned long vpn)
* 0x80000000xxxxxxxx : Entry found in secondary group, slot x
*/
slot = HvCallHpt_findValid(&hpte, vpn);
if (hpte.dw0.dw0.v) {
if (hpte.v & HPTE_V_VALID) {
if (slot < 0) {
slot &= 0x7fffffffffffffff;
slot = -slot;
Expand Down Expand Up @@ -212,17 +203,17 @@ static void iSeries_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
int large, int local)
{
HPTE lhpte;
unsigned long hpte_v;
unsigned long avpn = va >> 23;
unsigned long flags;

local_irq_save(flags);

iSeries_hlock(slot);

lhpte.dw0.dword0 = iSeries_hpte_getword0(slot);
hpte_v = iSeries_hpte_getword0(slot);

if ((lhpte.dw0.dw0.avpn == avpn) && lhpte.dw0.dw0.v)
if ((HPTE_V_AVPN_VAL(hpte_v) == avpn) && (hpte_v & HPTE_V_VALID))
HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0);

iSeries_hunlock(slot);
Expand Down
18 changes: 8 additions & 10 deletions trunk/arch/ppc64/kernel/iSeries_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ static void __init build_iSeries_Memory_Map(void)

/* Fill in the hashed page table hash mask */
num_ptegs = hptSizePages *
(PAGE_SIZE / (sizeof(HPTE) * HPTES_PER_GROUP));
(PAGE_SIZE / (sizeof(hpte_t) * HPTES_PER_GROUP));
htab_hash_mask = num_ptegs - 1;

/*
Expand Down Expand Up @@ -618,25 +618,23 @@ static void __init setup_iSeries_cache_sizes(void)
static void iSeries_make_pte(unsigned long va, unsigned long pa,
int mode)
{
HPTE local_hpte, rhpte;
hpte_t local_hpte, rhpte;
unsigned long hash, vpn;
long slot;

vpn = va >> PAGE_SHIFT;
hash = hpt_hash(vpn, 0);

local_hpte.dw1.dword1 = pa | mode;
local_hpte.dw0.dword0 = 0;
local_hpte.dw0.dw0.avpn = va >> 23;
local_hpte.dw0.dw0.bolted = 1; /* bolted */
local_hpte.dw0.dw0.v = 1;
local_hpte.r = pa | mode;
local_hpte.v = ((va >> 23) << HPTE_V_AVPN_SHIFT)
| HPTE_V_BOLTED | HPTE_V_VALID;

slot = HvCallHpt_findValid(&rhpte, vpn);
if (slot < 0) {
/* Must find space in primary group */
panic("hash_page: hpte already exists\n");
}
HvCallHpt_addValidate(slot, 0, (HPTE *)&local_hpte );
HvCallHpt_addValidate(slot, 0, &local_hpte);
}

/*
Expand All @@ -646,7 +644,7 @@ static void __init iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr)
{
unsigned long pa;
unsigned long mode_rw = _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX;
HPTE hpte;
hpte_t hpte;

for (pa = saddr; pa < eaddr ;pa += PAGE_SIZE) {
unsigned long ea = (unsigned long)__va(pa);
Expand All @@ -659,7 +657,7 @@ static void __init iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr)
if (!in_kernel_text(ea))
mode_rw |= HW_NO_EXEC;

if (hpte.dw0.dw0.v) {
if (hpte.v & HPTE_V_VALID) {
/* HPTE exists, so just bolt it */
HvCallHpt_setSwBits(slot, 0x10, 0);
/* And make sure the pp bits are correct */
Expand Down
Loading

0 comments on commit 6a1e3ee

Please sign in to comment.