Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.4-rc6 73 lines 2.3 kB view raw
1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License, version 2, as 4 * published by the Free Software Foundation. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * GNU General Public License for more details. 10 * 11 * You should have received a copy of the GNU General Public License 12 * along with this program; if not, write to the Free Software 13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 14 * 15 * Copyright 2010 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> 16 * Copyright 2011 David Gibson, IBM Corporation <dwg@au1.ibm.com> 17 */ 18 19#include <linux/types.h> 20#include <linux/string.h> 21#include <linux/kvm.h> 22#include <linux/kvm_host.h> 23#include <linux/highmem.h> 24#include <linux/gfp.h> 25#include <linux/slab.h> 26#include <linux/hugetlb.h> 27#include <linux/list.h> 28 29#include <asm/tlbflush.h> 30#include <asm/kvm_ppc.h> 31#include <asm/kvm_book3s.h> 32#include <asm/mmu-hash64.h> 33#include <asm/hvcall.h> 34#include <asm/synch.h> 35#include <asm/ppc-opcode.h> 36#include <asm/kvm_host.h> 37#include <asm/udbg.h> 38 39#define TCES_PER_PAGE (PAGE_SIZE / sizeof(u64)) 40 41long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, 42 unsigned long ioba, unsigned long tce) 43{ 44 struct kvm *kvm = vcpu->kvm; 45 struct kvmppc_spapr_tce_table *stt; 46 47 /* udbg_printf("H_PUT_TCE(): liobn=0x%lx ioba=0x%lx, tce=0x%lx\n", */ 48 /* liobn, ioba, tce); */ 49 50 list_for_each_entry(stt, &kvm->arch.spapr_tce_tables, list) { 51 if (stt->liobn == liobn) { 52 unsigned long idx = ioba >> SPAPR_TCE_SHIFT; 53 struct page *page; 54 u64 *tbl; 55 56 /* udbg_printf("H_PUT_TCE: liobn 0x%lx => stt=%p window_size=0x%x\n", */ 57 /* liobn, stt, stt->window_size); */ 58 if (ioba >= stt->window_size) 59 return H_PARAMETER; 60 61 page = stt->pages[idx / TCES_PER_PAGE]; 62 tbl = (u64 *)page_address(page); 63 64 /* FIXME: Need to validate the TCE itself */ 65 /* udbg_printf("tce @ %p\n", &tbl[idx % TCES_PER_PAGE]); */ 66 tbl[idx % TCES_PER_PAGE] = tce; 67 return H_SUCCESS; 68 } 69 } 70 71 /* Didn't find the liobn, punt it to userspace */ 72 return H_TOO_HARD; 73}