On Feb 18, 2013, at 1:44 AM, Gleb Natapov wrote: > On Fri, Feb 15, 2013 at 11:10:46AM -0500, Sanjay Lal wrote: >> >> On Feb 6, 2013, at 8:20 AM, Gleb Natapov wrote: >> >>> On Wed, Nov 21, 2012 at 06:34:09PM -0800, Sanjay Lal wrote: >>>> +static gpa_t kvm_trap_emul_gva_to_gpa_cb(gva_t gva) >>>> +{ >>>> + gpa_t gpa; >>>> + uint32_t kseg = KSEGX(gva); >>>> + >>>> + if ((kseg == CKSEG0) || (kseg == CKSEG1)) >>> You seems to be using KVM_GUEST_KSEGX variants on gva in all other >>> places. Why not here? >> >> This function is invoked to handle 2 scenarios: >> (1) Parse the boot code config tables setup by QEMU's Malta emulation. The pointers in the tables are actual KSEG0 addresses (unmapped, cached) and not Guest KSEG0 addresses. >> > Where is it called for that purpose? The only place where gva_to_gpa > callback is called is in kvm/kvm_mips_emul.c:kvm_mips_emulate_(store|load) Load/stores from/to KSEG1 generate the Address Error Load/Store exceptions. The handler calls kvm_mips_emul.c:kvm_mips_emulate_(store|load) which then call the gva_to_gpa callback. > >> (2) Handle I/O accesses by the guest. On MIPS platforms, I/O device registers are mapped into the KSEG1 address space (unmapped, uncached). Again like (1) these are actual KSEG1 addresses, which cause an exception and are passed onto QEMU for I/O emulation. >> > So guest KSEG1 registers is mapped to 0xA0000000-0xBFFFFFFF ranges just > like on a host? Can you give corresponding segment names to those ranges > > Guest User address space: 0x00000000 -> 0x40000000 (useg?) > Guest Kernel Unmapped: 0x40000000 -> 0x60000000 (kseg0?) > Guest Kernel Mapped: 0x60000000 -> 0x80000000 (?) > Yes, now that you mention it :-). I'll add a corresponding Guest Kernel KSEG1 segment name. Regards Sanjay